ffmpeg视频幻灯片仅拍摄第一张图像

时间:2018-12-14 11:03:41

标签: ffmpeg

我想在10张图像中创建1 fps帧速率的.mp4视频。我跟随https://trac.ffmpeg.org/wiki/Slideshow进入(我的图像在我正在从中运行命令的文件夹中,并且名称为img000.png,img001.png等)

path_to_ffmpeg\ffmpeg.exe -framerate 1 -i img%03d.png output.mp4

但是,只有第一个图像被拍摄到视频中,并且仅显示一个图像!

尝试了-framerate和-r选项的多个排列以及选项的位置后,我没有收到任何更好的结果。

有人知道即使在这种简单情况下出了什么问题吗?谢谢。

完整日志:

C:\Users\foo\Documents\path>C:\bar\ffmpeg-4.0.2-win64-static\bin\ffmpeg.ex
e -framerate 1 -i img%03d.png output.mp4    
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers    
  built with gcc 7.3.1 (GCC) 20180722    
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --e    
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libblur    
ay --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-    
libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enab    
le-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-li    
bvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --en    
able-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-    
libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enabl    
e-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enabl    
e-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enab    
le-dxva2 --enable-avisynth    
  libavutil      56. 14.100 / 56. 14.100    
  libavcodec     58. 18.100 / 58. 18.100    
  libavformat    58. 12.100 / 58. 12.100    
  libavdevice    58.  3.100 / 58.  3.100    
  libavfilter     7. 16.100 /  7. 16.100    
  libswscale      5.  1.100 /  5.  1.100    
  libswresample   3.  1.100 /  3.  1.100    
  libpostproc    55.  1.100 / 55.  1.100    
Input #0, image2, from 'img%03d.png':    
  Duration: 00:00:10.00, start: 0.000000, bitrate: N/A    
    Stream #0:0: Video: png, rgba(pc), 959x550 [SAR 2834:2834 DAR 959:550], 1 fp    
s, 1 tbr, 1 tbn, 1 tbc    
File 'output.mp4' already exists. Overwrite ? [y/N] y    
Stream mapping:    
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))    
Press [q] to stop, [?] for help    
[libx264 @ 0000000000611040] using SAR=1/1    
[libx264 @ 0000000000611040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2    
AVX FMA3 BMI2 AVX2    
[libx264 @ 0000000000611040] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-b    
it    
[libx264 @ 0000000000611040] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC cod    
ec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 r    
ef=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed    
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pski    
p=1 chroma_qp_offset=4 threads=12 lookahead_threads=2 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=1    
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60    
qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00    
Output #0, mp4, to 'output.mp4':    
  Metadata:    
    encoder         : Lavf58.12.100    
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 959x550 [SA    
R 1:1 DAR 959:550], q=-1--1, 1 fps, 16384 tbn, 1 tbc    
    Metadata:    
      encoder         : Lavc58.18.100 libx264    
    Side data:    
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1    
frame=   10 fps=0.0 q=-1.0 Lsize=      20kB time=00:00:07.00 bitrate=  23.1kbits    
/s speed=68.6x    
video:19kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ov    
erhead: 5.046419%    
[libx264 @ 0000000000611040] frame I:1     Avg QP: 4.41  size: 14084    
[libx264 @ 0000000000611040] frame P:3     Avg QP:12.31  size:   632    
[libx264 @ 0000000000611040] frame B:6     Avg QP:19.11  size:   436    
[libx264 @ 0000000000611040] consecutive B-frames: 20.0%  0.0%  0.0% 80.0%    
[libx264 @ 0000000000611040] mb I  I16..4: 89.7%  0.0% 10.3%    
[libx264 @ 0000000000611040] mb P  I16..4:  0.2%  0.0%  0.1%  P16..4:  0.5% 0.1    
%  0.1%  0.0%  0.0%    skip:98.9%    
[libx264 @ 0000000000611040] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.6%  0.1    
%  0.1%  direct: 0.0%  skip:99.1%  L0:22.0% L1:73.7% BI: 4.3%    
[libx264 @ 0000000000611040] coded y,u,v intra: 6.1% 2.5% 2.6% inter: 0.2% 0.1%    
0.1%    
[libx264 @ 0000000000611040] i16 v,h,dc,p: 72% 25%  3%  0%    
[libx264 @ 0000000000611040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 31% 20%  2%  2%    
2%  3%  5%  2%    
[libx264 @ 0000000000611040] Weighted P-Frames: Y:0.0% UV:0.0%    
[libx264 @ 0000000000611040] ref P L0: 65.8%  1.5% 26.5%  6.1%    
[libx264 @ 0000000000611040] ref B L0: 77.0% 12.7% 10.3%    
[libx264 @ 0000000000611040] ref B L1: 88.6% 11.4%
[libx264 @ 0000000000611040] kb/s:14.87

1 个答案:

答案 0 :(得分:1)

旧版本的VLC无法播放5或更低帧频的视频。添加-r 6可以解决此问题。另外,您可能想添加-pix_fmt yuv420p以实现广泛的播放兼容性。