[Libav-user] Correct way to get the actual display resolution

Info || Non-Lethal Applications info at non-lethal-applications.com
Mon Nov 26 22:19:26 EET 2018

Hi guys!

I was wondering if there is one correct solution to get a movie’s display resolution?

There’s AVCodecContext width/height and coded_width/coded_height and then there’s also AVStream's sample_aspect_ratio and display_aspect_ratio.
For some movies, some have bogus values and it’s hard to determine programmatically which value to use.

Is there one solution that is always correct? Taking cropping and scaling into account?
It has been a lot of trial and error so far and I’m wondering if I’m doing it the right way.

Thanks for your help!

More information about the Libav-user mailing list