ffmpeg视频幻灯片仅拍摄第一张图像 [英] ffmpeg video slideshow only takes first image

查看:71
本文介绍了ffmpeg视频幻灯片仅拍摄第一张图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在10张图像中创建一个1 fps帧速率的.mp4视频.我关注了 https://trac.ffmpeg.org/wiki/Slideshow 并进入了(我的图像位于我从中运行命令的文件夹中,其名称为img000.png,img001.png等)

I wanted to create an .mp4 video with a framerate of 1 fps out of 10 images. I followed https://trac.ffmpeg.org/wiki/Slideshow and got to (my images are in the folder I am running the command from and are name img000.png, img001.png, etc.)

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

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

However only the first image is taken to the video and it only shows one image!

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

After trying multiple permutations of -framerate and -r options and positions of the options, I did not recieve any better results.

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

Does anyone know what might have gone wrong even in this simple case? Thanks.

完整日志:

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

推荐答案

旧版本的VLC无法播放5或更低帧频的视频.添加 -r 6 进行更正.另外,您可能想添加 -pix_fmt yuv420p 以获得广泛的播放兼容性.

Older versions of VLC couldn't play videos with framerates 5 or lower. Add -r 6 to correct for that. Also, you may want to add -pix_fmt yuv420p for wide playback compatibility.

这篇关于ffmpeg视频幻灯片仅拍摄第一张图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