我使用 libavcodec 进行视频处理。
AVStream->r_frame_rate
的文档说
Real base framerate of the stream.
This is the lowest framerate with which all timestamps can be
represented accurately (it is the least common multiple of all
framerates in the stream). Note, this value is just a guess!
我尝试了几个 mp4 和 avi 视频(25fps),r_frame_rate
始终如我预期的 25。所以,我想了解为什么文档说 ...只是一个猜猜!
如果我总能得到准确的 fps?什么时候改变?
最佳答案
许多容器,尤其是流式容器(例如 mpeg-ts)不记录帧速率。许多容器允许可变帧速率视频。 ffmpeg 尝试通过查看前几秒并计算帧数来确定帧速率。但如果帧速率在整个流中发生变化或变化,r_frame_rate 可能会变得不准确。
因此,r_frame_rate 是一个仅供引用的精细值。但最好单独查看每个帧的 PTS。
关于ffmpeg - 什么时候 fps 可以是猜测值而不是精确值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14124321/