为什么通过 FFmpeg 从图像创建视频时第一张图像变化如此之快?

mir*_*rza 2 ffmpeg

ffmpeg -r 0.15 -qscale 2 -i /var/www/44693/%0d.jpg /var/www/44693/output11.mp4
Run Code Online (Sandbox Code Playgroud)

使用此命令,我正在从图像创建视频,但第一张图像变化如此之快。其他都还好。

这是创建的视频

输出为文本:

root@li465-71:~# ffmpeg -r 0.15 -qscale 2 -i /var/www/44693/%0d.jpg /var/www/446                                                                                        93/output11.mp4
ffmpeg version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav develop                                                                                        ers
  built on Mar 22 2012 05:29:10 with gcc 4.6.3
This program is not developed anymore and is only provided for compatibility. Us                                                                                        e avconv instead (see Changelog for the list of incompatible changes).
[image2 @ 0x85dcaa0] max_analyze_duration reached

Seems stream 0 codec frame rate differs from container frame rate: 0.15 (3/20) -                                                                                        > 0.75 (3/4)
Input #0, image2, from '/var/www/44693/%0d.jpg':
  Duration: 00:01:13.33, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 800x600 [PAR 1:1 DAR 4:3], 0.15 fps, 0.                                                                                        75 tbr, 0.15 tbn, 0.15 tbc
File '/var/www/44693/output11.mp4' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'yuvj420p' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x85df820] w:800 h:600 pixfmt:yuvj420p
[avsink @ 0x85de240] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src'                                                                             and the filter 'out'
[scale @ 0x85de680] w:800 h:600 fmt:yuvj420p -> w:800 h:600 fmt:yuv420p flags:0x4
Output #0, mp4, to '/var/www/44693/output11.mp4':
  Metadata:
    encoder         : Lavf53.21.0
    Stream #0.0: Video: mpeg4, yuv420p, 800x600 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 3 tbn,                                                                             0.75 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
frame=   50 fps=  0 q=2.0 Lsize=     949kB time=66.67 bitrate= 116.6kbits/s dup=39 drop=0                                                                               
video:948kB audio:0kB global headers:0kB muxing overhead 0.125724%
Run Code Online (Sandbox Code Playgroud)

小智 5

这是一个错误,我自己注意到了。FFmpeg 始终按顺序输出第一张和第二张图像,您选择的任何时间仅在第二张图像之后开始。例如,如果您每 10 秒输出一帧,并且您正在制作 25fps 的电影,则第一张图像将是您的第一帧,您的第二张图像将在 40 毫秒后开始并成为第二帧。之后,第二帧将被正确复制到十秒标记(10.040???)。我通过复制第一帧来解决这个问题。