From eac2629fcb27728396dc63b55de00f11cd006408 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 12 Dec 2019 11:26:12 +0100 Subject: [PATCH 1/5] use FFMPEG_PATH environ to get path to ffmpeg and ffprobe --- pype/scripts/otio_burnin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pype/scripts/otio_burnin.py b/pype/scripts/otio_burnin.py index 01dc76aacf..1b2c2a04aa 100644 --- a/pype/scripts/otio_burnin.py +++ b/pype/scripts/otio_burnin.py @@ -9,6 +9,21 @@ from pype import api as pype log = pype.Logger().get_logger("BurninWrapper", "burninwrap") +ffmpeg_path = os.environ.get("FFMPEG_PATH") +if ffmpeg_path and os.path.exists(ffmpeg_path): + # add separator "/" or "\" to be prepared for next part + ffmpeg_path += os.path.sep +else: + ffmpeg_path = "" + +FFMPEG = ( + '{} -loglevel panic -i %(input)s %(filters)s %(args)s%(output)s' +).format(os.path.normpath(ffmpeg_path + "ffmpeg")) +FFPROBE = ( + '{} -v quiet -print_format json -show_format -show_streams %(source)s' +).format(os.path.normpath(ffmpeg_path + "ffprobe")) + + class ModifiedBurnins(ffmpeg_burnins.Burnins): ''' This is modification of OTIO FFmpeg Burnin adapter. From 54c76b3b7f0358e9a8943524d22ce215cd006740 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 12 Dec 2019 11:26:55 +0100 Subject: [PATCH 2/5] copied _streams method from otio adapter to be able to use ffprobe full path --- pype/scripts/otio_burnin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pype/scripts/otio_burnin.py b/pype/scripts/otio_burnin.py index 1b2c2a04aa..dd62c59bec 100644 --- a/pype/scripts/otio_burnin.py +++ b/pype/scripts/otio_burnin.py @@ -1,5 +1,7 @@ import os import datetime +import subprocess +import json import opentimelineio_contrib.adapters.ffmpeg_burnins as ffmpeg_burnins from pypeapp.lib import config from pype import api as pype @@ -24,6 +26,19 @@ FFPROBE = ( ).format(os.path.normpath(ffmpeg_path + "ffprobe")) +def _streams(source): + """Reimplemented from otio burnins to be able use full path to ffprobe + :param str source: source media file + :rtype: [{}, ...] + """ + command = FFPROBE % {'source': source} + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + out = proc.communicate()[0] + if proc.returncode != 0: + raise RuntimeError("Failed to run: %s" % command) + return json.loads(out)['streams'] + + class ModifiedBurnins(ffmpeg_burnins.Burnins): ''' This is modification of OTIO FFmpeg Burnin adapter. From fdf4182155e53f77e25fa32088f3776a9995f8b4 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 12 Dec 2019 11:27:22 +0100 Subject: [PATCH 3/5] replace FFMPEG string in command method --- pype/scripts/otio_burnin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/scripts/otio_burnin.py b/pype/scripts/otio_burnin.py index dd62c59bec..d215bea55e 100644 --- a/pype/scripts/otio_burnin.py +++ b/pype/scripts/otio_burnin.py @@ -217,7 +217,7 @@ class ModifiedBurnins(ffmpeg_burnins.Burnins): if self.filter_string: filters = '-vf "{}"'.format(self.filter_string) - return (ffmpeg_burnins.FFMPEG % { + return (FFMPEG % { 'input': self.source, 'output': output, 'args': '%s ' % args if args else '', @@ -398,7 +398,7 @@ def burnins_from_data(input_path, codec_data, output_path, data, overwrite=True) codec_args = '' if codec_data is not []: codec_args = " ".join(codec_data) - + burnin.render(output_path, args=codec_args, overwrite=overwrite) From 978e05b536debcc928d39376690a14558c25a198 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 12 Dec 2019 11:27:47 +0100 Subject: [PATCH 4/5] get streams before super init in Burnin class is called --- pype/scripts/otio_burnin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pype/scripts/otio_burnin.py b/pype/scripts/otio_burnin.py index d215bea55e..3e8cb3b0c4 100644 --- a/pype/scripts/otio_burnin.py +++ b/pype/scripts/otio_burnin.py @@ -91,6 +91,9 @@ class ModifiedBurnins(ffmpeg_burnins.Burnins): } def __init__(self, source, streams=None, options_init=None): + if not streams: + streams = _streams(source) + super().__init__(source, streams) if options_init: self.options_init.update(options_init) From 6d1b064d0b2593bcdba2914e40b75a2cf820f3fb Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 6 Jan 2020 12:19:56 +0100 Subject: [PATCH 5/5] add previous behaviour as default --- .../ftrack/events/event_version_to_task_statuses.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pype/ftrack/events/event_version_to_task_statuses.py b/pype/ftrack/events/event_version_to_task_statuses.py index 1f5f1514d7..0d2a3130c0 100644 --- a/pype/ftrack/events/event_version_to_task_statuses.py +++ b/pype/ftrack/events/event_version_to_task_statuses.py @@ -62,9 +62,12 @@ class VersionToTaskStatus(BaseEvent): # Lower version status name and check if has mapping version_status = version_status_orig.lower() - new_status_names = status_mapping.get(version_status) - if not new_status_names: - continue + new_status_names = [] + mapped = status_mapping.get(version_status) + if mapped: + new_status_names.extend(list(mapped)) + + new_status_names.append(version_status) self.log.debug( "Processing AssetVersion status change: [ {} ]".format( @@ -72,10 +75,6 @@ class VersionToTaskStatus(BaseEvent): ) ) - # Backwards compatibility (convert string to list) - if isinstance(new_status_names, str): - new_status_names = [new_status_names] - # Lower all names from presets new_status_names = [name.lower() for name in new_status_names]