Op 6 dec 2008, om 02:13 heeft Locutus het volgende geschreven:

>
> How does one go about getting the pixel aspect ratio for a video?  For
> example, DV Video gives sample_aspect_ratio.num=0,
> sample_aspect_ratio.den=1.
> --  
> View this message in context: 
> http://www.nabble.com/sample_aspect_ratio-tp20865505p20865505.html
> Sent from the libav-users mailing list archive at Nabble.com.
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user

I believe DV Video does not have a pixel aspect. It's content is  
either widescreen or not (16:9 / 4:3 if I am not mistaken)

Since I didn't find any explanation on how to calculate the correct  
sample_aspect, I figured it out myself.
I'm not entirely sure that it's correct, but at least it gives the  
correct results.

let's say you got a pal image (720*576) which should be displayed at  
16:9.
you already know that your source is 720x576. If you take the given  
height as your display height, you can then calculate the width it  
needs to be displayed at in order to look correct, namely: 576 * 16 /  
9 = 1024.
so the correct sample aspect ratio becomes output_width / source_width  
-> 1024 / 720.
You can use these values as your sample_aspect_ratio, ie:
sample_aspect_ratio.num = 1024
sample_aspect_ratio.den = 720;

I do believe that there is some restriction on these values in some  
codecs, so reducing this fraction to 64 / 45 is probably a good idea.

hope this helps

- Arjan
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to