当图像不是连续的时,有没有办法在 ffmpeg 中输入多幅图像?
就像是-i image1.jpg otherimage.jpg newimage.jpg
?
我知道如何使用-i img-%3d.jpg
,但这不适合我的需要。
occvtech 的答案结果是 1 张图片
C:\ffmpeg>ffmpeg -framerate 1/5 -i image-001.png -i image-002.png -i image-003.png -c:v libx264 -r 30 -pix_fmt yuv420p out234.mp4
ffmpeg version N-72259-g0b9d636 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
libavutil 54. 23.101 / 54. 23.101
libavcodec 56. 39.101 / 56. 39.101
libavformat 56. 33.101 / 56. 33.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, png_pipe, from 'image-001.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 600x600, 0.20 tbr, 0.20 tbn, 0.20 tbc
Input #1, png_pipe, from 'image-002.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, pal8(pc), 600x600, 25 tbr, 25 tbn, 25 tbc
Input #2, png_pipe, from 'image-003.png':
Duration: N/A, bitrate: N/A
Stream #2:0: Video: png, rgba(pc), 600x600 [SAR 3779:3779 DAR 1:1], 25 tbr,
25 tbn, 25 tbc
[libx264 @ 0000000002efda20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX
[libx264 @ 0000000002efda20] profile High, level 3.1
[libx264 @ 0000000002efda20] 264 - core 146 r2538 121396c - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2015 - 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, mp4, to 'out234.mp4':
Metadata:
encoder : Lavf56.33.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 600x60
0, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc56.39.101 libx264
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 150 fps=0.0 q=29.0 size= 39kB time=00:00:03.26 bitrate= 99.0kbits/
frame= 150 fps=0.0 q=-1.0 Lsize= 44kB time=00:00:04.93 bitrate= 72.6kbits
/s dup=149 drop=0
video:41kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ov
erhead: 6.258604%
[libx264 @ 0000000002efda20] frame I:1 Avg QP:15.55 size: 35176
[libx264 @ 0000000002efda20] frame P:38 Avg QP:16.05 size: 81
[libx264 @ 0000000002efda20] frame B:111 Avg QP:13.67 size: 29
[libx264 @ 0000000002efda20] consecutive B-frames: 1.3% 0.0% 0.0% 98.7%
[libx264 @ 0000000002efda20] mb I I16..4: 49.5% 15.0% 35.5%
[libx264 @ 0000000002efda20] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 1.0% 0.0
% 0.0% 0.0% 0.0% skip:98.9%
[libx264 @ 0000000002efda20] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0
% 0.0% direct: 0.0% skip:99.7% L0:40.4% L1:59.6% BI: 0.0%
[libx264 @ 0000000002efda20] 8x8 transform intra:15.0% inter:41.4%
[libx264 @ 0000000002efda20] coded y,uvDC,uvAC intra: 41.8% 51.5% 44.6% inter: 0
.0% 0.2% 0.0%
[libx264 @ 0000000002efda20] i16 v,h,dc,p: 86% 3% 6% 5%
[libx264 @ 0000000002efda20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 19% 5% 5% 9%
12% 9% 10% 7%
[libx264 @ 0000000002efda20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 18% 15% 7% 8%
7% 7% 7% 5%
[libx264 @ 0000000002efda20] i8c dc,h,v,p: 65% 13% 13% 8%
[libx264 @ 0000000002efda20] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002efda20] ref P L0: 97.6% 1.2% 0.7% 0.5%
[libx264 @ 0000000002efda20] ref B L0: 41.8% 58.2%
[libx264 @ 0000000002efda20] kb/s:66.31
C:\ffmpeg>ffmpeg
答案1
我个人总是发现重命名目录中的文件更容易,这样它们是连续的(在 Windows 上 - 突出显示所有文件,然后按 F2 重命名)。
但是,如果由于某种原因您想要手动输入三个 jpg 文件(名为 image1.jpg、otherimage.jpg 和 newimage.jpg),您可以单独使用该-i
标志来完成。
ffmpeg -i image1.jpg -i otherimage.jpg -i newimage.jpg ....