Slashdot Mirror


Batch Converting Between Formats?

Yort asks: "With the Christmas season upon us, it's time to dust off the Yuletide music. However, I'm finding once again this year that I'm needing to re-rip all my CDs to fit the format-of-the-year. Ogg Vorbis for my portable, MP3 for the Tivo, WMA and AAC for sharing with co-workers... Argh! So, I've decided it's time to end the madness: Hard drives are cheap, so I'm going to rip all my music once-and-for-all to a lossless format (I'm choosing FLAC at this point), then just batch convert to whatever format I need. I know I'm hardly the first one to think of this, but I've looked around and haven't found much in the way of good OSS tools for this sort of thing. Any recommendations, or do I have to write one myself?"

11 of 94 comments (clear)

  1. sounds like a job for by Gherald · · Score: 4, Insightful

    bash

  2. just a simple frelling script. by Gadzinka · · Score: 4, Informative
    Well, I don't know about applications to recode to different formats, but I do use mp3 for transferring music to my Creative MuVo. It was just a simple script written in couple of minutes:
    #! /bin/sh

    br="96"

    if [ "$1" = "-b" ] ; then
    br="$2"
    shift;shift
    fi

    sdir=`echo "$1"|sed 's|/$||'`
    ldir=`dirname "$sdir"`
    ddir=/home/queue

    if file "$sdir" | grep -qs directory ; then
    find "$sdir" -print | while read src ; do
    dst=`echo "$src" | sed "s|$ldir|$ddir|; s/\.\([oO][gG][gG]\|[fF][lL][aA][cC]\|[mM][pP]3\)$ /.mp3/"`
    case `file -b "$src"` in
    *directory* )
    mkdir "$dst"
    ;;
    *FLAC* | *Vorbis* )
    ogg123 -d wav -f - "$src" |lame -h --abr "$br" - "$dst"
    tagcopy "$src" "$dst"
    ;;
    *MP3* )
    lame -h --abr "$br" "$src" "$dst"
    tagcopy "$src" "$dst"
    ;;
    * )
    cp "$src" "$dst"
    ;;
    esac
    done
    fi
    You have to give it full path from / and tagcopy is a simple wrapper around taglib C API to copy ID3 (or equivalent) tags between two files.

    Just use it as an example to create scripts converting to other formats.

    Robert
    --
    Bastard Operator From 193.219.28.162
  3. A summary by dasunt · · Score: 3, Informative

    Several votes for bash, and a mention of python or perl so far.

    Any scripting language will work. Check out freshmeat and sourceforge, there are several scripts available that will access the CDDB and dump the artist/track information.

    The only thing missing is a trained monkey to operate the CD drive all day. Better start searching. :)

  4. Why? by samael · · Score: 3, Insightful

    Your portable can play MP3. Your Tivo can play MP3. Your friends can play MP3.

    Why not just rip to high-quality MP3 and have done?

    1. Re:Why? by richy+freeway · · Score: 3, Insightful

      Cos when the next super MP3alike comes along, he'll have to rip all the tracks again to get the best quality. If he rips them all to a lossless format once, then converts to mp3 now, he can always return to the lossless format and covert them to the new super MP3alike format. Geddit?

  5. Makefile by xFallenAngel · · Score: 5, Interesting
    You could actually write a makefile that utilizes the separate converters and outputs as wanted...

    make ogg
    make mp3
    make wma
    make rip

    Something alont those lines...I'll leave the Makefile as an excersize for the reader :)

    1. Re: Makefile by Black+Parrot · · Score: 3, Funny


      > You could actually write a makefile that utilizes the separate converters and outputs as wanted...

      > make ogg
      > make mp3
      > make wma
      > make rip

      Don't forget the all-important -

      make morediskspace

      --
      Sheesh, evil *and* a jerk. -- Jade
  6. The script I use... by turnerjh · · Score: 4, Informative

    This is the script I use. Wrote it a while back for basically the same reasons -- record everything in FLAC, convert to lossy format of the week. I originally used a bash script but found it to be a bit less than robust and somewhat more difficult to extend.

    This script either takes command line args, or, if none present, reads filenames one at a time from the command line. Generally I run it via 'find -name "*.flac" | transcode' and let it DTRT. As an added bonus, it copies the id3 tags from src to dest (assuming id3cp is installed)

    http://perl.pattern.net/transcode

  7. Why? No, you don't. by mbourgon · · Score: 4, Insightful

    I'm needing to re-rip all my CDs to fit the format-of-the-year

    Why? Your coworkers are probably going to look at the extension and say "never mind". Yeah yeah yeah, ogg is great, all hail ogg, but when it gets down to it, there's no reason for you to go through all that effort. MP3s play in everything you mentioned. Ogg is going to be a value-add, but down the road. Same with AAC. For the forseeable future, it's all MP3.

    --
    "Sometimes a woman is a kind of religion, she can save your soul & set you free from all your sins" - Bad Examples
  8. Cool idea by megaversal · · Score: 5, Interesting

    I always thought this was a cool idea: http://file-ext-map.sourceforge.net/

    Though not updated in a long while, I think you could use this to automatically convert your flac files to an "mp3 share" and the files would be automatically transcoded to mp3 on the fly as you viewed the Samba share. Just make additional shares for additional file types.

    No need to batch process, whatever you want is done on the fly.

    --
    Sig!
  9. Smart choice with FLAC! We learned the hard way! by linuxbaby · · Score: 3, Informative
    At CD Baby we used to think like the other folks here saying "Why not just use MP3?" We have over 78,000 CDs here, and we hired two people to rip them all to hi-fi MP3 (lame --preset standard).

    But then... digital distribution started last year with Apple iTunes, Napster, Rhapsody, etc. All of these companies REQUIRED that the encoded file (AAC, WMA, etc) come from the master WAV file. Ack! Screwed! 9 months of ripping down the drain!

    So... we finally realized what I was kicking myself for not realizing in the first place - and exactly what the story post mentions: hard drive storage is cheap. labor is expensive. rip the CD *once*, lossless, and NEVER have to rip it again. We wiped all our useless MP3 drives and started again: ripping all 78,000 CDs to FLAC format. Since it's a perfect digital copy of the master audio fles, and supports metadata tags, too, it's the perfect archiving format.

    VERY easy to just script-up a bulk converter. http://perl.pattern.net/transcode is a great Perl solution. I posted my audio-converter scripts here, which include the use of SOX to make 30-second audio clips (since we needed that for work).

    To all those here saying "MP3 is fine!" - you're being short sighted. In a few years there will be a newer better codec, and all your old MP3s will look as bad to your ears as your old 320x240 JPGs from 1995 look now. Go lossless. (FLAC, WAV, etc) - your future self will thank you.