From 9615f5b75a413c2eb125113ce634c08776cdbf12 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 27 Feb 2019 09:40:23 +0100 Subject: [PATCH] added extrack quicktime to global plugins --- .../global/publish/extract_quicktime.py | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 pype/plugins/global/publish/extract_quicktime.py diff --git a/pype/plugins/global/publish/extract_quicktime.py b/pype/plugins/global/publish/extract_quicktime.py new file mode 100644 index 0000000000..3f1f02c7de --- /dev/null +++ b/pype/plugins/global/publish/extract_quicktime.py @@ -0,0 +1,79 @@ +import os +import pyblish.api +import subprocess +from pype.vendor import clique + + +class ExtractQuicktimeEXR(pyblish.api.InstancePlugin): + """Resolve any dependency issies + + This plug-in resolves any paths which, if not updated might break + the published file. + + The order of families is important, when working with lookdev you want to + first publish the texture, update the texture paths in the nodes and then + publish the shading network. Same goes for file dependent assets. + """ + + label = "Extract Quicktime EXR" + order = pyblish.api.ExtractorOrder + families = ["imagesequence", "render", "write", "source"] + host = ["shell"] + + def process(self, instance): + fps = instance.data.get("fps") + start = instance.data.get("startFrame") + stagingdir = os.path.normpath(instance.data.get("stagingDir")) + + collected_frames = os.listdir(stagingdir) + collections, remainder = clique.assemble(collected_frames) + filename = collections[0].format('{head}') + + input_path = os.path.join( + stagingdir, collections[0].format('{head}{padding}{tail}') + ) + collections[0].format('{head}{padding}{tail}') + self.log.info("input {}".format(input_path)) + single_file_name = ( + collections[0].format('{head}{padding}{tail}') % start + ) + single_input_path = os.path.join(stagingdir, single_file_name) + if not filename.endswith('.'): + filename += "." + movFile = filename + "mov" + jpegFile = filename + "jpg" + full_mov_path = os.path.join(stagingdir, movFile) + full_jpeg_path = os.path.join(stagingdir, jpegFile) + + self.log.info("output {}".format(full_mov_path)) + + subprocess_jpeg = "ffmpeg -y -gamma 2.2 -i {} {}".format( + single_input_path, full_jpeg_path + ) + subprocess.Popen(subprocess_jpeg) + + input_args = [ + "-y -gamma 2.2", + "-i {}".format(input_path), + "-framerate {}".format(fps), + "-start_number {}".format(start) + ] + output_args = [ + "-c:v libx264", + "-vf colormatrix=bt601:bt709", + full_mov_path + ] + + mov_args = [ + "ffmpeg", + " ".join(input_args), + " ".join(output_args) + ] + subprocess_mov = " ".join(mov_args) + self.log.info("Mov args: {}".format(subprocess_mov)) + subprocess.Popen(subprocess_mov) + + if "files" not in instance.data: + instance.data["files"] = list() + # instance.data["files"].append(jpegFile) + instance.data["files"].append(movFile)