2013-03-24 393 views
1

我正嘗試使用ffmpeg二進制文件,並通過android中的本地linux命令調用它。大多數命令工作正常,但問題是,當我需要傳遞一個http url作爲-i選項的輸入時,我得到「沒有這樣的文件或目錄」的網址。然而,url是存在的,並且在mac上運行SAME命令可以按預期完成這項工作。FFMPEG「no such file or directory」on Android

這裏是我的ffmpeg的編譯編譯配置:

./configure \ 
$DEBUG_FLAG \ 
--arch=arm \ 
--cpu=cortex-a8 \ 
--target-os=linux \ 
--enable-runtime-cpudetect \ 
--prefix=$prefix \ 
--enable-pic \ 
--disable-shared \ 
--enable-static \ 
--cross-prefix=$NDK_TOOLCHAIN_BASE/bin/$NDK_ABI-linux-androideabi- \ 
--sysroot="$NDK_SYSROOT" \ 
--extra-cflags="-I../x264 -mfloat-abi=softfp -mfpu=neon" \ 
--extra-ldflags="-L../x264" \ 
\ 
--enable-version3 \ 
--enable-gpl \ 
\ 
--disable-doc \ 
--enable-yasm \ 
\ 
--enable-decoders \ 
--enable-nonfree \ 
--enable-encoders \ 
--enable-muxers \ 
--enable-demuxers \ 
--enable-parsers \ 
--enable-protocols \ 
--enable-protocol=http \ 
--enable-filters \ 
--enable-avresample \ 
\ 
--disable-indevs \ 
--enable-indev=lavfi \ 
\ 
--enable-hwaccels \ 
\ 
--enable-ffmpeg \ 
--enable-ffplay \ 
--enable-libmp3lame \ 
--enable-network \ 
\ 
--enable-libx264 \ 
--enable-libfaac \ 
--enable-zlib 

其基於關閉此項目:https://github.com/guardianproject/android-ffmpeg-java

命令是沿該線的東西:

ffmpeg -i "http://someurl" -f mp3 -ab 192000 -vn demoo.mp3 

的想法是從視頻下載音軌並將其編碼爲mp3。我明確添加了多個啓用協議選項,但似乎沒有任何工作。我也嘗試了一種替代配置,刪除enable-gpl以下的所有內容,以確保沒有任何衝突,但它引發了相同的錯誤。如果我給它一個正常的文件系統路徑,它工作正常。

這裏下面的評論是命令的準確輸出和輸出:

