我想将多个视频合并,并在视频之间添加过渡效果。理想情况下,我希望获得一个可以合并多个视频的命令。或者至少获得一个如何以编程方式为多个视频生成命令的模式。
目前我有下一个命令:
ffmpeg -i video1.mp4 -i video2.mp4 -i video3.mp4 -filter_complex \
"[0:v][1:v]xfade=duration=1:offset=26[outv]; \
[0:a][1:a]acrossfade=duration=1[outa]; \
[1:v][2:v]xfade=duration=1:offset=44[outv]; \
[1:a][2:a]acrossfade=duration=1[outa]" -map [outv] -map [outa] Output.mp4
我收到下一个错误:
Filter acrossfade:default has an unconnected output
完整错误:
Error: Command failed: ffmpeg -i /video1.mp4 -i /video2.mp4 -i /video3.mp4 -filter_complex "[0:v][1:v]xfade=duration=1:offset=26[outv]; [0:a][1:a]acrossfade=duration=1[outa]; [1:v][2:v]xfade=duration=1:offset=44[outv]; [1:a][2:a]acrossfade=duration=1[outa]" -map [outv] -map [outa] Output.mp4
ffmpeg version 5.1-0ubuntu1~20.04.sav0 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version='0ubuntu1~20.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdav1d --enable-libjxl --enable-librist --enable-libvmaf --enable-libzimg --enable-crystalhd --enable-libmfx --enable-libsvtav1 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libplacebo --enable-libx264 --enable-shared
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/video1.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:26.50, start: 0.000000, bitrate: 6110 kb/s
Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 6032 kb/s, 60.04 fps, 60 tbr, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/video2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:17.60, start: 0.000000, bitrate: 6174 kb/s
Stream #1:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 6095 kb/s, 60.06 fps, 60 tbr, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/video3.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Duration: 00:00:17.39, start: 0.000000, bitrate: 6073 kb/s
Stream #2:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 5995 kb/s, 60.06 fps, 60 tbr, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #2:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Filter acrossfade:default has an unconnected output
答案1
我发现本网站,它清楚地显示了如何生成所需的脚本