"Reading Tags" - Raspberry Pi

Hi, I wonder if anyone's encountered this problem.

I'm running MOC automatically on my Pi as it boots up. The idea is to have it headless in the car and for it to start playing music. I've been running it very successfully with just 75-ish MP3 files - startup to the music playing was just 15 seconds or so and I was pretty happy with it. (I'm using a very cut-down version of Raspian to speed up the boot).

However, on scaling this up, things aren't going so well. I put 1400 music files (of mixed format) onto a larger memory card and the startup time has plummeted. When watching what happens (when hooked up to a monitor), it seems that the time is taken in "reading tags" on each music file. With 1400-ish files, it's taking about 2 - 3 minutes before any music will play.

I've included my startup script (below) to show what I'm doing. Do let me know if I'm getting things wrong - I'd really like to speed things back up again!

rm -f /.moc/pid
rm -f /.moc/socket*
mocp -S -R ALSA
mocp -c
if mocp -a /root/startup.m3u; then
echo "Startup success" 1>&2
rm -f ~/.moc/cache/*.*
rm -f /.moc/socket*
mocp --on shuffle
mocp --on autonext
mocp --on repeat
mocp -p --volume 100

Any advice greatfully received.


I should add, I've also tried "ReadTags = NO" to switch tag reading off (after all, noone's going to see them), and increasing the size of the tag cache, which doesn't appear to have helped.

I'm sorry that you (and others) are experiencing this on large and/or remote directories. I know it's a problem and at least some of it is due to MOC repeatedly requesting file information as identified in the post referenced above.

I may have a solution to that and other parts of the problem, but I do still need to investigate further to see if there's more that can be done.

If you are using the FFmpeg/LibAV decoder to play your MP3s then it would probably benefit you to switch to the MP3-specific decoder. (FFmpeg/LibAV reads large portions of each file in order to identify them.)

Thanks for coming back to me. I am using ffmpeg because I'm also playing files purchased on iTunes (as well as MP3s). If I remove ffmpeg is there an alternative I can use to play the files?



I don't know what format iTunes uses, but I'd guess AAC for which MOC does have a decoder; check out the PreferredDecoders option in the example configuration file. But even using MOC's MP3 decoder for MP3s and FFmpeg for the iTunes files would speed things up in proportion to the numbers of each.

Having removed FFMPEG, it certainly loads quicker again. However, only about 50% of my files seem to be recognise, which I suspect is because they're M4A (MPEG4-AAC) format.

If I'm not using FFMPEG, is FAAD2 a good alternative?



You can also consider getting rid of mp3 files. From my observations on OpenWRT they tend to take more time to scan.

Faad2 should work OK for most AAC files, you can also consider re-encoding some of them to another format.

MOC's AAC decoder can't play the M4A format directly, but a simple extraction of the AAC codec data allows it to do so:

ffmpeg -i itunes_audio.m4a -acodec copy itunes_audio.aac