Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Nuke: double slate #3521

Merged
merged 6 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 30 additions & 23 deletions openpype/plugins/publish/extract_review_slate.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,62 +285,68 @@ def process(self, instance):
audio_channels,
audio_sample_rate,
audio_channel_layout,
input_frame_rate
)

# replace slate with silent slate for concat
slate_v_path = slate_silent_path

# create ffmpeg concat text file path
conc_text_file = input_file.replace(ext, "") + "_concat" + ".txt"
conc_text_path = os.path.join(
os.path.normpath(stagingdir), conc_text_file)
_remove_at_end.append(conc_text_path)
self.log.debug("__ conc_text_path: {}".format(conc_text_path))

new_line = "\n"
with open(conc_text_path, "w") as conc_text_f:
conc_text_f.writelines([
"file {}".format(
slate_v_path.replace("\\", "/")),
new_line,
"file {}".format(input_path.replace("\\", "/"))
])

# concat slate and videos together
# concat slate and videos together with concat filter
# this will reencode the output
if input_audio:
fmap = [
"-filter_complex",
"[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]",
"-map", '[v]',
"-map", '[a]'
]
else:
fmap = [
"-filter_complex",
"[0:v] [1:v] concat=n=2:v=1:a=0 [v]",
"-map", '[v]'
]
concat_args = [
ffmpeg_path,
"-y",
"-f", "concat",
"-safe", "0",
"-i", conc_text_path,
"-c", "copy",
"-i", slate_v_path,
"-i", input_path,
]
concat_args.extend(fmap)
if offset_timecode:
concat_args.extend(["-timecode", offset_timecode])
# NOTE: Added because of OP Atom demuxers
# Add format arguments if there are any
# - keep format of output
if format_args:
concat_args.extend(format_args)

if codec_args:
concat_args.extend(codec_args)

# Use arguments from ffmpeg preset
source_ffmpeg_cmd = repre.get("ffmpeg_cmd")
if source_ffmpeg_cmd:
copy_args = (
"-metadata",
"-metadata:s:v:0",
"-b:v",
"-b:a",
)
args = source_ffmpeg_cmd.split(" ")
for indx, arg in enumerate(args):
if arg in copy_args:
concat_args.append(arg)
# assumes arg has one parameter
concat_args.append(args[indx + 1])

# add final output path
concat_args.append(output_path)

# ffmpeg concat subprocess
self.log.debug(
"Executing concat: {}".format(" ".join(concat_args))
"Executing concat filter: {}".format
(" ".join(concat_args))
)
openpype.api.run_subprocess(
concat_args, logger=self.log
Expand Down Expand Up @@ -488,9 +494,10 @@ def _create_silent_slate(
audio_channels,
audio_sample_rate,
audio_channel_layout,
input_frame_rate
):
# Get duration of one frame in micro seconds
items = audio_sample_rate.split("/")
items = input_frame_rate.split("/")
if len(items) == 1:
one_frame_duration = 1.0 / float(items[0])
elif len(items) == 2:
Expand Down
1 change: 1 addition & 0 deletions vendor/powershell/BurntToast
Submodule BurntToast added at ae0acd
1 change: 1 addition & 0 deletions vendor/powershell/PSWriteColor
Submodule PSWriteColor added at 12eda3