[Scummvm-devel] Idea: IndexedMp3AudioStream

yotam barnoy yotambarnoy at gmail.com
Fri Oct 8 00:06:31 CEST 2010


On Thu, Oct 7, 2010 at 9:48 PM, Max Horn <max at quendi.de> wrote:
>
> This seek table can easily be created while computing the length of the MP3, but of course this is slow for big files (which is why this thread was started, after all ;). Still, the point I want to make is this: We could easily modify our MP3 stream class to support using a seek table. The code would be the same whether the seek table is created on the fly, or laoded from a precomputed cache file, or from an ID3 tag. Hence, I think it should be possible to add support for this in a relatively clean way.

As was discussed, I'm not sure how clean it would be in the case of a
cache file, since our MP3 streams wrap around SeekableReadStreams.
Finding a matching cache file would seem to require more extensive
changes to our infrastructure.

> Now, as to how and where to store a seek table for an MP3 file..
>
> It is true that ID3 v2.4.0 has a frame for a seek table, the ASPI "Audio seek point index" frame (see section 4.30 in <http://www.id3.org/id3v2.4.0-frames>). Unfortunately, according to <http://www.id3.org/Home> it is not really that wide spread, and clients may not support it properly (see <http://www.id3.org/Compliance_Issues>). Rather, it seems 2.3.0 is the most wide spread (and it does not cover the seek table data).
> In v2.3.0, there is the MLLT "MPEG location lookup table" frame (see <http://www.id3.org/id3v2.3.0#head-febc618121880ee751b0c2a87327b0e698213dc4>), which also provides a seek table, but the format is mostly suitable for CBR files.
>

Correct me if I'm wrong, but according to what you're saying, we can't
expect users to find rip tools that will help them create these
things. Either we use ASPI which isn't supported, or MLLT which isn't
what we need. Sounds like we'd have to build the tool on our own.

> ID3 in either revision still has the advantage that it is at least a well-known unofficial "standard", and we would not have to create tools from scratch... But we would have to create the code for parsing this thing. Note that there is a sister library to libmad, called libid3tag; see also <http://www.id3.org/Implementations> for more implementations.

I would prefer not to include another whole library when we need only
a small subset of the functionality. I think it's fine for making a
tool that takes an mp3 and fills in the tag though.

> Another method to record such a table inside an MP3 file is the XING MP3 header. I am not sure how much that is still used these days... But it is relatively simple to add this to an MP3 file, and used to be quite popular. See e.g. here for a description and sample code: <http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx>.

Seems very similar to the ID3 tag, but it looks like mpegedit can
automatically add the XING header, which solves a minor headache for
us:
http://mpgedit.org/mpgedit/man/mpgedit.html

'mpgedit -X2 myfile.mp3' creates a new file with the Xing header. And
it's available on Windows and Linux which is nice. I couldn't find any
similar tool to add the VBR ID3 tags.

I would have to say that right now Xing looks like the best option to
me. The tool is already available, and the code to parse it is
trivial. It's equivalent to the ASPI 8-bit version which is probably
good enough (although I saw the 16-bit version was recommended for
long files).

Yotam




More information about the Scummvm-devel mailing list