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?"

6 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. 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 :)

  4. 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

  5. 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
  6. 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!