Aspect ratio is always 0/1

236 views
Skip to first unread message

Nicolas

unread,
Sep 26, 2012, 9:29:55 AM9/26/12
to xuggle...@googlegroups.com
Hi all,

Does anybody knows why IStream.getSampleAspectRatio() always returns 0/1 instead of the actual sample aspect ratio of a video stream?

Thanks

Dave Peterson

unread,
Sep 29, 2012, 5:50:46 AM9/29/12
to xuggle...@googlegroups.com
Hey Nick.

 Suggest that you read:  http://dranger.com/ffmpeg/tutorial04.html.  Especially the section on aspect ratios.

Here is a relevant section:
Since our screen can be of any size (we set ours to 640x480 and there are ways to set it so it is resizable by the user), we need to dynamically figure out how big we want our movie rectangle to be. So first we need to figure out our movie's aspect ratio, which is just the width divided by the height. Some codecs will have an odd sample aspect ratio, which is simply the width/height radio of a single pixel, or sample. Since the height and width values in our codec context are measured in pixels, the actual aspect ratio is equal to the aspect ratio times the sample aspect ratio. Some codecs will show an aspect ratio of 0, and this indicates that each pixel is simply of size 1x1. Then we scale the movie to fit as big in our screen as we can.
Reply all
Reply to author
Forward
0 new messages