[FFmpeg-user] Getting actual video size + ratio

Nathan Malachowski nathanmal at gmail.com
Wed Nov 21 11:21:20 CET 2012

Hi i'm trying extract images from movie files and i'm running into an issue
of scaling when trying to fit them within a specific aspect ratio. Below is
the stream output of the video

Stream #0.0(eng): Video: mpeg4, yuv420p, 720x480 [SAR 1:1 DAR 3:2], 6473
kb/s, SAR 40:33 DAR 20:11, 29.97 fps, 29.97 tbr, 2997 tbn, 1k tbc

the video says its 720x480 with square pixels, but then later the second PAR
40:33 DAR 20:11 s confusing. I realize this means the pixels are stretched,
and any media player shows it at 854x480 , but i don't know how i would
determine that using the second set of sar:dar values. why would there be 2
sets anyway? Does this mean that the video actually only has 720 vertical
lines but is meant to be viewed at 854 pixels wide? Is there any way to
convert this file to a 1:1 pixel aspect ratio via ffmpeg commands

i'm also parsing this output with php to grab various values, so 720x480
would be incorrect and i'd have to check for the second set of values and
if they exist apply them to the video size parameter so it represented the
actual display size/ratio, which i then use to generate thumbs. The
question is how to calculate that too.




{ n }

More information about the ffmpeg-user mailing list