Tag Archives: mp3

shn>mp3 from the command line

flickr photo shared by sickmouthy under a Creative Commons ( BY-NC ) license

YACLP—Yet Another Command-Line Post: this time, it’s how to convert Shorten files (an obsolete lossless audio codec) to mp3 for portable listening. Most of the time, I use SoundConverter to transcode from lossless formats to mp3 for portable listening. For some reason, however, SoundConverter can’t find Shorten, even though I have it installed. I suppose if I knew where it was looking, I could put in a symlink to where it really is. Or I can just dig up something that works from the command line. Thanks to this handy thread by shantiq from UbuntuForums, here’s one command that will convert a whole directory full of shn files. Just cd to the directory holding your shn files and do the following:
for f in *.shn; do ffmpeg -i "$f" -ab 320k "${f%.shn}.mp3"; done
If you really want to do it shipshape and Bristol-fashion, you could use shntool to convert to flac and tag the files with appropriate metadata and then use SoundConverter to go to mp3, preserving the tags from flac:
shntool conv -o flac *.shn
For tagging, renaming, and adding track numbers, I’m a big fan of Ex Falso, and for an audio player, I like DeadBeef for its simplicity.

Removing embedded images from ID3 tags with eyeD3

I got a set of MP3s recently that included embedded artwork (which turned out to be a 3648×2736 image that made my mp3 player freeze while it re-sized to fit the 480×272 screen for each track). Now I suppose the easy thing to do would have been to transcode it myself from the lossless files, or just download a different mp3 version. Instead, I figured there had to be a way to extract the artwork from the files. I first went to my go-to tag editor, ex falso, but it didn’t show the embedded art at all. A quick internet search turned up eyeD3 (via ubuntuforums), which is a command line tag editor.

To install in Ubuntu, open a terminal window and type
sudo apt-get install eyed3
Once it’s installed, navigate to the directory with your mp3 files and make a dirctory for the cover image:
mkdir cover
To extract the cover art from the files, next type
eyeD3 -i cover, --write-images=cover file.mp3
Use a single, specific file name and not a wildcard *.mp3 or else you’ll end up with a sequentially numbered image file for each track. [If each track has different cover art go for it with the wildcard!] If you just want to delete the images without saving a copy, you can skip to the next step and type the following command:
eyeD3 --remove-images * *.mp3
which will remove all the embedded images.