[FFmpeg-devel] [PATCH] avformat/mp3dec: avoid early EOF with concatenated gapless mp3s

wm4 nfxjfg at googlemail.com
Sun Sep 21 16:26:37 CEST 2014

On Sun, 21 Sep 2014 15:59:43 +0200
James Darnley <james.darnley at gmail.com> wrote:

> On 2014-09-21 12:51, wm4 wrote:
> > it's easy to prevent at least early EOF. Playback will happen to work,
> > even if it's slightly broken.
> Do we want to print a warning in the "slightly broken" case?  Does it
> just mean that the middle cannot be gapless between file1 and file2?

Well, it means that while decoding the packet stream, the gapless info
of file2 will be applied. If file1 is longer than file2, some random
samples in the middle of file1 will be dropped. If file2 is longer,
some random samples in the middle of file2 will be dropped.

One could just print a warning if mp3 data is successfully parsed after
the expected end (end according to the length of the file in frames
stored in the gapless info), but I didn't want to add another flag to
the context. (Without such a flag you would print the warning after
every packet read.)

Another possibility: guess whether the stored length in frames doesn't
match up with the byte size and the VBR index. But sounds hard and not
very reliable.

Or the whole file could be parsed. A libavformat mode that fully parses
and indexes a file on user request would probably be nice to handle all
these raw audio formats.

More information about the ffmpeg-devel mailing list