[Ffmpeg-devel] Sample Aspect Ratio & Pan&Scan

Steve Lhomme slhomme
Fri Nov 3 22:42:59 CET 2006


Hi,

So far in DrFFMPEG we used a modified version of mpeg12.c that doesn't 
take the pan_scan size to set the sample_aspect_ratio. (see around line 
2142) But since FFMPEG doesn't seem to have problems to deal with it I 
think we may do something wrong...

Because of DivX certification constraints we only output square pixels. 
So we have to translate the source aspect ratio to square pixels.

So far we assumed that the sample_aspect_ratio was a pixel aspect ratio 
and it worked well for most format. But it seems that it's not good 
enough in the general case.

For example I have 2 VOB files. They both use pan & scan and have a 
pixel aspect ratio of 16:9. But for the first one (chems1.vob) we get a 
sample aspect ratio of 256:135 (1.896) and the other one has a sample 
aspect ratio of 32/27 (1.18). For chems1.vob the original pixel size is 
720x576 and for the other one it's 720x480. While the source dimensions 
and pixel aspect ratio are similar, the sample aspect ratio is very 
different. That's because the pan & scan dimensions are very different 
(for chems1.vob the width is bigger than the height).

Our hack so far was not to take the pan & scan in account and it worked 
well. So is there any reason we should use the pan&scan value ? From 
what I understand the pan&scan feature is made to crop the original 
picture ? On demand ? Maybe it should be optional in FFMPEG ? It seems 
that encoding with FFMPEG works because both the (pixel) 
aspect_ratio_info is stored and the sample_aspect_ratio. But the 
aspect_ratio_info field is MpegEncContext specific... Should it be more 
general ?

Steve




More information about the ffmpeg-devel mailing list