mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
AYON: 3rd party addon usage (#5300)
* implemented helper functions to get ffmpeg and oiio tool arguments * modified validation functions to be able to handle list of arguments * path getters can return a path in AYON mode if one argument is returned * removed test exception * modified docstrings * is_oiio_supported is using new functions to get launch arguments * new functions are in lib public = * use new functions all over the place * renamed 'ffmpeg_path' to 'ffmpeg_args' * raise 'ToolNotFoundError' if tool argument could not be found * reraise 'KnownPublishError' in publish plugins * fix comment * simplify args start * ffmpeg and oiio function require tool name and support additional arguments * renamed 'get_oiio_tools_args' to 'get_oiio_tool_args' * fix variable name
This commit is contained in:
parent
7b5e716147
commit
d63aa34a76
21 changed files with 302 additions and 198 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
import pyblish.api
|
||||
from openpype.lib import (
|
||||
get_ffmpeg_tool_path,
|
||||
get_oiio_tools_path,
|
||||
get_ffmpeg_tool_args,
|
||||
get_oiio_tool_args,
|
||||
is_oiio_supported,
|
||||
|
||||
run_subprocess,
|
||||
|
|
@ -174,12 +175,11 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
|
||||
def create_thumbnail_oiio(self, src_path, dst_path):
|
||||
self.log.info("Extracting thumbnail {}".format(dst_path))
|
||||
oiio_tool_path = get_oiio_tools_path()
|
||||
oiio_cmd = [
|
||||
oiio_tool_path,
|
||||
oiio_cmd = get_oiio_tool_args(
|
||||
"oiiotool",
|
||||
"-a", src_path,
|
||||
"-o", dst_path
|
||||
]
|
||||
)
|
||||
self.log.debug("running: {}".format(" ".join(oiio_cmd)))
|
||||
try:
|
||||
run_subprocess(oiio_cmd, logger=self.log)
|
||||
|
|
@ -194,27 +194,27 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
|
|||
def create_thumbnail_ffmpeg(self, src_path, dst_path):
|
||||
self.log.info("outputting {}".format(dst_path))
|
||||
|
||||
ffmpeg_path = get_ffmpeg_tool_path("ffmpeg")
|
||||
ffmpeg_path_args = get_ffmpeg_tool_args("ffmpeg")
|
||||
ffmpeg_args = self.ffmpeg_args or {}
|
||||
|
||||
jpeg_items = []
|
||||
jpeg_items.append(path_to_subprocess_arg(ffmpeg_path))
|
||||
# override file if already exists
|
||||
jpeg_items.append("-y")
|
||||
jpeg_items = [
|
||||
subprocess.list2cmdline(ffmpeg_path_args)
|
||||
]
|
||||
# flag for large file sizes
|
||||
max_int = 2147483647
|
||||
jpeg_items.append("-analyzeduration {}".format(max_int))
|
||||
jpeg_items.append("-probesize {}".format(max_int))
|
||||
jpeg_items.extend([
|
||||
"-y",
|
||||
"-analyzeduration", str(max_int),
|
||||
"-probesize", str(max_int),
|
||||
])
|
||||
# use same input args like with mov
|
||||
jpeg_items.extend(ffmpeg_args.get("input") or [])
|
||||
# input file
|
||||
jpeg_items.append("-i {}".format(
|
||||
path_to_subprocess_arg(src_path)
|
||||
))
|
||||
jpeg_items.extend(["-i", path_to_subprocess_arg(src_path)])
|
||||
# output arguments from presets
|
||||
jpeg_items.extend(ffmpeg_args.get("output") or [])
|
||||
# we just want one frame from movie files
|
||||
jpeg_items.append("-vframes 1")
|
||||
jpeg_items.extend(["-vframes", "1"])
|
||||
# output file
|
||||
jpeg_items.append(path_to_subprocess_arg(dst_path))
|
||||
subprocess_command = " ".join(jpeg_items)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue