Merge pull request #1072 from ynput/bugfix/fix_legacy_sequence_range_detection

Fix OTIO remap with image sequence wrongly detected as legacy.
This commit is contained in:
Robin De Lillo 2025-01-10 12:34:31 +01:00 committed by GitHub
commit 73e979d7a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 97 additions and 16 deletions

View file

@ -231,10 +231,13 @@ def remap_range_on_file_sequence(otio_clip, in_out_range):
# source range for image sequence. Following code maintain
# backward-compatibility by adjusting media_in
# while we are updating those.
conformed_src_in = source_range.start_time.rescaled_to(
available_range_rate
)
if (
is_clip_from_media_sequence(otio_clip)
and available_range_start_frame == media_ref.start_frame
and source_range.start_time.to_frames() < media_ref.start_frame
and conformed_src_in.to_frames() < media_ref.start_frame
):
media_in = 0
@ -261,21 +264,6 @@ def get_media_range_with_retimes(otio_clip, handle_start, handle_end):
media_ref = otio_clip.media_reference
is_input_sequence = is_clip_from_media_sequence(otio_clip)
# Temporary.
# Some AYON custom OTIO exporter were implemented with relative
# source range for image sequence. Following code maintain
# backward-compatibility by adjusting available range
# while we are updating those.
if (
is_input_sequence
and available_range.start_time.to_frames() == media_ref.start_frame
and source_range.start_time.to_frames() < media_ref.start_frame
):
available_range = _ot.TimeRange(
_ot.RationalTime(0, rate=available_range_rate),
available_range.duration,
)
# Conform source range bounds to available range rate
# .e.g. embedded TC of (3600 sec/ 1h), duration 100 frames
#
@ -320,6 +308,22 @@ def get_media_range_with_retimes(otio_clip, handle_start, handle_end):
else:
conformed_source_range = source_range
# Temporary.
# Some AYON custom OTIO exporter were implemented with relative
# source range for image sequence. Following code maintain
# backward-compatibility by adjusting available range
# while we are updating those.
if (
is_input_sequence
and available_range.start_time.to_frames() == media_ref.start_frame
and conformed_source_range.start_time.to_frames() <
media_ref.start_frame
):
available_range = _ot.TimeRange(
_ot.RationalTime(0, rate=available_range_rate),
available_range.duration,
)
# modifiers
time_scalar = 1.
offset_in = 0

View file

@ -0,0 +1,51 @@
{
"OTIO_SCHEMA": "Clip.2",
"metadata": {},
"name": "",
"source_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 23.976,
"value": 108.0
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 23.976,
"value": 883159.0
}
},
"effects": [],
"markers": [],
"enabled": true,
"media_references": {
"DEFAULT_MEDIA": {
"OTIO_SCHEMA": "ImageSequenceReference.1",
"metadata": {},
"name": "",
"available_range": {
"OTIO_SCHEMA": "TimeRange.1",
"duration": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 755.0
},
"start_time": {
"OTIO_SCHEMA": "RationalTime.1",
"rate": 24.0,
"value": 883750.0
}
},
"available_image_bounds": null,
"target_url_base": "/mnt/jobs/yahoo_theDog_1132/IN/FOOTAGE/SCANS_LINEAR/Panasonic Rec 709 to ACESCG/Panasonic P2 /A001_S001_S001_T004/",
"name_prefix": "A001_S001_S001_T004.",
"name_suffix": ".exr",
"start_frame": 883750,
"frame_step": 1,
"rate": 1.0,
"frame_zero_padding": 0,
"missing_frame_policy": "error"
}
},
"active_media_reference_key": "DEFAULT_MEDIA"
}

View file

@ -187,3 +187,29 @@ def test_img_sequence_conform_to_23_976fps():
handle_start=0,
handle_end=8,
)
def test_img_sequence_conform_from_24_to_23_976fps():
"""
Img sequence clip
available files = 883750-884504 24fps
source_range = 883159-883267 23.976fps
This test ensures such entries do not trigger
the legacy Hiero export compatibility.
"""
expected_data = {
'mediaIn': 884043,
'mediaOut': 884150,
'handleStart': 0,
'handleEnd': 0,
'speed': 1.0
}
_check_expected_retimed_values(
"img_seq_24_to_23.976_no_legacy.json",
expected_data,
handle_start=0,
handle_end=0,
)