[FFmpeg-user] Getting actual video size + ratio

Nathan Malachowski nathanmal at gmail.com
Wed Nov 21 12:23:51 CET 2012


Thanks Nicholas for clearing up the first question.

I'll try to rephrase the second question. basically how do i use the
resolution (720x480) with the container ratio (sar 40:33 dar 20:11) to come
up with an actual size of 854x480 (16:9), as it shows in quicktime and
other media players

from what i've looked up, horizontal width x sar = actual width. But in
this case, 720 x (40/33) equals 873 not 854. Indeed 873/480 == 20/11, so
how are the video players coming up with a size of 854 by 480?

thx

n




On Wed, Nov 21, 2012 at 2:46 AM, Nicolas George <
nicolas.george at normalesup.org> wrote:

> Le primidi 1er frimaire, an CCXXI, Nathan Malachowski a écrit :
> > 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?
>
> FAQ: Q: Why are there two sets of aspect ratios?
>
> A: Because there are (at least) two places the aspect ratio can be stored,
> and bogus videos can have different values there.
>
> In the ffmpeg summary, the aspect ratio between brackets is the aspect
> ratio
> stored in the video bitstream, at the codec level; the aspect ratio outside
> the brackets is the aspect ratio stored in the container format.
>
> The aspect ratio in the container is usually considered more reliable
> because it is easier to change. At the API level, you can use the
> av_guess_sample_aspect_ratio() function to use various heuristics to try
> and
> find the correct one.
>
> > 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.
>
> I do not understand the question.
>
> Regards,
>
> --
>   Nicolas George
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.12 (GNU/Linux)
>
> iEYEARECAAYFAlCssPcACgkQsGPZlzblTJM8QQCgkc0kh/KXTtjrScrnI/oPzUxX
> p7UAn0nG0BPN6jI/vqeKz8tSWTLajkyj
> =yU/o
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>


-- 

{ n }


More information about the ffmpeg-user mailing list