mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-15 01:32:53 -07:00
Added the ability to choose a subtitle codec
This commit is contained in:
parent
792e8b7876
commit
9e00ef72a5
2 changed files with 8 additions and 1 deletions
|
@ -46,6 +46,7 @@ def Transcode_directory(dirName):
|
||||||
outputVideoBitrate = config.get("Transcoder", "outputVideoBitrate")
|
outputVideoBitrate = config.get("Transcoder", "outputVideoBitrate")
|
||||||
outputAudioCodec = config.get("Transcoder", "outputAudioCodec")
|
outputAudioCodec = config.get("Transcoder", "outputAudioCodec")
|
||||||
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate")
|
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate")
|
||||||
|
outputSubtitleCodec = config.get("Transcoder", "outputSubtitleCodec")
|
||||||
|
|
||||||
Logger.info("Checking for files to be transcoded")
|
Logger.info("Checking for files to be transcoded")
|
||||||
final_result = 0 # initialize as successful
|
final_result = 0 # initialize as successful
|
||||||
|
@ -61,7 +62,7 @@ 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', '-c:s', 'copy']
|
command = [ffmpeg, '-i', filePath, '-map', '0']
|
||||||
if outputVideoCodec:
|
if outputVideoCodec:
|
||||||
command.append('-c:v')
|
command.append('-c:v')
|
||||||
command.append(outputVideoCodec)
|
command.append(outputVideoCodec)
|
||||||
|
@ -86,6 +87,11 @@ def Transcode_directory(dirName):
|
||||||
if outputAudioBitrate:
|
if outputAudioBitrate:
|
||||||
command.append('-b:a')
|
command.append('-b:a')
|
||||||
command.append(outputAudioBitrate)
|
command.append(outputAudioBitrate)
|
||||||
|
if outputSubtitleCodec:
|
||||||
|
command.append('-c:s')
|
||||||
|
command.append(outputSubtitleCodec)
|
||||||
|
else:
|
||||||
|
command.append('-sn') # Don't copy the subtitles over
|
||||||
command.append(newfilePath)
|
command.append(newfilePath)
|
||||||
|
|
||||||
Logger.debug("Transcoding video %s to %s", filePath, newfilePath)
|
Logger.debug("Transcoding video %s to %s", filePath, newfilePath)
|
||||||
|
|
|
@ -110,6 +110,7 @@ outputVideoFramerate = 24
|
||||||
outputVideoBitrate = 800k
|
outputVideoBitrate = 800k
|
||||||
outputAudioCodec = libmp3lame
|
outputAudioCodec = libmp3lame
|
||||||
outputAudioBitrate = 128k
|
outputAudioBitrate = 128k
|
||||||
|
outputSubtitleCodec =
|
||||||
|
|
||||||
# Logging configuration
|
# Logging configuration
|
||||||
[loggers]
|
[loggers]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue