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.
# outputDefault profiles allowed: iPad, iPad-1080p, iPad-720p, Apple-TV2, iPod, iPhone, PS3, Roku-1080p, Roku-720p, Roku-480p
outputDefault =
# hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg)
hwAccel = 0
#### Define custom settings below.
outputVideoExtension = .mp4
outputVideoCodec = libx264

View file

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

View file

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

View file

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

View file

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

View file

@ -165,6 +165,7 @@ FFMPEG = None
FFPROBE = None
CHECK_MEDIA = None
NICENESS = []
HWACCEL = False
PASSWORDSFILE = None
DOWNLOADINFO = None
@ -192,7 +193,7 @@ def initialize(section=None):
DUPLICATE, IGNOREEXTENSIONS, VEXTENSION, OUTPUTVIDEOPATH, PROCESSOUTPUT, VCODEC, VCODEC_ALLOW, VPRESET, \
VFRAMERATE, LOG_DB, VBITRATE, VRESOLUTION, ALANGUAGE, AINCLUDE, ACODEC, ACODEC_ALLOW, ABITRATE, \
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, \
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, \
@ -425,6 +426,7 @@ def initialize(section=None):
SCODEC = CFG["Transcoder"]["outputSubtitleCodec"].strip()
BURN = int(CFG["Transcoder"]["burnInSubtitle"].strip())
DEFAULTS = CFG["Transcoder"]["outputDefault"].strip()
HWACCEL = int(CFG["Transcoder"]["hwAccel"])
allow_subs = ['.mkv','.mp4', '.m4v', 'asf', 'wma', 'wmv']
codec_alias = {
@ -438,7 +440,7 @@ def initialize(section=None):
'VRESOLUTION':None,'VCODEC_ALLOW':['libx264', 'h264', 'h.264', 'AVC', 'avc', 'mpeg4', 'msmpeg4', 'MPEG-4'],
'ACODEC':'aac','ACODEC_ALLOW':['libfaac'],'ABITRATE':None, 'ACHANNELS':2,
'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'
},
'iPad-1080p':{

View file

@ -304,6 +304,7 @@ def buildCommands(file, newDir):
s_mapped = []
subs1 = []
burnt = 0
n = 0
for lan in nzbtomedia.SLANGUAGES:
try:
subs1 = [ item for item in subStreams if item["tags"]["language"] == lan ]
@ -346,7 +347,12 @@ def buildCommands(file, newDir):
if nzbtomedia.OUTPUTFASTSTART:
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:
filenum = 1
@ -399,7 +405,7 @@ def extract_subs(file, newfilePath, bitbucket):
logger.info("Extracting %s Subtitle from: %s" % (lan, file))
cmd = ""
for item in command:
cmd = cmd + " " + item
cmd = cmd + " " + str(item)
logger.debug("calling command:%s" % (cmd))
result = 1 # set result to failed in case call fails.
try:
@ -445,7 +451,7 @@ def Transcode_directory(dirName):
logger.info("Transcoding video: %s" % (file))
cmd = ""
for item in command:
cmd = cmd + " " + item
cmd = cmd + " " + str(item)
logger.debug("calling command:%s" % (cmd))
result = 1 # set result to failed in case call fails.
try: