Tag Archives: command line

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.

OpenShot won’t export audio? We can fix that.


creative commons licensed ( BY ) flickr photo shared by geek_love13
Disclaimer: once again, command-line geekery follows. Disregard at your convenience.
I love OpenShot video editor for Linux (despite the occasional bugginess inherent in all things Linux) and desperately look forward to the release of the Windows port for my office PC.

In the meantime, I occasionally use OpenShot on my personal laptop to edit videos for class. This week, when I tried to export a video, a new one popped up: exporting video removes audio. After a little searching, I found that the problem is a bug in Ubuntu rather than OpenShot, and thanks to this post on Ubuntuforums, there’s an easy command-line fix. Open a terminal window (ctrl-alt-t) and enter the following commands:

  • sudo add-apt-repository ppa:sunab/kdenlive-release
  • sudo apt-get update
  • sudo apt-get install libmlt6
  • sudo apt-get install libmlt++3

Re-start OpenShot, and Bob’s yer uncle.

Splitting a flac file by cue sheet


creative commons licensed ( BY-NC ) flickr photo shared by jantos
Command line geekery follows. Ignore as you see fit.
Got a large flac file and a cue sheet rather than individual files? Here’s a handy command line trick to automagically split it into individual tracks:
~$ cuebreakpoints "filename.cue" | shntool split -o flac "filename.flac"
More details (including necessary packages) from On Ubuntu.

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.