如何使用 ffmpeg 获取以下合并的视频文件?
请帮我
编辑
我使用 hstack & vstack 出现以下错误
06-24 17:11:39.133 14565-14565/com.parksangha.videorecorder I/System.out: onFailure : WARNING: linker: /data/data/com.parksangha.videorecorder/files/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
06-24 17:11:39.133 14565-14565/com.parksangha.videorecorder I/System.out: ffmpeg version n2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: built on Oct 7 2014 15:08:46 with gcc 4.8 (GCC)
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: configuration: --target-os=linux --cross-prefix=/home/sb/Source-Code/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/sb/Source-Code/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/sb/Source-Code/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/sb/Source-Code/ffmpeg-android/build/armeabi-v7a-neon --extra-cflags='-I/home/sb/Source-Code/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all -mfpu=neon' --extra-ldflags='-L/home/sb/Source-Code/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libavutil 54. 7.100 / 54. 7.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libavcodec 56. 1.100 / 56. 1.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libavformat 56. 4.101 / 56. 4.101
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libavdevice 56. 0.100 / 56. 0.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libavfilter 5. 1.100 / 5. 1.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libswscale 3. 0.100 / 3. 0.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libswresample 1. 1.100 / 1. 1.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: libpostproc 53. 0.100 / 53. 0.100
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/sdcard/testffmpeg/1.mp4':
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: major_brand : mp42
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: minor_version : 0
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: compatible_brands: isommp42
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Duration: 00:00:05.42, start: 0.000000, bitrate: 3081 kb/s
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2949 kb/s, 30.02 fps, 30 tbr, 90k tbn, 180k tbc (default)
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: rotate : 90
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : VideoHandle
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Side data:
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: displaymatrix: rotation of -90.00 degrees
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 153 kb/s (default)
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : SoundHandle
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/sdcard/testffmpeg/2.mp4':
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.143 14565-14565/com.parksangha.videorecorder I/System.out: major_brand : mp42
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: minor_version : 0
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: compatible_brands: isommp42
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Duration: 00:00:05.42, start: 0.000000, bitrate: 3081 kb/s
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2949 kb/s, 30.02 fps, 30 tbr, 90k tbn, 180k tbc (default)
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: rotate : 90
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : VideoHandle
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Side data:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: displaymatrix: rotation of -90.00 degrees
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Stream #1:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 153 kb/s (default)
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : SoundHandle
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/sdcard/testffmpeg/3.mp4':
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: major_brand : mp42
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: minor_version : 0
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: compatible_brands: isommp42
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Duration: 00:00:05.42, start: 0.000000, bitrate: 3081 kb/s
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Stream #2:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 2949 kb/s, 30.02 fps, 30 tbr, 90k tbn, 180k tbc (default)
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: rotate : 90
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : VideoHandle
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Side data:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: displaymatrix: rotation of -90.00 degrees
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Stream #2:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 153 kb/s (default)
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Metadata:
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: creation_time : 2016-06-23 21:21:16
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: handler_name : SoundHandle
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: [AVFilterGraph @ 0xb5468240] No such filter: 'hstack'
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: Error configuring filters.
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/LOG: On Finish
06-24 17:11:39.153 14565-14565/com.parksangha.videorecorder I/System.out: onFinish
编辑
因为使用vstack和hstack转到了2016版本。
我在android中使用以下代码:
String[] cmds = new String[]{"-i",video1+".mp4","-i",video2+".mp4","-i",video3+".mp4","-filter","complex","[1:v][2:v]hstack[bottom];[0:v][bottom]vstack",output+".mp4"};
但是我收到以下错误:
06-25 03:02:36.438 17859-17859/co.gioin.testsquarecamera I/System.out: onStart
06-25 03:02:36.548 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
06-25 03:02:36.548 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : built with gcc 4.8 (GCC)
06-25 03:02:36.548 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
06-25 03:02:36.568 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libavutil 55. 17.103 / 55. 17.103
06-25 03:02:36.568 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libavcodec 57. 24.102 / 57. 24.102
06-25 03:02:36.578 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libavformat 57. 25.100 / 57. 25.100
06-25 03:02:36.578 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libavdevice 57. 0.101 / 57. 0.101
06-25 03:02:36.578 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libavfilter 6. 31.100 / 6. 31.100
06-25 03:02:36.578 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libswscale 4. 0.100 / 4. 0.100
06-25 03:02:36.588 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libswresample 2. 0.101 / 2. 0.101
06-25 03:02:36.588 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : libpostproc 54. 0.100 / 54. 0.100
06-25 03:02:36.618 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/mainVideo.mp4':
06-25 03:02:36.618 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.618 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : major_brand : isom
06-25 03:02:36.618 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : minor_version : 512
06-25 03:02:36.628 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : compatible_brands: isomiso2avc1mp41
06-25 03:02:36.628 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : encoder : Lavf56.4.101
06-25 03:02:36.628 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Duration: 00:00:00.68, start: 0.021333, bitrate: 3947 kb/s
06-25 03:02:36.628 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 902x1080, 5228 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : rotate : 90
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : VideoHandler
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Side data:
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.638 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 94 kb/s (default)
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : SoundHandler
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/leftVideo.mp4':
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : major_brand : isom
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : minor_version : 512
06-25 03:02:36.648 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : compatible_brands: isomiso2avc1mp41
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : encoder : Lavf56.4.101
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Duration: 00:00:01.22, start: 0.021333, bitrate: 2360 kb/s
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1440x938, 2544 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : rotate : 90
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : VideoHandler
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Side data:
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 113 kb/s (default)
06-25 03:02:36.658 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.668 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : SoundHandler
06-25 03:02:36.678 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/rightVideo.mp4':
06-25 03:02:36.678 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.688 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : major_brand : isom
06-25 03:02:36.688 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : minor_version : 512
06-25 03:02:36.688 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : compatible_brands: isomiso2avc1mp41
06-25 03:02:36.688 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : encoder : Lavf56.4.101
06-25 03:02:36.688 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Duration: 00:00:00.99, start: 0.021333, bitrate: 5945 kb/s
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #2:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1440x938, 6933 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : rotate : 90
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : VideoHandler
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Side data:
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 109 kb/s (default)
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : Metadata:
06-25 03:02:36.698 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : handler_name : SoundHandler
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : [NULL @ 0xb5460c00] Unable to find a suitable output format for '[1:v][2:v]hstack[bottom];[0:v][bottom]vstack'
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: onProgress : [1:v][2:v]hstack[bottom];[0:v][bottom]vstack: Invalid argument
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: onFailure : ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: built with gcc 4.8 (GCC)
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: libavutil 55. 17.103 / 55. 17.103
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: libavcodec 57. 24.102 / 57. 24.102
06-25 03:02:36.708 17859-17859/co.gioin.testsquarecamera I/System.out: libavformat 57. 25.100 / 57. 25.100
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: libavdevice 57. 0.101 / 57. 0.101
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: libavfilter 6. 31.100 / 6. 31.100
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: libswscale 4. 0.100 / 4. 0.100
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: libswresample 2. 0.101 / 2. 0.101
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: libpostproc 54. 0.100 / 54. 0.100
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/mainVideo.mp4':
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: major_brand : isom
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: minor_version : 512
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: compatible_brands: isomiso2avc1mp41
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: encoder : Lavf56.4.101
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Duration: 00:00:00.68, start: 0.021333, bitrate: 3947 kb/s
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 902x1080, 5228 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: rotate : 90
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : VideoHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Side data:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 94 kb/s (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : SoundHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/leftVideo.mp4':
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: major_brand : isom
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: minor_version : 512
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: compatible_brands: isomiso2avc1mp41
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: encoder : Lavf56.4.101
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Duration: 00:00:01.22, start: 0.021333, bitrate: 2360 kb/s
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #1:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1440x938, 2544 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: rotate : 90
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : VideoHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Side data:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 113 kb/s (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : SoundHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/bitbox/3x1/t/rightVideo.mp4':
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: major_brand : isom
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: minor_version : 512
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: compatible_brands: isomiso2avc1mp41
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: encoder : Lavf56.4.101
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Duration: 00:00:00.99, start: 0.021333, bitrate: 5945 kb/s
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #2:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1440x938, 6933 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: rotate : 90
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : VideoHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Side data:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: displaymatrix: rotation of -90.00 degrees
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 109 kb/s (default)
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: Metadata:
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: handler_name : SoundHandler
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: [NULL @ 0xb5460c00] Unable to find a suitable output format for '[1:v][2:v]hstack[bottom];[0:v][bottom]vstack'
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: [1:v][2:v]hstack[bottom];[0:v][bottom]vstack: Invalid argument
06-25 03:02:36.718 17859-17859/co.gioin.testsquarecamera I/System.out: onFinish
答案1
做这件事有很多种方法。
堆栈和虚拟堆栈
此方法使用堆栈水平堆叠video1
,video2
然后虚拟栈垂直堆叠video0
在它们上面。
ffmpeg -i video0 -i video1 -i video2 -filter_complex \
"[1:v][2:v]hstack[bottom];[0:v][bottom]vstack"
output
如果需要缩放以匹配尺寸
如果您需要先缩放任何输入,然后添加规模筛选:
ffmpeg -i video0 -i video1 -i video2 -filter_complex \
"[1:v]scale=320:-1[left]; \
[2:v]scale=320:-1[right]; \
[left][right]hstack[bottom]; \
[0:v][bottom]vstack"
output
合并音频
你没有提到音频,但如果你还想合并所有音频,请添加合并:
ffmpeg -i video0 -i video1 -i video2 -filter_complex \
"[1:v][2:v]hstack[bottom];[0:v][bottom]vstack[v]; \
[0:a][1:a][2:a]amerge=inputs=3[a]" \
-map "[v]" -map "[a]" -ac 2 \
output
如果您只想要来自一个输入的音频,那么请不要使用 amerge,只需映射您想要的音频,例如-map 1:a
。
对于旧版本:pad + overlay
你的破旧ffmpeg
太旧了,无法使用堆栈过滤器,所以使用软垫和覆盖。
ffmpeg -noautorotate -i video0 -noautorotate -i video1 -noautorotate -i video2 \
-filter_complex \
"[0:v]scale=1280:-1[top];[1:v]scale=640:-1[left];[2:v]scale=640:-1[right]; \
[top]pad=iw:ih+(ih/2)[bg];[bg][left]overlay=0:overlay_h*2[bg2]; \
[bg2][right]overlay=overlay_w:overlay_h*2[v]; \
[0:a][1:a][2:a]amerge=inputs=3[a]" \
-map "[v]" -map "[a]" -ac 2 output