OTIO output is valid JSON with a Timeline.1 schema and one Clip.2 per scene per track.
(tmp_path: Path)
| 449 | |
| 450 | |
| 451 | def test_write_scene_list_otio(tmp_path: Path): |
| 452 | """OTIO output is valid JSON with a Timeline.1 schema and one Clip.2 per scene per track.""" |
| 453 | scenes = _fake_scenes(_FPS_NTSC, [(24, 72), (72, 120)]) |
| 454 | output_path = tmp_path / "scenes.otio" |
| 455 | write_scene_list_otio( |
| 456 | output_path=output_path, |
| 457 | scene_list=scenes, |
| 458 | video_path=tmp_path / "clip.mp4", |
| 459 | frame_rate=_FPS_NTSC, |
| 460 | name="my-timeline", |
| 461 | ) |
| 462 | |
| 463 | doc = json.loads(output_path.read_text()) |
| 464 | assert doc["OTIO_SCHEMA"] == "Timeline.1" |
| 465 | assert doc["name"] == "my-timeline" |
| 466 | assert doc["global_start_time"]["rate"] == pytest.approx(float(_FPS_NTSC)) |
| 467 | |
| 468 | tracks = doc["tracks"]["children"] |
| 469 | # Default `audio=True` yields both a video and an audio track. |
| 470 | assert [t["kind"] for t in tracks] == ["Video", "Audio"] |
| 471 | for track in tracks: |
| 472 | assert len(track["children"]) == len(scenes) |
| 473 | for clip in track["children"]: |
| 474 | assert clip["OTIO_SCHEMA"] == "Clip.2" |
| 475 | ref = clip["media_references"]["DEFAULT_MEDIA"] |
| 476 | assert ref["OTIO_SCHEMA"] == "ExternalReference.1" |
| 477 | assert Path(ref["target_url"]).is_absolute() |
| 478 | |
| 479 | |
| 480 | def test_write_scene_list_otio_no_audio(tmp_path: Path): |
nothing calls this directly
no test coverage detected