我有两个视频滤镜,只要在单独的批处理文件中使用它们就可以工作,但我找不到将它们组合起来的方法。第一个滤镜调整 JPG 图像的大小,然后创建包含淡入淡出过渡的幻灯片:
-reinit_filter 0 -r .3 -f concat -safe 0 -i concat_image_list_JPG.txt -c:v libx264 -crf 25 -pix_fmt yuv420p -vf zoompan=d=(6+2)/2:s=1920x1080:fps=1/2,framerate=25:interp_start=0:interp_end=255:scene=100 -r 25 "Slideshow 1080.mkv"
问题是,没有 16:9 AR 的图像将被垂直或水平拉伸以填充框架。另一方面,以下命令创建幻灯片没有淡入淡出过渡但是它通过对图像进行信箱/柱箱处理保留了所有图像的正确纵横比:
-r .3 -f concat -safe 0 -i concat_image_list_JPG.txt -c:v libx264 -crf 25 -pix_fmt yuv420p -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black" -r 25 "Slideshow 1080.mkv"
我如何才能将两个命令/过滤器组合到一个批处理命令中,以实现所有图像的正确 AR 并使其交叉淡入淡出?我尝试将它们放在彼此后面并用逗号分隔,但没有成功。
这是运行答案 1 中的命令时的日志:
E:\batch file testing>start /b /low "ffmpeg" "C:\AVConvert\ffmpeg.exe" -reinit_f
ilter 0 -r .25 -f concat -safe 0 -i concat_image_list_JPG.txt -c:v libx264 -crf
23 -pix_fmt yuv420p -vf scale=1920:1080:force_original_aspect_ratio=decrease,pad
=1920:1080:-1:-1:color=black,zoompan=d=(4+2)/2:s=1920x1080:fps=1/2,framerate=25:
interp_start=0:interp_end=255:scene=100 -r 25 "Slideshow 1080.mkv"
E:\batch file testing>PAUSE
Drücken Sie eine beliebige Taste . . . ffmpeg version 5.0-essentials_build-www.g
yan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32thr
eads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --e
nable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-
libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable
-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg
--enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enabl
e-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm -
-enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va
--enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libo
pencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --e
nable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --ena
ble-libvorbis --enable-librubberband
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, concat, from 'concat_image_list_JPG.txt':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 5
184x2920, 25 fps, 25 tbr, 25 tbn
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler @ 00000000033dc7c0] [swscaler @ 00000000033e97c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 00000000033dc7c0] [swscaler @ 0000000003496bc0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 00000000033dc7c0] [swscaler @ 0000000003550e00] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 00000000033dc7c0] [swscaler @ 00000000069400c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 00000000033dc7c0] [swscaler @ 00000000069f52c0] deprecated pixel for
mat used, make sure you did set range correctly
[Parsed_framerate_3 @ 00000000006d9700] time base:2/1 -> 1/25 exact:1
[Parsed_framerate_3 @ 00000000006d9700] fps -> fps:25/1 scene score:100.000000 i
nterpolate start:0 end:255
[libx264 @ 000000000066e2c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 000000000066e2c0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 000000000066e2c0] 264 - core 164 r3081 19856cc - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'Slideshow 1080.mkv':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p(progressive), 1920x1080,
q=2-31, 25 fps, 1k tbn
Metadata:
encoder : Lavc59.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 1 fps=0.0 q=0.0 size= 1kB time=00:00:00.00 bitrate=N/A speed=
frame= 58 fps=0.0 q=28.0 size= 1kB time=00:00:00.20 bitrate= 24.2kbits/
[graph 0 input from stream 0:0 @ 00000000006d9800] filter context - w: 5184 h: 2
920 fmt: 13, incoming frame - w: 5184 h: 2920 fmt: 12 pts_time: 4
[graph 0 input from stream 0:0 @ 00000000006d9800] Changing video frame properti
es on the fly is not supported by all filters.
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000034d7bc0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035b00c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000069557c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000034d7bc0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035b00c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000069557c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000034dd740] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003425580] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035b00c0] deprecated pixel for
mat used, make sure you did set range correctly
frame= 102 fps= 81 q=28.0 size= 1kB time=00:00:01.96 bitrate= 2.5kbits/
frame= 132 fps= 75 q=28.0 size= 1kB time=00:00:03.16 bitrate= 1.5kbits/
frame= 157 fps= 67 q=28.0 size= 1kB time=00:00:04.16 bitrate= 1.2kbits/
frame= 174 fps= 60 q=28.0 size= 1kB time=00:00:04.84 bitrate= 1.0kbits/
frame= 188 fps= 54 q=28.0 size= 512kB time=00:00:05.40 bitrate= 776.6kbits/
frame= 206 fps= 51 q=28.0 size= 512kB time=00:00:06.12 bitrate= 685.2kbits/
frame= 248 fps= 55 q=28.0 size= 512kB time=00:00:07.80 bitrate= 537.7kbits/
[graph 0 input from stream 0:0 @ 00000000006d9800] filter context - w: 5184 h: 2
920 fmt: 13, incoming frame - w: 3000 h: 2000 fmt: 14 pts_time: 8
[graph 0 input from stream 0:0 @ 00000000006d9800] Changing video frame properti
es on the fly is not supported by all filters.
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077ca5c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000697e040] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003425580] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035b00c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077ca5c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000697e040] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003425580] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035b00c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003445680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000697be40] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000034d9540] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000003408240] deprecated pixel for
mat used, make sure you did set range correctly
frame= 282 fps= 56 q=28.0 size= 512kB time=00:00:09.16 bitrate= 457.8kbits/
frame= 305 fps= 54 q=28.0 size= 1280kB time=00:00:10.08 bitrate=1040.2kbits/
frame= 318 fps= 52 q=28.0 size= 1280kB time=00:00:10.60 bitrate= 989.1kbits/
frame= 333 fps= 50 q=28.0 size= 1280kB time=00:00:11.20 bitrate= 936.1kbits/
frame= 348 fps= 48 q=28.0 size= 1280kB time=00:00:11.80 bitrate= 888.5kbits/
frame= 384 fps= 50 q=28.0 size= 1280kB time=00:00:13.24 bitrate= 791.9kbits/
[graph 0 input from stream 0:0 @ 00000000006d9800] filter context - w: 5184 h: 2
920 fmt: 13, incoming frame - w: 2244 h: 888 fmt: 14 pts_time: 12
[graph 0 input from stream 0:0 @ 00000000006d9800] Changing video frame properti
es on the fly is not supported by all filters.
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000351ab80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077f0900] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000035777c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000006ddd40] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077d0b80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a31280] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a04d80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000351ab80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077ca5c0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000077ee700] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a02b80] deprecated pixel for
mat used, make sure you did set range correctly
frame= 424 fps= 51 q=28.0 size= 3328kB time=00:00:14.84 bitrate=1837.0kbits/
frame= 454 fps= 51 q=28.0 size= 3328kB time=00:00:16.04 bitrate=1699.6kbits/
frame= 470 fps= 50 q=28.0 size= 3328kB time=00:00:16.68 bitrate=1634.4kbits/
frame= 485 fps= 49 q=28.0 size= 3328kB time=00:00:17.28 bitrate=1577.6kbits/
frame= 502 fps= 48 q=28.0 size= 3328kB time=00:00:17.96 bitrate=1517.9kbits/
[graph 0 input from stream 0:0 @ 00000000006d9800] filter context - w: 5184 h: 2
920 fmt: 13, incoming frame - w: 4976 h: 2800 fmt: 12 pts_time: 16
[graph 0 input from stream 0:0 @ 00000000006d9800] Changing video frame properti
es on the fly is not supported by all filters.
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000351ab80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000006ddd40] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006b93080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 000000000351ab80] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000006dfc00] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006b91c00] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000029d85d00] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a21000] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000069c8cc0] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006a2f080] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 00000000034dd680] deprecated pixel for
mat used, make sure you did set range correctly
[swscaler @ 000000000699ae80] [swscaler @ 0000000006b91c00] deprecated pixel for
mat used, make sure you did set range correctly
frame= 552 fps= 51 q=28.0 size= 4608kB time=00:00:19.96 bitrate=1891.1kbits/
frame= 601 fps= 53 q=28.0 size= 4608kB time=00:00:21.92 bitrate=1722.0kbits/
frame= 628 fps= 53 q=28.0 size= 4608kB time=00:00:23.00 bitrate=1641.2kbits/
frame= 657 fps= 53 q=28.0 size= 4608kB time=00:00:24.16 bitrate=1562.4kbits/
frame= 728 fps= 56 q=28.0 size= 5888kB time=00:00:27.00 bitrate=1786.4kbits/
frame= 750 fps= 56 q=-1.0 Lsize= 5980kB time=00:00:29.88 bitrate=1639.5kbits
/s speed=2.24x
video:5975kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.094786%
[libx264 @ 000000000066e2c0] frame I:3 Avg QP:16.07 size:230264
[libx264 @ 000000000066e2c0] frame P:269 Avg QP:19.24 size: 19490
[libx264 @ 000000000066e2c0] frame B:478 Avg QP:22.64 size: 385
[libx264 @ 000000000066e2c0] consecutive B-frames: 12.8% 5.3% 4.0% 77.9%
[libx264 @ 000000000066e2c0] mb I I16..4: 19.2% 54.7% 26.1%
[libx264 @ 000000000066e2c0] mb P I16..4: 1.3% 2.5% 0.3% P16..4: 25.4% 3.5
% 4.3% 0.0% 0.0% skip:62.8%
[libx264 @ 000000000066e2c0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 2.9% 0.0
% 0.0% direct: 0.3% skip:96.7% L0:11.6% L1:85.0% BI: 3.4%
[libx264 @ 000000000066e2c0] 8x8 transform intra:59.9% inter:67.8%
[libx264 @ 000000000066e2c0] coded y,uvDC,uvAC intra: 38.4% 48.0% 20.3% inter: 6
.6% 8.7% 1.1%
[libx264 @ 000000000066e2c0] i16 v,h,dc,p: 54% 22% 7% 17%
[libx264 @ 000000000066e2c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 16% 31% 5% 5%
7% 6% 5% 5%
[libx264 @ 000000000066e2c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 20% 16% 5% 8%
10% 8% 5% 7%
[libx264 @ 000000000066e2c0] i8c dc,h,v,p: 61% 19% 18% 3%
[libx264 @ 000000000066e2c0] Weighted P-Frames: Y:33.5% UV:32.3%
[libx264 @ 000000000066e2c0] ref P L0: 55.3% 24.3% 19.5% 0.7% 0.1%
[libx264 @ 000000000066e2c0] ref B L0: 81.6% 16.4% 2.0%
[libx264 @ 000000000066e2c0] ref B L1: 95.9% 4.1%
[libx264 @ 000000000066e2c0] kb/s:1631.27
答案1
在 zoompan 之前插入刻度和衬垫。
-vf scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black,zoompan=d=(6+2)/2:s=1920x1080:fps=1/2,framerate=25:interp_start=0:interp_end=255:scene=100