Bembel-B Blog

2007/04/29

Preparing MP3s and Cover Art for SanDisk Sansa e200 Portable Audio Player

Last year I purchased a flash based 2 GB DAP SanDisk Sansa e250 to join my good ole 20 GB HDD player Creative Nomad Jukebox Zen Firewire. Sadly the Sansa is quite picky when it comes to ID3 tags.

SanDisk Sansa e200

By experimenting and reading up I found out how to retag my MP3s using Linux (and probably also Windows using Cygwin) so that they all will be fully recognized. I also found a procedure to nicely resize cover scans which can be displayed when playing a corresponding track.

Prerequisites

For ID3 tagging I’m using the command line application eyeD3, as it handles ID3v2.4 and – yes – it’s commandline driven. I made an RPM for Fedora Core 5. The original spec file didn’t work because of using the wrong python version. I’ve put my edited spec file and the RPM into my box.net share.

To handle the cover scans I use ImageMagick.

Preparation

For better performance one should copy the files to be uploaded to your player somewhere on your harddrive.

Copy your MP3s to some working directory and finally cd into it

mkdir -p ~/wrk/mp3new
cd /windows/g/mp3
cp -r _electronic/Aphex\ Twin/Aphex_Twin-...I_Care_Because_You_Do-1995/ /windows/g/mp3
cp -r _metal/Colonel\ Claypool\'s\ Bucket\ of\ Bernie\ Brains\ -\ Big\ Eyeball\ in\ the\ Sky/ /windows/g/mp3
cp -r _metal/Primus/primus-pork_soda-1993/ /windows/g/mp3
cd ~/wrk/mp3new

Retagging

The Sansa preferres ID3v2 tags over ID3v1 and can read up to ID3v2.3 tags. But it doesn’t seem to like some of the special fields possible with ID3v2.3 and therefore these will have to be removed. The following steps may seem a bit complicated, but it’s the only way to do the cleanup with eyeD3 currently.

1.) Convert to v1.x

find -type f -and  \( -name "*.mp3" -or -name "*.MP3" \) -print0 | xargs -0 eyeD3 --to-v1

2.) Remove v2

find -type f -and  \( -name "*.mp3" -or -name "*.MP3" \) -print0 | xargs -0 eyeD3 --remove-v2

3.) Convert to v2.3

find -type f -and  \( -name "*.mp3" -or -name "*.MP3" \) -print0 | xargs -0 eyeD3 --to-v2.3

4.) Remove v1

find -type f -and  \( -name "*.mp3" -or -name "*.MP3" \) -print0 | xargs -0 eyeD3 --remove-v1

To make things easier, I’ll try to condense all this to one single command next time. So stay tuned..

Cover Art

My procedure will only keep the front cover scans, where available. If you’d like to keep other images too, you’d have to follow the alternative procedure 1b/2b instead of 1a/2a.
Please note: even png images will be renamed to folder.jpg ImageMagick will correctly recognize them as pngs when converting.

If you’d prefer not to use folder.jpg for the resized cover images you may instead use Album Art.jpg as filename.

1a.) List all jpegs and png files. Then manually delete all unneeded files!

find -type f -and \( -name "*.jpg" -or -name "*.JPG" -or -name "*.png" \)

2a.) Rename cover images to folder.jpg

OLDIFS=$IFS ; IFS=$'\n' ; \
for fn in `find -type f -and \( -name "*.jpg" -or -name "*.JPG" -or -name "*.png" \) -not -name "folder.jpg"` ; \
do mv -v "$fn" "${fn/`basename "$fn"`/folder.jpg}" ; \
done ; IFS=$OLDIFS

1b/2b.) Alternative: To keep other images as well, you’d have to manually rename (or copy to keep the original) the front cover images to folder.jpg

3.) Proportionally resize cover images to max 200 x 200 px

OLDIFS=$IFS ; IFS=$'\n' ; \
for fn in `find -type f -name folder.jpg` ; \
do mogrify -verbose -resize '200x200>' "$fn" ; \
done ; IFS=$OLDIFS

I must admit this isn’t the most elegant way. Maybe I’ll manage to make some little GUI and trying to automatically chose the front cover image files. We’ll see..

Uploading to the Player

Nothing special here. Just plug in your Sansa in MSC mode. Then move the files to the player.

mv -v * /media/Sansa\ e250/MUSIC

If you’re replacing files on your player, you’ll have to purge the tag database in order to let the player recognize the changes.

rm /media/Sansa\ e250/SYSTEM/DATA/PP5000.DAT

ChangeLog

