jpeg exctractor separated

This commit is contained in:
Jakub Trllo 2019-02-27 12:17:51 +01:00
parent 9615f5b75a
commit c40fa2fc2b
2 changed files with 59 additions and 21 deletions

View file

@ -0,0 +1,51 @@
import os
import pyblish.api
import subprocess
from pype.vendor import clique
class ExtractJpegEXR(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 Jpeg EXR"
order = pyblish.api.ExtractorOrder
families = ["imagesequence", "render", "write", "source"]
host = ["shell"]
def process(self, instance):
start = instance.data.get("startFrame")
stagingdir = os.path.normpath(instance.data.get("stagingDir"))
collected_frames = os.listdir(stagingdir)
collections, remainder = clique.assemble(collected_frames)
input_file = (
collections[0].format('{head}{padding}{tail}') % start
)
full_input_path = os.path.join(stagingdir, input_file)
self.log.info("input {}".format(full_input_path))
filename = collections[0].format('{head}')
if not filename.endswith('.'):
filename += "."
jpegFile = filename + "jpg"
full_output_path = os.path.join(stagingdir, jpegFile)
self.log.info("output {}".format(full_output_path))
subprocess_jpeg = "ffmpeg -y -gamma 2.2 -i {} {}".format(
full_input_path, full_output_path
)
subprocess.Popen(subprocess_jpeg)
if "files" not in instance.data:
instance.data["files"] = list()
instance.data["files"].append(jpegFile)

View file

@ -27,41 +27,30 @@ class ExtractQuicktimeEXR(pyblish.api.InstancePlugin):
collected_frames = os.listdir(stagingdir)
collections, remainder = clique.assemble(collected_frames)
filename = collections[0].format('{head}')
input_path = os.path.join(
full_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)
self.log.info("input {}".format(full_input_path))
filename = collections[0].format('{head}')
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)
full_output_path = os.path.join(stagingdir, movFile)
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)
self.log.info("output {}".format(full_output_path))
input_args = [
"-y -gamma 2.2",
"-i {}".format(input_path),
"-i {}".format(full_input_path),
"-framerate {}".format(fps),
"-start_number {}".format(start)
]
output_args = [
"-c:v libx264",
"-vf colormatrix=bt601:bt709",
full_mov_path
full_output_path
]
mov_args = [
@ -70,10 +59,8 @@ class ExtractQuicktimeEXR(pyblish.api.InstancePlugin):
" ".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)