replace convert_for_ffmpeg with new function

This commit is contained in:
Jakub Trllo 2022-04-20 14:41:03 +02:00
parent 0dd46fe513
commit 91d2eb7355
5 changed files with 25 additions and 24 deletions

View file

@ -8,7 +8,7 @@ from openpype.lib import (
run_subprocess,
get_transcode_temp_directory,
convert_for_ffmpeg,
convert_input_paths_for_ffmpeg,
should_convert_for_ffmpeg
)
@ -59,11 +59,9 @@ class ExtractThumbnail(pyblish.api.InstancePlugin):
if do_convert:
convert_dir = get_transcode_temp_directory()
filename = os.path.basename(full_input_path)
convert_for_ffmpeg(
full_input_path,
convert_input_paths_for_ffmpeg(
[full_input_path],
convert_dir,
None,
None,
self.log
)
full_input_path = os.path.join(convert_dir, filename)

View file

@ -105,6 +105,7 @@ from .transcoding import (
get_transcode_temp_directory,
should_convert_for_ffmpeg,
convert_for_ffmpeg,
convert_input_paths_for_ffmpeg,
get_ffprobe_data,
get_ffprobe_streams,
get_ffmpeg_codec_args,
@ -276,6 +277,7 @@ __all__ = [
"get_transcode_temp_directory",
"should_convert_for_ffmpeg",
"convert_for_ffmpeg",
"convert_input_paths_for_ffmpeg",
"get_ffprobe_data",
"get_ffprobe_streams",
"get_ffmpeg_codec_args",

View file

@ -16,7 +16,7 @@ from openpype.lib import (
run_openpype_process,
get_transcode_temp_directory,
convert_for_ffmpeg,
convert_input_paths_for_ffmpeg,
should_convert_for_ffmpeg,
CREATE_NO_WINDOW
@ -187,8 +187,13 @@ class ExtractBurnin(openpype.api.Extractor):
repre_files = repre["files"]
if isinstance(repre_files, (tuple, list)):
filename = repre_files[0]
src_filepaths = [
os.path.join(src_repre_staging_dir, filename)
for filename in repre_files
]
else:
filename = repre_files
src_filepaths = [os.path.join(src_repre_staging_dir, filename)]
first_input_path = os.path.join(src_repre_staging_dir, filename)
# Determine if representation requires pre conversion for ffmpeg
@ -209,11 +214,9 @@ class ExtractBurnin(openpype.api.Extractor):
new_staging_dir = get_transcode_temp_directory()
repre["stagingDir"] = new_staging_dir
convert_for_ffmpeg(
first_input_path,
convert_input_paths_for_ffmpeg(
src_filepaths,
new_staging_dir,
_temp_data["frameStart"],
_temp_data["frameEnd"],
self.log
)

View file

@ -8,7 +8,7 @@ from openpype.lib import (
path_to_subprocess_arg,
get_transcode_temp_directory,
convert_for_ffmpeg,
convert_input_paths_for_ffmpeg,
should_convert_for_ffmpeg
)
@ -79,11 +79,9 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin):
if do_convert:
convert_dir = get_transcode_temp_directory()
filename = os.path.basename(full_input_path)
convert_for_ffmpeg(
full_input_path,
convert_input_paths_for_ffmpeg(
[full_input_path],
convert_dir,
None,
None,
self.log
)
full_input_path = os.path.join(convert_dir, filename)

View file

@ -18,7 +18,7 @@ from openpype.lib import (
path_to_subprocess_arg,
should_convert_for_ffmpeg,
convert_for_ffmpeg,
convert_input_paths_for_ffmpeg,
get_transcode_temp_directory
)
import speedcopy
@ -194,16 +194,20 @@ class ExtractReview(pyblish.api.InstancePlugin):
src_repre_staging_dir = repre["stagingDir"]
# Receive filepath to first file in representation
first_input_path = None
input_filepaths = []
if not self.input_is_sequence(repre):
first_input_path = os.path.join(
src_repre_staging_dir, repre["files"]
)
input_filepaths.append(first_input_path)
else:
for filename in repre["files"]:
first_input_path = os.path.join(
filepath = os.path.join(
src_repre_staging_dir, filename
)
break
input_filepaths.append(filepath)
if first_input_path is None:
first_input_path = filepath
# Skip if file is not set
if first_input_path is None:
@ -230,13 +234,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
new_staging_dir = get_transcode_temp_directory()
repre["stagingDir"] = new_staging_dir
frame_start = instance.data["frameStart"]
frame_end = instance.data["frameEnd"]
convert_for_ffmpeg(
first_input_path,
convert_input_paths_for_ffmpeg(
input_filepaths,
new_staging_dir,
frame_start,
frame_end,
self.log
)