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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Apr 29 17:38:58 CEST 2012

On Sun, Apr 29, 2012 at 04:39:07PM +0200, Marton Balint wrote:
> >In MPlayer I made one special case: when the frame value changes, that
> >one is used. Since that most likely means there was an aspect change
> >and most containers do not support those.
> For the above file the aspect is not changing but mplayer still
> thinks it does for some reason, so it uses the frame aspect ratio.

The reason is that MPlayer uses DR for that codec, and the codec
fails to set the sample aspect before calling get_buffer.
Not sure whether that can be considered a bug, but it at least isn't

> Anyway, I think it is more important to provide a ways to do this
> and handle it consistently throughout the whole ffmpeg codebase than
> to stick to a particular method. If others agree I will drop the
> extra smart 1:1 detection stuff, and just change it to a simple use
> stream ratio then use frame ratio logic.

I'd be in favour of that. And I don't mind making it configurable
or improving on it (e.g. it might depend on container, for example
I think for AVI the information is more likely to be incorrect than
for mkv, so an API that allows taking that into account would be good).

More information about the ffmpeg-devel mailing list