无法使用 ffmpeg 将图像制作成视频

无法使用 ffmpeg 将图像制作成视频

这是我使用 ffmpeg 制作图像时的日志:

Incompatible pixel format 'yuvj420p' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x9e4f20] w:532 h:800 pixfmt:yuvj420p
[avsink @ 0x9f6240] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0xa86ac0] w:532 h:800 fmt:yuvj420p -> w:532 h:800 fmt:yuv420p flags:0x4
Output #0, mp4, to 'output2.mp4':
  Metadata:
    encoder         : Lavf53.21.1
    Stream #0.0: Video: mpeg4, yuv420p, 532x800 [PAR 1:1 DAR 133:200], q=2-31, 200 kb/s, 32 tbn, 32 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
[buffer @ 0x9e4f20] Changing frame properties on the fly is not supported.
    Last message repeated 43 times
frame=    1 fps=  0 q=1.0 Lsize=      58kB time=0.03 bitrate=15312.1kbits/s    
video:58kB audio:0kB global headers:0kB muxing overhead 1.321295%

这是我运行的命令:

ffmpeg -r 32 -qscale 1 -i %05d.morph.jpg output2.mp4 

output2.mp4 文件几乎不起作用,因为它只显示一幅图像,并且仅持续一秒钟。

我哪里做错了?

答案1

发送“不支持动态更改帧属性”消息是因为您的所有 JEPG 大小不一样(如第一个 532x800)

为了处理这种情况,可以将所有 JPEG 输入图像缩放到给定大小:

ffmpeg -r 32 -qscale 1 -i %05d.morph.jpg -vf scale=532:800 output2.mp4 

有关使用 ffmpeg 调整大小和缩放的更多信息,请参阅

相关内容