[FFmpeg-devel] [PATCH] lavf: add av_guess_frame_sample_aspect_ratio function

Michael Niedermayer michaelni at gmx.at
Sun Apr 29 14:51:17 CEST 2012

On Sun, Apr 29, 2012 at 01:10:15PM +0200, Reimar Döffinger wrote:
> On Sun, Apr 29, 2012 at 01:30:02AM +0200, Marton Balint wrote:
> > Guesses the sample aspect ratio of a frame, based on both the stream and the
> > frame aspect ratio.
> > 
> > Since the frame aspect ratio is set by the codec but the stream aspect ratio
> > is set by the demuxer, these two may not be equal. This function tries to
> > return the value that you should use if you would like to display the frame.
> > 
> > Basic logic is to use the stream aspect ratio if it is set to something sane
> > and not 1:1, otherwise use the frame aspect ratio if it is set. I made some
> > tests with the files on samples.libav.org and this logic performed the best.
> It also means it will be impossible for users to fix an incorrect ratio
> encoded in the H.264 headers by just modifying the container value.
> Since the container value is basically always easy to trivial to fix,
> while the stream one is very difficult (with FFmpeg for example the
> only way possible is re-encoding) I am against ever disregarding the
> container value.

it should be fairly easy to write a bitstream filter that can change
the aspect ratio


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120429/df0d6c3f/attachment.asc>

More information about the ffmpeg-devel mailing list