Version 3 of Batch Converter ogg2mp3

Updated 2006-09-17 15:33:09

if false { Last monday, I bought an MP3 player for 15 €. At that price, I could'nt resist. But it cannot play the *.ogg files which I copied from my Leon Redbone CD.

Converting to *.mp3 is done by the tool ffmpeg as follows:

 ffmpeg -i song.ogg song.mp3

But the file names are much longer so I prefer this quick'n'dirty script ogg2mp3:

 }

 #! /usr/bin/tclsh

 proc ogg2mp3 {} {
     foreach fileName [lsort [glob -nocomplain *.ogg]] {
         set rootName [file rootname $fileName]
         set rootName1 [string map [list " " _ / -] $rootName]
         if {![file exists $rootName.mp3]} then {
             set err ""
             puts "converting $rootName ..."
             catch {exec ffmpeg -i $rootName.ogg $rootName1.mp3} err
             puts $err
         }
     }
 }

 ogg2mp3

Category Multimedia