[sclug] Re: converting ogg files to mp3s

Graham lists at Information-Cascade.co.uk
Sat Aug 20 17:30:41 UTC 2005


> Is there a quick way to convert ogg files to mp3s?

	maybe but two lossy-codecs will sound worse than one
	Its better to produce mp3's from the lossless source
	to convert wav to mp3 (eg for walkmans) I use

		lame -h -vbr-new -V 2 ...

	to write the mp3 tags, I use a script like this  http://id3-py.sourceforge.net/


#!/usr/bin/env python

from ID3 import *

# http://id3-py.sourceforge.net/
# 30 chars max, each field

def id3_genre( id3, str ):
	g = id3.find_genre( str ) # must not fail!
	try:
		g = id3.find_genre( str )
		id3.genre = g
	except:
		print "Genre not recognised:", str
		pass


def chapt( NAM, T1, C1, title ):
	global conv
	T = ("%d" % T1 )
	C2 = ("%2.2d" % C1 )
	dir=NAM + "_" + T
	dir=NAM 
	fil=NAM + "_" + T + "_" + C2
	fil=NAM +           "_" + C2
	filename = "/sys2/BBK_2/mp3/" + dir + "/" + fil + ".mp3"

	# title = T + "." + C2 + " " + title

	album = "Let The Good Times Roll"
	comment = "DVD as MP3 "
	artist = "B.B.King"
	genre_str =  "Blues"
	track = C1
	year = "2004"

	try:
		print
		id3 = ID3( filename )

		id3.title = title
		id3.album = album
		id3.artist = artist
		id3.year = year
		id3.track = track
		id3.comment = comment
		# id3.genre = genre
		id3_genre( id3, genre_str )

		id3.write()	# also called butomatically y dtor
		print id3
	except InvalidTagError, message:
		print "Invalid ID3 tag:", message


chapt("BBK", 2, 1, "Two I Shoot Blues")
chapt("BBK", 2, 2, "Introduction")
chapt("BBK", 2, 3, "Let The Good Times Roll")
chapt("BBK", 2, 4, "I'll Survive")
chapt("BBK", 2, 5, "Bad Case Of Love")
chapt("BBK", 2, 6, "Peace OF Mind")
chapt("BBK", 2, 7, "Caledonia")
chapt("BBK", 2, 8, "Blues Boy Tune")
chapt("BBK", 2, 9, "Early In The Morning")
chapt("BBK", 2, 10, "Just Like A Woman" )
chapt("BBK", 2, 11, "(gomma move) The outskirts of Town" )
chapt("BBK", 2, 12, "The Thrill Is Gone" )
chapt("BBK", 2, 13, "I Know" )
chapt("BBK", 2, 14, "Dont Go No Further (you need meat)" )
chapt("BBK", 2, 15, "Please Accept My Love" )
chapt("BBK", 2, 16, "Making Love Is Good For You" )
chapt("BBK", 2, 17, "Blues In The Bones" )


More information about the Sclug mailing list