[070923 Fix backslashes (“\\” markup was meanwhile rendered as “\\” and not “\” as before.]
[080120 Add “Sansa e200” category and link to it.]

Advertisements

11 Comments »

  1. There is a much easier way to sort out the id3 tags.

    First check that artist, name and album are set in Amarok or Easytag

    Then id3tag -2 *.mp3

    Comment by Alan — 2007/05/21 @ 21:09 | Reply

  2. Alan’s suggestion does not work for me – the 4 commands in the post, however, do work! Be sure to set the track nunmber when you tag or it will just want to play them alphabetically; at least this is the case on my e260.

    Could you please explain the reasoning behind those commands in relation to what the Sansa will and will not handle? I would like to see if there is an quicker way to do this.

    Thanks for the tip!

    Comment by Kevin — 2007/06/12 @ 20:59 | Reply

  3. Actually I take that back – setting the track number in the tag does nothing and the Sansa wants to play them alphabetically by title. So is the only way to get them to play in the proper order to name them 01, 02, 03 etc in the title field?

    Comment by Kevin — 2007/06/12 @ 21:04 | Reply

  4. Hi Kevin! Thanks for your response!

    The reason for moving to v1 and then back to v2 again is, that this will wipe all v2 tags and by that remove the fields which Sansa doesn’t like. I haven’t yet pinpointed the responsible fields that have to be removed.
    Obviously you can also skip the step of converting back to v2 tags, as there’s no gain in tag data at that point.

    I’ve only done a few experiments with id3tag so far. It seems to clean up a bit. But as I unfortunately didn’t note which mp3s were causing the problems that led me to using eyeD3, I wasn’t able try to achieve the same results with id3tag yet.

    As for the Track Numbers I can only tell that they are working for me without any problems. One idea is that you lost the track numbers when overwriting the v1 tag (which held the tracknumbers and v2 didn’t). Another cause may be prefixing the Track Numbers with zero.

    Ciao!

    Comment by FrankZabbath — 2007/06/13 @ 21:55 | Reply

  5. Frank, thanks for the info – I am going to see what I can do to isolate the fields that cause problems. Will post back with more info.

    Comment by Kevin — 2007/06/14 @ 19:48 | Reply

  6. […] Preparing MP3s and Cover Art for SanDisk Sansa e200 Portable Audio Player « Bembel-B Blog How to add cover art and id3tags for the Sandisk Sansa MP3 players (which I have & love) (tags: sansa) Bookmark to: […]

    Pingback by paul cutler’s blog » Blog Archive » links for 2007-06-20 — 2007/06/21 @ 00:24 | Reply

  7. OK – on Linux for me, I am using Easytag. What I do is strip the tag away entirely for the problem album and generate a new one from CDDB. A lot of things I thought I had tagged in iTunes actually don’t read as having any tag at all (go figure). I get total success with the following fields filled: Title, Artist, Album, Year, Track #/# (two fields actually). I see that the Sansa will also tolerate comments, composer, etc as far as I can tell, but I like to leave those blank.

    The tags are written as v2 according the preferences. I don’t know if this means 2.3 or just 2.

    So I guess this is where I have ended up… just another way to make sure the Sansa will read the tags, or replace faulty ones. Easytag, fortunately, makes this really simple.

    Comment by Kevin — 2007/06/25 @ 21:25 | Reply

  8. Just wanted to leave a note on what I’ve found to work w/ my Sansa.. It seems that when you convert to v2.3 tags w/ eyeD3, it’s not changing the encoding (thus leaving it at utf8, which is not part of the v2.3 specs), so rather than converting to v1.1 and back to v2.3 (which can crop tags horribly!), do this:

    find . -iname ‘*.mp3’ -type f -exec eyeD3 –to-v2.3 –set-encoding=utf16-BE {} \;

    You can use this as a disconnect script, but be warned, it can take awhile to run, so you may want to run it against your mp3 folder that exists on your hard drive before transferring, but be aware, that you’ll need to rerun it if you edit your tags w/ anything that writes v2.4 tags.

    Also, on a side note, v2.4 works, if you change the encoding format to utf16 or latin1.

    Comment by Jagged — 2007/09/16 @ 22:32 | Reply

  9. one last note, if your mp3’s are already set to v2.3 you’ll need to use –force-update to change the encoding.

    Comment by Jagged — 2007/09/16 @ 22:36 | Reply

  10. Thanks a lot, Jagged! Great findings!! But for me, I’ve dropped that and other problems by using the mighty Rockbox firmware. :) Thanks to the other commenters too, of course! Best Regards!

    Comment by FrankZabbath — 2007/09/23 @ 01:46 | Reply

  11. RipperX was a one-stop shop for me – it did CDDB lookups and ripped+tagged the files (I think CD->wav->tagged_mp3s) – I simply moved them over to my 6GB Sansa (Refurb from Woot) and it was instantly listed in my albums/songs/artist lists.

    I found RipperX after trying most other mp3 related rippers in Ubuntu (7.04). I think I requires LAME mp3 encoding but since I’ve reinstalled (i.e. erased) my Ubuntu to put on 7.10 RC1 and I haven’t ripped
    anything and can’t be 100% sure LAME is required or what exact libraries are needed by RipperX.

    Comment by David — 2007/10/30 @ 18:11 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: