From bec783fecf742355d73831446e572597678ffeca Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Wed, 30 Jul 2014 19:06:46 +0200 Subject: [PATCH 1/3] Fix transcoding runtime errors. --- nzbtomedia/__init__.py | 2 +- nzbtomedia/transcoder/transcoder.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nzbtomedia/__init__.py b/nzbtomedia/__init__.py index 23f7eba2..599f3c6d 100644 --- a/nzbtomedia/__init__.py +++ b/nzbtomedia/__init__.py @@ -438,7 +438,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':{ diff --git a/nzbtomedia/transcoder/transcoder.py b/nzbtomedia/transcoder/transcoder.py index 41d14d50..9e901470 100644 --- a/nzbtomedia/transcoder/transcoder.py +++ b/nzbtomedia/transcoder/transcoder.py @@ -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 ] @@ -399,7 +400,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 +446,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: From 5d39d27367724614b56dc7c8c63389e852311de3 Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Wed, 30 Jul 2014 19:26:39 +0200 Subject: [PATCH 2/3] Add hardware acceleration toggle for recent ffmpeg versions --- autoProcessMedia.cfg.spec | 4 +++- nzbtomedia/__init__.py | 4 +++- nzbtomedia/transcoder/transcoder.py | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/autoProcessMedia.cfg.spec b/autoProcessMedia.cfg.spec index c80ae401..5a0768b0 100644 --- a/autoProcessMedia.cfg.spec +++ b/autoProcessMedia.cfg.spec @@ -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 @@ -346,4 +348,4 @@ [passwords] # enter the full path to a text file containing passwords to be used for extraction attempts. # In the passwords file, every password should be on a new line - PassWordFile = \ No newline at end of file + PassWordFile = diff --git a/nzbtomedia/__init__.py b/nzbtomedia/__init__.py index 599f3c6d..56348961 100644 --- a/nzbtomedia/__init__.py +++ b/nzbtomedia/__init__.py @@ -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 = { diff --git a/nzbtomedia/transcoder/transcoder.py b/nzbtomedia/transcoder/transcoder.py index 9e901470..cfbc7bba 100644 --- a/nzbtomedia/transcoder/transcoder.py +++ b/nzbtomedia/transcoder/transcoder.py @@ -347,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 From 74515f78a919c11870acdd113c5539215b08b7a8 Mon Sep 17 00:00:00 2001 From: Roderick van Domburg Date: Wed, 30 Jul 2014 20:08:15 +0200 Subject: [PATCH 3/3] Add NZBGet documentation --- nzbToCouchPotato.py | 5 +++++ nzbToMedia.py | 5 +++++ nzbToNzbDrone.py | 5 +++++ nzbToSickBeard.py | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/nzbToCouchPotato.py b/nzbToCouchPotato.py index 2abeefd1..ade62778 100755 --- a/nzbToCouchPotato.py +++ b/nzbToCouchPotato.py @@ -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 diff --git a/nzbToMedia.py b/nzbToMedia.py index 661e383a..be837c09 100755 --- a/nzbToMedia.py +++ b/nzbToMedia.py @@ -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 diff --git a/nzbToNzbDrone.py b/nzbToNzbDrone.py index d671c8c8..e8c5e526 100755 --- a/nzbToNzbDrone.py +++ b/nzbToNzbDrone.py @@ -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 diff --git a/nzbToSickBeard.py b/nzbToSickBeard.py index e12a6051..3479c4c8 100755 --- a/nzbToSickBeard.py +++ b/nzbToSickBeard.py @@ -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