2016-06-14 76 views
0

我一直在試圖合併(連接)兩個具有相同高度和寬度的mp4視頻,但會發生一些錯誤。 的代碼是:FFMPEG合併兩個視頻(連接)

FFmpeg ffmpeg = FFmpeg.getInstance(EditVideoActivity.this); 
      String list = generateList(new String[]{ActualVideoFile.getAbsolutePath(), path}); 
      try { 
       ffmpeg.execute("ffmpeg -f concat -i " + list + " -c:v copy " + mergedVideo.getAbsolutePath(), new FFmpegExecuteResponseHandler() { 
        @Override 
        public void onStart() { 
         Log.e("Start", "Start"); 
        } 

        @Override 
        public void onFinish() { 
         Log.e("FINISHED", "finish"); 
        } 


        @Override 
        public void onSuccess(String message) { 
         Log.e("SUCCESS", message); 
        } 

        @Override 
        public void onProgress(String message) { 
         Log.e("PROGRESSSS", message); 
        } 

        @Override 
        public void onFailure(String message) { 
         Log.e("FAILURE", message); 
        } 


       }); 
      } catch (FFmpegCommandAlreadyRunningException e) { 
       e.printStackTrace(); 
       Log.e("FFMEG Exception", "" + e); 
      } 

的logcat:

/PROGRESSSS: ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease) 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: 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=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libavutil  51. 54.100/51. 54.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libavcodec  54. 23.100/54. 23.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libavformat 54. 6.100/54. 6.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libavdevice 54. 0.100/54. 0.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libavfilter  2. 77.100/2. 77.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libswscale  2. 1.100/2. 1.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libswresample 0. 15.100/0. 15.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: libpostproc 52. 0.100/52. 0.100 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: [NULL @ 0x2aeef3b0] Unable to find a suitable output format for 'ffmpeg' 
06-09 01:24:09.400 8512-8512/com.myApp E/PROGRESSSS: ffmpeg: Invalid argument 
06-09 01:24:09.400 8512-8512/com.myApp E/FAILURE: ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers 
                 built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease) 
                 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=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib 
                 libavutil  51. 54.100/51. 54.100 
                 libavcodec  54. 23.100/54. 23.100 
                 libavformat 54. 6.100/54. 6.100 
                 libavdevice 54. 0.100/54. 0.100 
                 libavfilter  2. 77.100/2. 77.100 
                 libswscale  2. 1.100/2. 1.100 
                 libswresample 0. 15.100/0. 15.100 
                 libpostproc 52. 0.100/52. 0.100 
                 [NULL @ 0x2aeef3b0] Unable to find a suitable output format for 'ffmpeg' 
                 ffmpeg: Invalid argument 

我使用hiteshsondhi88的FFMPEG庫 任何幫助,將不勝感激。 感謝

+0

'無法找到「ffmpeg''應該說這一切合適的輸出格式。 'ffmpeg'是程序,而不是文件格式。嘗試類似'.mp4' –

+0

@MarcB現在顯示無法找到合適的輸出格式'[email protected]' –

+1

0.11.1是古老且不受支持的。你用這麼舊的版本浪費你的時間和我們的時間。 – LordNeckbeard

回答

0

而不是當前的:

ffmpeg.execute("ffmpeg -f concat -i " + list + " -c:v copy " + mergedVideo.getAbsolutePath(), new FFmpegExecuteResponseHandler() { 

嘗試使用這樣的:

ffmpeg.execute("-f concat -i " + list + " -c:v copy " + mergedVideo.getAbsolutePath(), new FFmpegExecuteResponseHandler() { 
+0

未知輸入格式:'concat'OnFailure –

+0

FFMPEG DEVICE版本:0.11.1built FFMPEG圖書館版本:n2.4.2 –

+0

這很奇怪。它不應該假設'concat'是一種文件格式...只是爲了確保一切正常,嘗試一個視頻的基本轉換爲mp3聲音:'ffmpeg.execute(「 - y -i /storagepath/yourvideo.mp4 /存儲路徑/ testoutput.mp3「,新的FFmpegExecuteResponseHandler(){'其中**存儲路徑**是哪裏視頻文件所在位置(SD卡?內部存儲?等),你會得到一個名爲** testoutput.mp3 **它可以播放? –