重新编码视频时奇怪的FPS和帧编号

时间:2017-07-03 22:59:19

标签: video encoding ffmpeg video-encoding

我正在使用以下命令重新编码视频:

ffmpeg -i input.mp4 -q 20 output.avi

视频约10分钟,即它有大约18K帧。但是,我得到的最后帧数为5061,但重新编码的视频正在播放所有10分钟。我不明白它显示如此低帧数的原因。以下是最后几行输出。

frame= 5028 fps=143 q=20.0 size=   24863kB time=00:09:53.20 bitrate= 343.4kbits/s dup=0 drop=2087    
Past duration 1.703728 too large
Past duration 0.986687 too large
Past duration 0.704277 too large
Past duration 0.954399 too large
Past duration 1.951469 too large
Past duration 0.879509 too large
Past duration 0.942192 too large  
Past duration 0.815910 too large
Past duration 0.785393 too large
Past duration 0.792351 too large
Past duration 0.644402 too large
frame= 5061 fps=143 q=20.0 Lsize=   25493kB time=00:09:56.45 bitrate= 350.1kbits/s dup=0 drop=2098
video:22458kB audio:2320kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.886272%

编辑:这是log

1 个答案:

答案 0 :(得分:1)

如日志所示,输入FPS为12。

Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1280x720, 3354 kb/s, 12 fps, 90k tbr, 90k tbn, 180k tbc (default)

它可能是可变帧速率,ffmpeg为AVI写入恒定帧速率,因此FPS大于12 FPS的部分视频将丢帧。您可以通过指定更高的手动帧率来避免这种情况,例如-r 20但你最终会在其他地方复制框架。