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

Michael Niedermayer michaelni at gmx.at
Sun Apr 29 19:03:21 CEST 2012


On Sun, Apr 29, 2012 at 04:03:01PM +0200, Reimar Döffinger wrote:
> On Sun, Apr 29, 2012 at 02:51:17PM +0200, Michael Niedermayer wrote:
> > 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
> 
> For all video stream formats that contain such info?
> It may be easy but it sure is a good bit of effort.

i was just thinking of h264 because that was mentioned ...
and my comment was not intended to make any suggestion toward any
aspect ratio heuristic, i just wanted to comment on the
difficulty of changing the in stream aspect ratio in the case limited
to a single codec.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- 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/06aa5e58/attachment.asc>


More information about the ffmpeg-devel mailing list