我正試圖創建一個視頻幻燈片,淡入淡出/僅在ffmpeg cli命令中的每個圖像之間。經過幾個小時的研究,我發現這是可能的唯一方法是使用-filter_complex
參數並傳入所有圖像並指定一個複雜的過濾器,定義多個淡出並返回,以便我可以在幀之間發生時間。我至今命令:在圖像之間應用淡入淡出ffmpeg命令
ffmpeg -y -framerate 1/5 \
-loop 1 -i img-1.jpg \
-loop 1 -i img-2.jpg \
-loop 1 -i img-3.jpg \
-filter_complex \
"[1:v]fade=out:4:d=1,fade=in:5:d=1[fad1]; \
[2:v]fade=out:9:d=1,fade=in:10:d=1[fad2]; \
[3:v]fade=out:14:d=1,fade=in:15:d=1[fad3];" \
-c:v libx264 -r 25 -pix_fmt yuv420p test.mp4
下面是執行此命令的輸出:
ffmpeg version 2.6.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 54. 20.100/54. 20.100
libavcodec 56. 26.100/56. 26.100
libavformat 56. 25.101/56. 25.101
libavdevice 56. 4.100/56. 4.100
libavfilter 5. 11.102/5. 11.102
libavresample 2. 1. 0/2. 1. 0
libswscale 3. 1.101/3. 1.101
libswresample 1. 1.100/1. 1.100
libpostproc 53. 3.100/53. 3.100
Input #0, image2, from img-1.jpg':
Duration: 00:00:05.00, start: 0.000000, bitrate: 141 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 0.20 fps, 0.20 tbr, 0.20 tbn, 0.20 tbc
Input #1, image2, from img-2.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 17789 kb/s
Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 67:67 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from 'img-3.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 17764 kb/s
Stream #2:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 62:62 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
[AVFilterGraph @ 0xbc2a00] No such filter: ''
Error configuring filters.
所有我想要做的就是創建與圖像之間的淡入淡出/轉換視頻幻燈片。任何幫助是極大的讚賞!