[FFmpeg-devel] [PATCH] read sample aspect ratio from video stream if not known from container

Paweł Kołodziej Pawel.Kolodziej
Tue Feb 10 11:53:41 CET 2009


Dnia 2009-02-09, Pn o godzinie 23:01 +0100, Michael Niedermayer pisze:
> On Mon, Feb 09, 2009 at 04:55:53PM +0100, Pawe? Ko?odziej wrote:
> > Hello,
> > 
> > File 
> > http://derchris.eu/ccc/25C3/video_h264_720x576/25c3-2596-en-swf_and_the_malware_tragedy.mp4
> > (h264 in mp4) has SampleAspectRato 5:4 but information about it is not
> > stored in container but in video stream (VUI). This information is not
> > read by ffmpeg[1] and this results in output stream with SAR 1:1
> > (wrong).
> > 
> > Attached patch fix it - if SAR is not known from container then it's
> > read from video stream. I hope it does not break anything. 
> 
> a file that contains no aspect at all will cause av_find_stream_info()
> to run for a very long time with this patch

It will read and decode no more then MAX_READ_SIZE which is 5Mbytes. I
think it will take no longer then about 5-10s (on PC). For me it does
not sound like "very long time" - usual ffmpeg run take about an hour or
so. 

Do you have any idea to improve this worst case in which 5MB of stream
will be read? I've only one: we could add special mode to decoders in
which they do not perform full video decoding but only looks for
headers. But it will be needed to change all decoders - it may be quite
a big job.  

Anyway this patch fixes bug - without it some contents are endoded with
wrong aspect ratio.

Regards,
Pawel





More information about the ffmpeg-devel mailing list