Missing codecs no longer result in an error

This commit is contained in:
Michael Johnson 2013-04-01 14:48:22 -03:00
parent 9b94a86c72
commit 792e8b7876

View file

@ -61,13 +61,16 @@ def Transcode_directory(dirName):
outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext' outputVideoExtension = '-transcoded' + outputVideoExtension # adds '-transcoded.ext'
newfilePath = os.path.normpath(name + outputVideoExtension) newfilePath = os.path.normpath(name + outputVideoExtension)
command = [ffmpeg, '-i', filePath, '-map', '0'] command = [ffmpeg, '-i', filePath, '-map', '0', '-c:s', 'copy']
if outputVideoCodec: if outputVideoCodec:
command.append('-c:v') command.append('-c:v')
command.append(outputVideoCodec) command.append(outputVideoCodec)
if outputVideoCodec == 'libx264' and outputVideoPreset: if outputVideoCodec == 'libx264' and outputVideoPreset:
command.append('-preset') command.append('-preset')
command.append(outputVideoPreset) command.append(outputVideoPreset)
else:
command.append('-c:v')
command.append('copy')
if outputVideoFramerate: if outputVideoFramerate:
command.append('-r') command.append('-r')
command.append(outputVideoFramerate) command.append(outputVideoFramerate)
@ -77,6 +80,9 @@ def Transcode_directory(dirName):
if outputAudioCodec: if outputAudioCodec:
command.append('-c:a') command.append('-c:a')
command.append(outputAudioCodec) command.append(outputAudioCodec)
else:
command.append('-c:a')
command.append('copy')
if outputAudioBitrate: if outputAudioBitrate:
command.append('-b:a') command.append('-b:a')
command.append(outputAudioBitrate) command.append(outputAudioBitrate)