Patch for faster AAC/MP4/M4A tags retrieval speed
#1
hi,
a week or so ago i posted up this question in the support forum. given the lack of any comments, i guess it wasn't the best place for it, so apologies for that if that was the case.

anyway, i thought i'd look at this some more, and come up with a patch for it. the problem is that aac tag retrieval currently involves pulling the *entire* file over into memory so that libmp4 can be used to parse the tags. i don't have any really large aacs (say, > 20mb), but pulling all that data across just to get the metadata seemed a little excessive.. Smile

after looking at a number of mp4 tag parsing modules on the web, i've written a replacement for musicinfotagloadermp4.cpp, which rather than reading the entire file, seeks through the atoms present in the mp4 file to pull out the stuff that's needed (artist, genre, track name, album name etc).

my tests here with approximately 4500 aacs show that rather than the 20 to 60+ seconds per track retrieval overhead (on an 802.11g network, with files accessed via samba), the tag retrieval now takes in the order of < 0.25 seconds. regardless of how big the file is. i was able to do a full scan of my itunes music directory over samba in just a few minutes. as a consequence of this change, musicinfotagloadermp4.cpp doesn't use libmp4 either (reducing the memory footprint a little).

i still need to tidy up the code a little, and i've yet to test extraction/caching of the 'covr' atom data (cover art), but i was after some opinions as to whether i should look at making this faster tag processing optional (in which case, what is the best way of doing this), or just submit the patch as is..

cheers,
arnie pie
Reply
#2
as long as you test it properly i can't see any reason to make it optional. nice work btw
Reply
#3
submit as-is is probably best, then we can take a look at it and see whether it's suitable or not (and improve on it together if necessary)

cheers,
jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
i've added it to sourceforge as patch 1215111. hope this is ok..?

it's nice to be able to contribute to the project (albeit in a minor way), after benefitting from it for so long.. Smile

cheers,
arnie
Reply
#5
hi,

i had a look. looks fine, except for one little thing.

could you please update it to use the id3 genre tags from lib/libid3/globals.h

unnecessary dupes is no favourite of mine Smile

spiff



Reply
#6
(spiff @ june 05 2005,15:33 Wrote:hi,

i had a look. looks fine, except for one little thing.

could you please update it to use the id3 genre tags from lib/libid3/globals.h

unnecessary dupes is no favourite of mine Smile

spiff
crikey..! i never thought to check that these were already in the codebase. although thinking about it, it seems pretty obvious that they would be.. Smile

i'll get it fixed now, and update the patch on sf.

[edit: code on sf is now updated.. also found a bug in genre code while i was applying this change, which is now fixed]

thanks!
arnie
Reply
#7
hi,

thanks. will test 'n' apply when i get home tonight

spiff
Reply
#8
commited. thanks alot!
Reply
#9
Sad 
is it possible to do something like this for mp3 tags too (id3 id3v1/id3v2)?, (and what about other tag formats which xbmc support like wma, ogg, flac, ape, etc)?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#10
as far as i'm aware, ogg/flac tag reading etc. is already pretty fast. id3 reading is the slowest of the current lot i believe. we use libid3 for this due to the vast number of different options in id3 tags.

not sure whether it can be improved at all.

the main issue with aac (as far as i can ascertain) was that libmp4 had an inefficient tag reading method.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#11
actually, the main issue with libmp4 was that it only supported reading from local files..
Reply

Logout Mark Read Team Forum Stats Members Help
Patch for faster AAC/MP4/M4A tags retrieval speed0