mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-14 17:22:53 -07:00
Merge pull request #106 from nightexcessive/master
Always transcode all streams of a file
This commit is contained in:
commit
aa6f29968f
3 changed files with 34 additions and 13 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1 +1,6 @@
|
||||||
autoProcessMedia.cfg
|
autoProcessMedia.cfg
|
||||||
|
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
|
||||||
|
postprocess.log
|
||||||
|
|
|
@ -39,13 +39,17 @@ def Transcode_directory(dirName):
|
||||||
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
|
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
|
||||||
duplicate = int(config.get("Transcoder", "duplicate"))
|
duplicate = int(config.get("Transcoder", "duplicate"))
|
||||||
ignoreExtensions = (config.get("Transcoder", "ignoreExtensions")).split(',')
|
ignoreExtensions = (config.get("Transcoder", "ignoreExtensions")).split(',')
|
||||||
outputVideoExtension = config.get("Transcoder", "outputVideoExtension")
|
outputVideoExtension = config.get("Transcoder", "outputVideoExtension").strip()
|
||||||
outputVideoCodec = config.get("Transcoder", "outputVideoCodec")
|
outputVideoCodec = config.get("Transcoder", "outputVideoCodec").strip()
|
||||||
outputVideoPreset = config.get("Transcoder", "outputVideoPreset")
|
outputVideoPreset = config.get("Transcoder", "outputVideoPreset").strip()
|
||||||
outputVideoFramerate = config.get("Transcoder", "outputVideoFramerate")
|
outputVideoFramerate = config.get("Transcoder", "outputVideoFramerate").strip()
|
||||||
outputVideoBitrate = config.get("Transcoder", "outputVideoBitrate")
|
outputVideoBitrate = config.get("Transcoder", "outputVideoBitrate").strip()
|
||||||
outputAudioCodec = config.get("Transcoder", "outputAudioCodec")
|
outputAudioCodec = config.get("Transcoder", "outputAudioCodec").strip()
|
||||||
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate")
|
outputAudioBitrate = config.get("Transcoder", "outputAudioBitrate").strip()
|
||||||
|
outputSubtitleCodec = config.get("Transcoder", "outputSubtitleCodec").strip()
|
||||||
|
|
||||||
|
map(lambda ext: ext.strip(), mediaContainer)
|
||||||
|
map(lambda ext: ext.strip(), ignoreExtensions)
|
||||||
|
|
||||||
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,25 +65,36 @@ 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]
|
command = [ffmpeg, '-i', filePath, '-map', '0']
|
||||||
if outputVideoCodec:
|
if len(outputVideoCodec) > 0:
|
||||||
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)
|
||||||
if outputVideoFramerate:
|
else:
|
||||||
|
command.append('-c:v')
|
||||||
|
command.append('copy')
|
||||||
|
if len(outputVideoFramerate) > 0:
|
||||||
command.append('-r')
|
command.append('-r')
|
||||||
command.append(outputVideoFramerate)
|
command.append(outputVideoFramerate)
|
||||||
if outputVideoBitrate:
|
if len(outputVideoBitrate) > 0:
|
||||||
command.append('-b:v')
|
command.append('-b:v')
|
||||||
command.append(outputVideoBitrate)
|
command.append(outputVideoBitrate)
|
||||||
if outputAudioCodec:
|
if len(outputAudioCodec) > 0:
|
||||||
command.append('-c:a')
|
command.append('-c:a')
|
||||||
command.append(outputAudioCodec)
|
command.append(outputAudioCodec)
|
||||||
if outputAudioBitrate:
|
else:
|
||||||
|
command.append('-c:a')
|
||||||
|
command.append('copy')
|
||||||
|
if len(outputAudioBitrate) > 0:
|
||||||
command.append('-b:a')
|
command.append('-b:a')
|
||||||
command.append(outputAudioBitrate)
|
command.append(outputAudioBitrate)
|
||||||
|
if len(outputSubtitleCodec) > 0:
|
||||||
|
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