[FFmpeg-devel] [PATCH] fix swf playback with bad audio track

Aurelien Jacobs aurel
Sun Sep 16 23:51:40 CEST 2007


On Sun, 16 Sep 2007 23:28:22 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> Hi
> 
> On Sun, Sep 16, 2007 at 11:13:22PM +0200, Aurelien Jacobs wrote:
> > On Sun, 16 Sep 2007 20:20:05 +0200
> > Baptiste Coudurier <baptiste.coudurier at smartjog.com> wrote:
> > 
> > > Hi
> > > 
> > > Michael Niedermayer wrote:
> > > > Hi
> > > > 
> > > > On Sun, Sep 16, 2007 at 06:16:32PM +0200, Baptiste Coudurier wrote:
> > > > [...]
> > > > 
> > > >>This is ugly indeed. Maybe we could just output the big packet with
> > > >>AVSTREAM_PARSE_FULL which will split out audio frames, and let the user
> > > >>application correctly interleave video and audio frames based on dts.
> > > > 
> > > > 
> > > > yes
> > > > 
> > > > 
> > > > 
> > > >>Also lavf could do it in a generic way after parsing, 
> > > > 
> > > > 
> > > > no
> > > > 
> > > > either the file is approximately interleaved, in which case packets are
> > > > output as is or
> > > > its completely non interleaved in which case the demuxer must interleave
> > > > things properly by reading just what is output
> > > 
> > > So, audio data must be read by a small amount at a time (would be
> > > audio_packet_size), and the parser should be set to AVSTREAM_PARSE_FULL
> > > to reconstruct frames from those small data chunks, it must not read the
> > > whole audio chunk which can be potentially big.
> > > 
> > > Right ?
> 
> i dont know DEFINESOUND so well maybe ...
> if DEFINESOUND is limited to some sane size (~1sec audio) then just outputing
> the whole chunks and letting the AVParser deal with it should be fine
> if OTOH the thing can contain 1min audio or so then yes you are right the
> demuxer has to split and interleave audio and video

Well, I don't know much about DEFINESOUND, but at least with the sample
I tested, there is one big DEFINESOUND packet containing the mp3 track
for the whole video duration. You can really consider this as
non-interleaved format.

> and in that case aurels patch might not be that bad ...

:-)
Well, it still don't split packet properly to ensure A/V sync so it's
far from perfect.

> i thought that DEFINESOUND would not contains hours of sound in a single
> continuous chunk such design would be sick and my review was based on the
> assumtation that the design wasnt that sick ...

Design is that sick ! :-(
Well, DEFINESOUND was not meant to contain an audio track for a video
file. It was meant to contain a small audio chunk which can be called
by some objects or events in an interactive flash file.
Unfortunately it seems some people used it for another purpose :-(

> > I think it's right, but the hard part IMO is to find out how much audio
> > and video data must be read each time in order to keep A/V sync.
> > IOW, find out audio packets boundaries, and how much audio samples will
> > be decoded out of each packet.
> 
> the container should contain the needed information, doesnt it?

I don't think it does. Basically a DEFINESOUND packet simply include
a full mp3 file without much more information.

Aurel




More information about the ffmpeg-devel mailing list