Вопрос

I use libavcodec for video processing.

The documentation of AVStream->r_frame_rate says

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!

I tried several mp4 and avi videos (with 25fps) and r_frame_rate always was as I expected 25. So, I want to understand why the documentation says that ...is just a guess! if I always get exact fps? When it does change?

Это было полезно?

Решение

Many containers, especially streaming containers (such as mpeg-ts) do not record a frame rate. And many containers allow for variable frame rate videos. ffmpeg attempt to determine the frame rate by looking at the first few seconds and counting frames. But if the frame rate varies or changes throughout the stream, r_frame_rate can become inaccurate.

Therefore r_frame_rate is a fine value to informational purposes. but it is best to look at the PTS for each frame individually.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top