03-25 00:22:08.806: VERBOSE/FFMPEG(16491): /data/data/org.ffmpeg.android/app_bin/ffmpeg -i "http://r6---sn-gvbxgn-tt1d.c.youtube.com/videoplayback?ipbits=8&cp=U0hVSVJLV19KUUNONV9KRUFJOnQ0STMtb0JXc0py&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&id=c0045acebe0c3341&upn=IVAGxSD1hE0&source=youtube&ratebypass=yes&mv=m&key=yt1&expire=1364209857&itag=18&ms=au&ip=99.234.119.90&mt=1364185033&fexp=923418%2C901802%2C906383%2C902000%2C919512%2C913605%2C931202%2C900821%2C900823%2C931203%2C931401%2C908529%2C919373%2C930803%2C920201%2C929602%2C930101%2C930603%2C926403%2C900824%2C910223&sver=3&newshard=yes&signature=838AEB4650D8353B70DBC49341E0C40706DC6153.297639FD70A7F9710F29AE9E278A4FC4A32E0C67" -f mp3 -ab 192000 -vn /data/data/org.ffmpeg.android/files/demoooo.mp3 -loglevel debug 
03-25 00:22:08.956: DEBUG/ffmpeg(16491): Process exited with code:1 
03-25 00:22:08.966: DEBUG/ffmpeg(16491): Shell output:ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers 
03-25 00:22:08.976: DEBUG/ffmpeg(16491): Shell output: built on Mar 24 2013 02:24:38 with gcc 4.6 20120106 (prerelease) 
03-25 00:22:08.976: DEBUG/ffmpeg(16491): Shell output: configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/Users/feribg/Dev/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi- --sysroot=/Users/feribg/Dev/android-ndk-r8d/platforms/android-3/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon' --extra-ldflags=-L../x264 --enable-version3 --enable-gpl 
03-25 00:22:08.976: DEBUG/ffmpeg(16491): Shell output: libavutil  51. 54.100/51. 54.100 
03-25 00:22:08.976: DEBUG/ffmpeg(16491): Shell output: libavcodec  54. 23.100/54. 23.100 
03-25 00:22:08.976: DEBUG/ffmpeg(16491): Shell output: libavformat 54. 6.100/54. 6.100 
03-25 00:22:08.986: DEBUG/ffmpeg(16491): Shell output: libavdevice 54. 0.100/54. 0.100 
03-25 00:22:08.996: DEBUG/ffmpeg(16491): Shell output: libavfilter  2. 77.100/2. 77.100 
03-25 00:22:08.996: DEBUG/ffmpeg(16491): Shell output: libswscale  2. 1.100/2. 1.100 
03-25 00:22:08.996: DEBUG/ffmpeg(16491): Shell output: libswresample 0. 15.100/0. 15.100 
03-25 00:22:08.996: DEBUG/ffmpeg(16491): Shell output: libpostproc 52. 0.100/52. 0.100 
03-25 00:22:08.996: DEBUG/ffmpeg(16491): Shell output:"http://r6---sn-gvbxgn-tt1d.c.youtube.com/videoplayback?ipbits=8&cp=U0hVSVJLV19KUUNONV9KRUFJOnQ0STMtb0JXc0py&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&id=c0045acebe0c3341&upn=IVAGxSD1hE0&source=youtube&ratebypass=yes&mv=m&key=yt1&expire=1364209857&itag=18&ms=au&ip=99.234.119.90&mt=1364185033&fexp=923418%2C901802%2C906383%2C902000%2C919512%2C913605%2C931202%2C900821%2C900823%2C931203%2C931401%2C908529%2C919373%2C930803%2C920201%2C929602%2C930101%2C930603%2C926403%2C900824%2C910223&sver=3&newshard=yes&signature=838AEB4650D8353B70DBC49341E0C40706DC6153.297639FD70A7F9710F29AE9E278A4FC4A32E0C67": No such file or directory 
+0

很可能ffmpeg二進制文件太舊了。你能發佈完整的錯誤輸出嗎? – slhck 2013-03-24 16:34:27

+0

將你的過程分成兩個步驟。 Http獲取輸入文件並將其存儲在設備上。然後使用本地輸入文件正常ffmpeg。 – 2013-03-24 19:52:17

+0

如果你計劃分發應用程序,IMO - 你應該使用普通的JNI接口,如git中的Guardian。 CLI易碎。如果你需要去CLI路由,你可以看看使用Busybox/WGET獲取文件,然後是正常的CLI ffmpeg。您可以將它放在bash腳本中,以在設備上的CLI上運行腳本。 – 2013-03-24 19:58:04

回答

1

BTW如果你想撕毀youtub看到youtube audio

RTSP Java客戶端庫here

你是否正在閱讀從ffmpeg調用stderr?我敢打賭,如果你看看它,ffmpeg stdout OR stderr將包含有關嘗試通過http連接到遠程輸入文件的網絡接口出現了什麼問題的消息....

下面是android wrapper的示例,它獲取stderr:

System.out.println("Starting process " +command.toString()); 
      ProcessBuilder builder = new ProcessBuilder(command); 
      Map<String, String> environ = builder.environment(); 
//   for(Entry<String, String> entry : environ.entrySet()){ 
    //   System.out.println("ENV " +entry.getKey() + " " +entry.getValue()); 
     //  } 
//   builder.redirectErrorStream(true); 
      Process process = null; 
      try { 
       process = builder.start(); 

      InputStream is = process.getInputStream(); 

      InputStreamReader isr = new InputStreamReader(is); 
      BufferedReader br = new BufferedReader(isr); 
      String line; 
      while ((line = br.readLine()) != null) { 
       //System.out.println(line); 
       outfil=line; 
      } 
+0

是的,我繼續顯示庫的版本,配置選項,命令執行等,並停在:「http:// blabal」沒有這樣的文件或目錄。這是輸出中的最後一行。 – Feras 2013-03-24 20:21:05

+0

你想撕掉音頻嗎?什麼是容器類型?你可能想看看使用VLC而不是ffmpeg? – 2013-03-24 20:47:40

+0

'ffmpeg -loglevel debug'可以提供關於http輸入錯誤的更多信息。 – 2013-03-24 21:22:12

相關問題