Android上的FFMPEG“没有这样的文件或目录”

时间:2013-03-24 06:41:13

标签: android http url ffmpeg

我正在尝试使用ffmpeg二进制文件并通过android中的本机linux命令调用它。大多数命令工作正常,但问题是,当我需要传递一个http url作为-i选项的输入时,我得到url的“没有这样的文件或目录”。然而,url存在并在mac上运行SAME命令按预期执行作业。

这是我的ffmpeg build的编译配置:

./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

1 个答案:

答案 0 :(得分:1)

顺便说一句,如果它想要翻录你的浴缸,请看youtube audio

RTSP java客户端库here

你是否正在通过ffmpeg的电话阅读stderr?我敢打赌,如果你看一下ffmpeg stdout OR stderr将包含有关网络接口试图通过http连接到远程输入文件的问题的消息....

下面是获取stderr的android包装器示例:

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;
            }