Merge pull request #507 from roderickvd/nightly

Fix transcoding runtime errors and add ffmpeg hardware acceleration
This commit is contained in:
Clinton Hall 2014-07-31 06:55:42 +09:30
commit 9df24e1705
7 changed files with 36 additions and 6 deletions

View file

@ -280,6 +280,8 @@
# If you want to use your own profile, leave this blank and set the remaining options below. # If you want to use your own profile, leave this blank and set the remaining options below.
# outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p # outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p
outputDefault = outputDefault =
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg)
hwAccel = 0
#### Define custom settings below. #### Define custom settings below.
outputVideoExtension = .mp4 outputVideoExtension = .mp4
outputVideoCodec = libx264 outputVideoCodec = libx264

View file

@ -195,6 +195,11 @@
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.
#outputDefault=None #outputDefault=None
# hwAccel (0,1).
#
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg).
#hwAccel=0
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264

View file

@ -391,6 +391,11 @@
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.
#outputDefault=None #outputDefault=None
# hwAccel (0,1).
#
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg).
#hwAccel=0
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264

View file

@ -185,6 +185,11 @@
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.
#outputDefault = None #outputDefault = None
# hwAccel (0,1).
#
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg).
#hwAccel=0
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264

View file

@ -203,6 +203,11 @@
# If you want to use your own profile, set None and set the remaining options below. # If you want to use your own profile, set None and set the remaining options below.
#outputDefault=None #outputDefault=None
# hwAccel (0,1).
#
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg).
#hwAccel=0
# ffmpeg output settings. # ffmpeg output settings.
#outputVideoExtension=.mp4 #outputVideoExtension=.mp4
#outputVideoCodec=libx264 #outputVideoCodec=libx264

View file

@ -165,6 +165,7 @@ FFMPEG = None
FFPROBE = None FFPROBE = None
CHECK_MEDIA = None CHECK_MEDIA = None
NICENESS = [] NICENESS = []
HWACCEL = False
PASSWORDSFILE = None PASSWORDSFILE = None
DOWNLOADINFO = None DOWNLOADINFO = None
@ -192,7 +193,7 @@ def initialize(section=None):
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \ DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
VFRAMERATE, LOG_DB, VBITRATE, VRESOLUTION, ALANGUAGE, AINCLUDE, ACODEC, ACODEC_ALLOW, ABITRATE, \ VFRAMERATE, LOG_DB, VBITRATE, VRESOLUTION, ALANGUAGE, AINCLUDE, ACODEC, ACODEC_ALLOW, ABITRATE, \
ACODEC2, ACODEC2_ALLOW, ABITRATE2, ACODEC3, ACODEC3_ALLOW, ABITRATE3, ALLOWSUBS, SEXTRACT, SEMBED, SLANGUAGES, \ ACODEC2, ACODEC2_ALLOW, ABITRATE2, ACODEC3, ACODEC3_ALLOW, ABITRATE3, ALLOWSUBS, SEXTRACT, SEMBED, SLANGUAGES, \
SINCLUDE, SUBSDIR, SCODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, BURN, GETSUBS, \ SINCLUDE, SUBSDIR, SCODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, BURN, GETSUBS, HWACCEL, \
NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \ NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \
DELETE_ORIGINAL, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \ DELETE_ORIGINAL, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, CHECK_MEDIA, SAFE_MODE, \ USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, CHECK_MEDIA, SAFE_MODE, \
@ -425,6 +426,7 @@ def initialize(section=None):
SCODEC = CFG["Transcoder"]["outputSubtitleCodec"].strip() SCODEC = CFG["Transcoder"]["outputSubtitleCodec"].strip()
BURN = int(CFG["Transcoder"]["burnInSubtitle"].strip()) BURN = int(CFG["Transcoder"]["burnInSubtitle"].strip())
DEFAULTS = CFG["Transcoder"]["outputDefault"].strip() DEFAULTS = CFG["Transcoder"]["outputDefault"].strip()
HWACCEL = int(CFG["Transcoder"]["hwAccel"])
allow_subs = ['.mkv','.mp4', '.m4v', 'asf', 'wma', 'wmv'] allow_subs = ['.mkv','.mp4', '.m4v', 'asf', 'wma', 'wmv']
codec_alias = { codec_alias = {
@ -438,7 +440,7 @@ def initialize(section=None):
'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'], 'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'],
'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2, 'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2,
'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6, 'ACODEC2':'ac3','ACODEC2_ALLOW':['ac3'],'ABITRATE2':None, 'ACHANNELS2':6,
'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS':None, 'ACODEC3':None,'ACODEC3_ALLOW':[],'ABITRATE3':None, 'ACHANNELS3':None,
'SCODEC':'mov_text' 'SCODEC':'mov_text'
}, },
'iPad-1080p':{ 'iPad-1080p':{

View file

@ -304,6 +304,7 @@ def buildCommands(file, newDir):
s_mapped = [] s_mapped = []
subs1 = [] subs1 = []
burnt = 0 burnt = 0
n = 0
for lan in nzbtomedia.SLANGUAGES: for lan in nzbtomedia.SLANGUAGES:
try: try:
subs1 = [ item for item in subStreams if item["tags"]["language"] == lan ] subs1 = [ item for item in subStreams if item["tags"]["language"] == lan ]
@ -346,7 +347,12 @@ def buildCommands(file, newDir):
if nzbtomedia.OUTPUTFASTSTART: if nzbtomedia.OUTPUTFASTSTART:
other_cmd.extend(['-movflags', '+faststart']) other_cmd.extend(['-movflags', '+faststart'])
command = [nzbtomedia.FFMPEG, '-loglevel', 'warning', '-i', file] command = [nzbtomedia.FFMPEG, '-loglevel', 'warning']
if nzbtomedia.HWACCEL:
command.extend(['-hwaccel', 'auto'])
command.extend([ '-i', file])
if nzbtomedia.SEMBED: if nzbtomedia.SEMBED:
filenum = 1 filenum = 1
@ -399,7 +405,7 @@ def extract_subs(file, newfilePath, bitbucket):
logger.info("Extracting %s Subtitle from: %s" % (lan, file)) logger.info("Extracting %s Subtitle from: %s" % (lan, file))
cmd = "" cmd = ""
for item in command: for item in command:
cmd = cmd + " " + item cmd = cmd + " " + str(item)
logger.debug("calling command:%s" % (cmd)) logger.debug("calling command:%s" % (cmd))
result = 1 # set result to failed in case call fails. result = 1 # set result to failed in case call fails.
try: try:
@ -445,7 +451,7 @@ def Transcode_directory(dirName):
logger.info("Transcoding video: %s" % (file)) logger.info("Transcoding video: %s" % (file))
cmd = "" cmd = ""
for item in command: for item in command:
cmd = cmd + " " + item cmd = cmd + " " + str(item)
logger.debug("calling command:%s" % (cmd)) logger.debug("calling command:%s" % (cmd))
result = 1 # set result to failed in case call fails. result = 1 # set result to failed in case call fails.
try: try: