From fd1149aea1e0b1e524d821900d586c05bc9ce639 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Thu, 6 Jun 2019 21:46:56 +1200 Subject: [PATCH] add additional options to pass into ffmpeg. #1619 --- autoProcessMedia.cfg.spec | 4 +++- core/__init__.py | 7 +++++++ core/transcoder.py | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/autoProcessMedia.cfg.spec b/autoProcessMedia.cfg.spec index 6829d6b2..7969831d 100644 --- a/autoProcessMedia.cfg.spec +++ b/autoProcessMedia.cfg.spec @@ -414,8 +414,10 @@ externalSubDir = # hwAccel. 1 will set ffmpeg to enable hardware acceleration (this requires a recent ffmpeg) hwAccel = 0 - # generalOptions. Enter your additional ffmpeg options here with commas to separate each option/value (i.e replace spaces with commas). + # generalOptions. Enter your additional ffmpeg options (these insert before the '-i' input files) here with commas to separate each option/value (i.e replace spaces with commas). generalOptions = + # otherOptions. Enter your additional ffmpeg options (these insert after the '-i' input files and before the output file) here with commas to separate each option/value (i.e replace spaces with commas). + otherOptions = # outputDefault. Loads default configs for the selected device. The remaining options below are ignored. # 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, xbox, Roku-1080p, Roku-720p, Roku-480p, mkv, mkv-bluray, mp4-scene-release diff --git a/core/__init__.py b/core/__init__.py index 7fb32140..b3c643fb 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -211,6 +211,7 @@ VEXTENSION = None OUTPUTVIDEOPATH = None PROCESSOUTPUT = False GENERALOPTS = [] +OTHEROPTS = [] ALANGUAGE = None AINCLUDE = False SLANGUAGES = [] @@ -513,6 +514,7 @@ def configure_transcoder(): global IGNOREEXTENSIONS global OUTPUTFASTSTART global GENERALOPTS + global OTHEROPTS global OUTPUTQUALITYPERCENT global OUTPUTVIDEOPATH global PROCESSOUTPUT @@ -568,6 +570,11 @@ def configure_transcoder(): GENERALOPTS.append('-fflags') if '+genpts' not in GENERALOPTS: GENERALOPTS.append('+genpts') + OTHEROPTS = (CFG['Transcoder']['otherOptions']) + if isinstance(OTHEROPTS, str): + OTHEROPTS = OTHEROPTS.split(',') + if OTHEROPTS == ['']: + OTHEROPTS = [] try: OUTPUTQUALITYPERCENT = int(CFG['Transcoder']['outputQualityPercent']) except Exception: diff --git a/core/transcoder.py b/core/transcoder.py index e1850de2..fcbeb43f 100644 --- a/core/transcoder.py +++ b/core/transcoder.py @@ -493,6 +493,8 @@ def build_commands(file, new_dir, movie_name, bitbucket): if core.OUTPUTFASTSTART: other_cmd.extend(['-movflags', '+faststart']) + if core.OTHEROPTS: + other_cmd.extend(core.OTHEROPTS) command = [core.FFMPEG, '-loglevel', 'warning']