Skip to content

Commit

Permalink
audio transcoding: force resampling to 44.1kHz when using OGG encoder,
Browse files Browse the repository at this point in the history
  • Loading branch information
devsnd committed May 23, 2016
1 parent 9e66ec7 commit 45ce2e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions audiotranscode/__init__.py
Expand Up @@ -70,6 +70,8 @@ def encode(self, decoder_process, bitrate):
cmd = [find_executable(self.command[0])] + self.command[1:]
if 'BITRATE' in cmd:
cmd[cmd.index('BITRATE')] = str(bitrate)
if 'KBITRATE' in cmd:
cmd[cmd.index('KBITRATE')] = str(bitrate) + 'k'
return subprocess.Popen(cmd,
stdin=decoder_process.stdout,
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -161,11 +163,9 @@ class AudioTranscode:
or transcode_stream to get a generator of the encoded stream"""
READ_BUFFER = 1024
Encoders = [
#encoders take input from stdin and write output to stout
Encoder('ogg', ['oggenc', '-b', 'BITRATE', '-']),
#doesn't work yet
#Encoder('ogg', ['ffmpeg', '-i', '-', '-f', 'ogg',
# '-acodec', 'vorbis', '-']),
# encoders take input from stdin and write output to stout
# Encoder('ogg', ['ffmpeg', '-i', '-', '-f', 'ogg', '-c:a', 'libvorbis', '-b', 'KBITRATE', '-']),
Encoder('ogg', ['oggenc', '--resample', '44100', '-b', 'BITRATE', '-']),
Encoder('mp3', ['lame', '-b', 'BITRATE', '-', '-']),
Encoder('aac', ['faac', '-b', 'BITRATE', '-P', '-X', '-o', '-', '-']),
Encoder('m4a', ['faac', '-b', 'BITRATE', '-P', '-X', '-o', '-', '-']),
Expand Down

0 comments on commit 45ce2e4

Please sign in to comment.