Skip to content

Instantly share code, notes, and snippets.

@kennydude
Created July 9, 2011 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kennydude/1073918 to your computer and use it in GitHub Desktop.
Save kennydude/1073918 to your computer and use it in GitHub Desktop.
OggFixer!

This Gist Fixes Oggs

What we do is check using "ogginfo" which you need installed to your system and if that tells us your ogg file is dodgy it'll fix it.

It works for Vorbis files as Banshee had trouble playing some badly encoded ones. It seems to retain all tags too!

You may need to modify the location of the music for it to work depending on your setup!

print "OGG FIXER!"
import glob, subprocess, os
daglob = glob.glob('./Music/*/*/*.ogg')
for f in daglob:
retcode = subprocess.call(["ogginfo", f, "-q", "-q"])
print "Returned ", retcode
if retcode != 0:
subprocess.call(["ffmpeg2theora", "--novideo", "-a 8", "-o", "%s_fix.ogg" % f, f ])
os.rename(f + "_fix.ogg", f)
print "Fixed ", f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment