[FFmpeg-devel] ID3v2 demuxer
Tomas Härdin
git at haerdin.se
Fri Nov 22 11:51:21 EET 2024
Hi all
So after looking at options for how to better deal with ID3v2 I'm
leaning towards creating a demuxer for it. I'm writing this before
going any further with it to get some feedback
A proper demuxer would change things up especially for mp3, since a lot
of files that now probe as "mp3" with an mp3 stream and possibly an
mjpeg stream for cover art, would then probe as "id3v2" with the same
kinds of streams
The way my current unfinished prototype works is inspired by concatdec.
It uses a subdemuxer to probe the file, starting after the ID3v2
header. Codecprops are then copied to the id3v2's AVStream for the
audio
A bit more work is necessary to deal with non-seekable files but it
doesn't look insurmountable
I may reorder the streams, so the cover art comes first, because it
comes first in the file and the audio codec can't be had until after
probing, at which point it would be too late to seek back. It could be
possible to create two streams in anticipation of there being cover art
but this is a bit of a pain
Non-seekable support also means holding the cover art in RAM for a
while. This probably isn't a big deal, but it can mean allocating up to
256 MiB. More realistically far less for most files. If discard could
be set before read_header() it would be possible to skip the cover art
entirely. Maybe we can add an option if users are really strapped for
RAM, but I doubt they are
Oh and finally I'm thinking of outputting the cover art once and only
once, regardless of seeks. That way it doesn't have to be kept around
in RAM
/Tomas
More information about the ffmpeg-devel
mailing list