[FFmpeg-devel] sample_aspect_ratio - which has priority?

Marton Balint cus at passwd.hu
Sat Apr 21 19:51:13 CEST 2012


Hi,

I'm just wondering how to get properly the aspect ratio of the current 
frame.

AVStream has an aspect ratio field
AVFrame has an aspect ratio field as well
AVCodecContext has an aspect ratio finally.

FFplay is trying to use this logic:

If AVStream aspect is specified, then use that
   otherwise use the one from AVFrame or AVCodecContext

I am not entirely sure, but I think ffmpeg is using the same logic too.

But for vsrc_movie, the following is done:

If AVFrame aspect is specified, then use that
   otherwise use the one from AVStream

I think it would be really useful to document what is the preferred order 
of these aspect ratios. Maybe like this:

Use AVStream sample_aspect_ratio if specified
   else Use AVFrame sample_aspect_ratio if specified
      else use 0
Use AVCodecContext only if you are certain that is still holds the 
information valid for the current frame.

Am I getting this right?

Thanks,
Marton


More information about the ffmpeg-devel mailing list