This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
nks cut reference videos #23
Merged
Merged
Changes from 16 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0e61a2d
feat(nks): colecting timecodes with otio
89e5e72
feat(nks): adding media/clip duration to collect frame ranges
cf01f44
feat(nks): collect review identify if mediaSource needs to be trimed
128719a
feat(nks): improving calculation of fps
eff28c1
Merge branch 'develop' into bugfix/ffmpeg_path_burnin_fix
f394b67
Merge branch 'feature/ffmpeg-devide-long-videos' into feature/PYPE-65…
aa3bfa6
Merge branch 'feature/nuke_studio_publish_review_cut_ffmpeg' into fea…
7884097
Merge branch 'develop' into feature/PYPE-654-nks-cut-reference-videos
bda292a
feat(global): review workflow accepting nks host
b149388
feat(nks): adding plugin for cutting video parts
55b3b41
feat(nks): adjusting collect review for cutting
18f6acc
clean(nks): old way of representation data
ac9a20c
fix(nks): improving data
31a7c44
fix(nks): duration method was wrong
b503870
fix(global): original repre tags are included to preset tags
06fbbd6
Merge branch 'develop' into feature/PYPE-654-nks-cut-reference-videos
jakubjezek001 eba14f8
clean(nks): Hound recomendations
jakubjezek001 fdbb6a3
fix(nks): duplicity in hierarchy tag and not matching names clips
jakubjezek001 7ac7600
Merge branch 'bugfix/129-nks_coupe_small_fixes' into feature/PYPE-654…
jakubjezek001 d4899b6
feat(nks): adding empty black frames at handle start if missing
jakubjezek001 a270c55
fix(nks): collect timecodes not used
jakubjezek001 7d689cf
feat(nks): reediting shorter or longer clips with empty frames
jakubjezek001 8f3f3a4
feat(nks): PR comments
jakubjezek001 4342db7
feat(nks): adding comment making more clear the process
jakubjezek001 0d7ed78
feat(nks): resolving PR comment
jakubjezek001 eb28198
Merge branch 'develop' into feature/PYPE-654-nks-cut-reference-videos
jakubjezek001 77d3611
feat(nks): processing PR comments - better readability
jakubjezek001 aa0ae99
fix(nks): plugin should be in extract order.. previous was for testing
jakubjezek001 cb12a83
feat(nks): only copy codec if source should be shortened
jakubjezek001 1581536
fix(global): integrate didn't understand new Anatomy
jakubjezek001 f1dd4fc
fix(global): integrate swap order of padding request from anatomy
jakubjezek001 59c5f36
fix(nks): frame start was not correctly calculated
jakubjezek001 cb42c78
fix(nks): cutting videos added to own folder `cuts`
jakubjezek001 5bfafb2
fix(nks): don't add copy codec if -filter_complex added into cmd
jakubjezek001 0c5b7b7
Merge branch 'develop' into feature/PYPE-654-nks-cut-reference-videos
jakubjezek001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import pyblish.api | ||
import opentimelineio.opentime as otio_ot | ||
|
||
|
||
class CollectClipTimecodes(pyblish.api.InstancePlugin): | ||
"""Collect time with OpenTimelineIO: source_h(In,Out)[timecode, sec], timeline(In,Out)[timecode, sec]""" | ||
|
||
order = pyblish.api.CollectorOrder + 0.101 | ||
label = "Collect Timecodes" | ||
hosts = ["nukestudio"] | ||
|
||
def process(self, instance): | ||
|
||
data = dict() | ||
self.log.debug("__ instance.data: {}".format(instance.data)) | ||
# Timeline data. | ||
handle_start = instance.data["handleStart"] | ||
handle_end = instance.data["handleEnd"] | ||
|
||
source_in_h = instance.data("sourceInH", | ||
instance.data("sourceIn") - handle_start) | ||
source_out_h = instance.data("sourceOutH", | ||
instance.data("sourceOut") + handle_end) | ||
|
||
timeline_in = instance.data["clipIn"] | ||
timeline_out = instance.data["clipOut"] | ||
|
||
# set frame start with tag or take it from timeline | ||
frame_start = instance.data.get("startingFrame") | ||
|
||
if not frame_start: | ||
frame_start = timeline_in | ||
|
||
source = instance.data.get("source") | ||
|
||
otio_data = dict() | ||
self.log.debug("__ source: `{}`".format(source)) | ||
|
||
rate_fps = instance.context.data["fps"] | ||
|
||
otio_in_h_ratio = otio_ot.RationalTime( | ||
value=(source.timecodeStart() + ( | ||
source_in_h + (source_out_h - source_in_h))), | ||
rate=rate_fps) | ||
|
||
otio_out_h_ratio = otio_ot.RationalTime( | ||
value=(source.timecodeStart() + source_in_h), | ||
rate=rate_fps) | ||
|
||
otio_timeline_in_ratio = otio_ot.RationalTime( | ||
value=int( | ||
instance.data.get("timelineTimecodeStart", 0)) + timeline_in, | ||
rate=rate_fps) | ||
|
||
otio_timeline_out_ratio = otio_ot.RationalTime( | ||
value=int( | ||
instance.data.get("timelineTimecodeStart", 0)) + timeline_out, | ||
rate=rate_fps) | ||
|
||
otio_data.update({ | ||
|
||
"otioClipInHTimecode": otio_ot.to_timecode(otio_in_h_ratio), | ||
|
||
"otioClipOutHTimecode": otio_ot.to_timecode(otio_out_h_ratio), | ||
|
||
"otioClipInHSec": otio_ot.to_seconds(otio_in_h_ratio), | ||
|
||
"otioClipOutHSec": otio_ot.to_seconds(otio_out_h_ratio), | ||
|
||
"otioTimelineInTimecode": otio_ot.to_timecode( | ||
otio_timeline_in_ratio), | ||
|
||
"otioTimelineOutTimecode": otio_ot.to_timecode( | ||
otio_timeline_out_ratio), | ||
|
||
"otioTimelineInSec": otio_ot.to_seconds(otio_timeline_in_ratio), | ||
|
||
"otioTimelineOutSec": otio_ot.to_seconds(otio_timeline_out_ratio) | ||
}) | ||
|
||
data.update({ | ||
"otioData": otio_data, | ||
"sourceTimecodeIn": otio_ot.to_timecode(otio_in_h_ratio), | ||
"sourceTimecodeOut": otio_ot.to_timecode(otio_out_h_ratio), | ||
} | ||
) | ||
instance.data.update(data) | ||
self.log.debug("data: {}".format(instance.data)) |
107 changes: 107 additions & 0 deletions
107
pype/plugins/nukestudio/publish/extract_review_cutup_video.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import os | ||
from pyblish import api | ||
import pype | ||
|
||
|
||
class ExtractReviewCutUpVideo(pype.api.Extractor): | ||
"""Cut up clips from long video file""" | ||
|
||
order = api.ExtractorOrder | ||
# order = api.CollectorOrder + 0.1023 | ||
label = "Extract Review CutUp Video" | ||
hosts = ["nukestudio"] | ||
families = ["review"] | ||
|
||
# presets | ||
tags_addition = [] | ||
|
||
def process(self, instance): | ||
inst_data = instance.data | ||
asset = inst_data['asset'] | ||
|
||
# get representation and loop them | ||
representations = inst_data["representations"] | ||
|
||
ffmpeg_path = pype.lib.get_ffmpeg_tool_path("ffmpeg") | ||
|
||
# filter out mov and img sequences | ||
representations_new = representations[:] | ||
for repre in representations: | ||
input_args = list() | ||
output_args = list() | ||
|
||
tags = repre.get("tags", []) | ||
|
||
if "cut-up" not in tags: | ||
continue | ||
|
||
self.log.debug("__ repre: {}".format(repre)) | ||
|
||
file = repre.get("files") | ||
staging_dir = repre.get("stagingDir") | ||
frame_start = repre.get("frameStart") | ||
frame_end = repre.get("frameEnd") | ||
fps = repre.get("fps") | ||
ext = repre.get("ext") | ||
|
||
new_file_name = "{}_{}".format(asset, file) | ||
|
||
full_input_path = os.path.join( | ||
staging_dir, file) | ||
|
||
full_output_path = os.path.join( | ||
staging_dir, new_file_name) | ||
|
||
self.log.debug("__ full_input_path: {}".format(full_input_path)) | ||
self.log.debug("__ full_output_path: {}".format(full_output_path)) | ||
|
||
input_args.append("-y") | ||
input_args.append("-i {}".format(full_input_path)) | ||
|
||
start_sec = float(frame_start) / fps | ||
input_args.append("-ss {:0.2f}".format(start_sec)) | ||
|
||
output_args.append("-c copy") | ||
duration_sec = float(frame_end - frame_start + 1) / fps | ||
output_args.append("-t {:0.2f}".format(duration_sec)) | ||
|
||
# output filename | ||
output_args.append(full_output_path) | ||
|
||
mov_args = [ | ||
ffmpeg_path, | ||
" ".join(input_args), | ||
" ".join(output_args) | ||
] | ||
subprcs_cmd = " ".join(mov_args) | ||
|
||
# run subprocess | ||
self.log.debug("Executing: {}".format(subprcs_cmd)) | ||
output = pype.api.subprocess(subprcs_cmd) | ||
self.log.debug("Output: {}".format(output)) | ||
|
||
repre_new = { | ||
"files": new_file_name, | ||
"stagingDir": staging_dir, | ||
"frameStart": frame_start, | ||
"frameEnd": frame_end, | ||
"frameStartFtrack": frame_start, | ||
"frameEndFtrack": frame_end, | ||
"step": 1, | ||
"fps": fps, | ||
"name": "cut_up_preview", | ||
"tags": ["cut-up", "review", "delete"] + self.tags_addition, | ||
"ext": ext, | ||
"anatomy_template": "publish" | ||
} | ||
|
||
representations_new.append(repre_new) | ||
|
||
for repre in representations_new: | ||
if ("delete" in repre.get("tags", [])) and ( | ||
"cut_up_preview" not in repre["name"]): | ||
representations_new.remove(repre) | ||
|
||
self.log.debug( | ||
"new representations: {}".format(representations_new)) | ||
instance.data["representations"] = representations_new |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'ExtractReview.process' is too complex (40)
too many blank lines (2)