Created
May 18, 2012 22:25
-
-
Save miohtama/2727891 to your computer and use it in GitHub Desktop.
Create HTML5 <audio> compatible files out of MP3 using ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
import os | |
import subprocess | |
def create_prelisten_ogg(mp3, ogg): | |
""" | |
Run en-code for a single file | |
Do 48 kbit files for prelisten. | |
""" | |
FFMPEG = os.environ['FFMPEG'] | |
cmdline = [ FFMPEG, '-y', '-i', mp3, '-acodec', 'libvorbis', '-ar', '22050', '-ac', '1', '-ab', '48000', ogg ] | |
return subprocess.call(cmdline) | |
def create_prelisten_aac(mp3, aac): | |
""" | |
Run en-code for a single file | |
Do 48 kbit files for prelisten. | |
""" | |
FFMPEG = os.environ['FFMPEG'] | |
cmdline = [ FFMPEG, '-y', '-i', mp3, '-acodec', 'libfaac', '-ar', '22050', '-ac', '1', '-ab', '48000', aac ] | |
return subprocess.call(cmdline) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment