[Libav-user] Getting the correct display resolution

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed May 6 23:26:49 EEST 2020

Am Mi., 6. Mai 2020 um 17:53 Uhr schrieb Info || Non-Lethal
Applications <info at non-lethal-applications.com>:

> There’s also AVStream->sample_aspect_ratio, display_aspect_ratio and
> AVFrame->sample_aspect_ratio.

To elaborate: It is not difficult to find files where the codec stores another
aspect ratio than the container (ffmpeg allows to create such files because
users want this feature). FFmpeg will prefer the container aspect ratio
over the codec aspect ratio (and this is typically the sane thing to do) but
your application may choose differently.
(Some brand-new containers - no joke - decided to store the display
aspect ratio instead of the sample aspect ratio which was stored for
more than a decade in all formats I remember. To allow calculating
the - needed - sample aspect ratio, the field display_aspect_ratio
had to be created, you should normally ignore it, it will be used to
automatically fill the sample aspect ratio.)

Carl Eugen

More information about the Libav-user mailing list