[Libav-user] Correct way to determine display resolution

Info || Non-Lethal Applications info at non-lethal-applications.com
Fri May 11 12:40:24 EEST 2018


Hi folks!

I’m having a hard time trying to figure out the correct way to determine the actual display resolution of certain video files.
I started by using only AVVideoCodecContext->width / height but found that this is not very robust at all times so I started to take AVVideoCodecContext and AVStream sample and display sample aspect ratio into account as well.

I now have a PAL file with AVVideoCodecContext width/height and coded_width/coded_height set to 720 x 576 (which would be correct) but the video codec context’s sample aspect ratio is at 64/45 and the video stream sample aspect ratio is at 16/15 (display aspect ratio at 4/3) which causes my code to fail and display a green bar where there shouldn’t be one.

So my question is: what’s the most reliable way to determine the actual display resolution?

Thanks for your help!

Flo


More information about the Libav-user mailing list