-
Notifications
You must be signed in to change notification settings - Fork 394
/
Copy pathcheck_video.py
86 lines (68 loc) · 3.02 KB
/
check_video.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from __future__ import annotations
import os
from argparse import Namespace
from uuid import uuid4
import rerun as rr
import rerun.blueprint as rrb
README = """\
# Video support
Known issues:
* TODO(#8073): The last frame of the video is not working, so you might need to go back a couple of frames.
Make sure video plays on all views unless lack of support is mentioned:
* `AV1` is expected to work on web & release version native.
(In debug native this should inform that it is not supported in debug.)
* `AV1 frustum` should work if `AV1 video` works, showing a frustum with a video.
* `H.264` should work on web & native. On native this may complain about missing ffmpeg. If so, selecting it should inform you how to fix this.
* `H.265` should work on Chrome & Safari. Firefox does not support it.
* `VP9` works only on web, on native this should inform that the codec is not supported.
"""
def run(args: Namespace) -> None:
rr.script_setup(args, f"{os.path.basename(__file__)}", recording_id=uuid4())
rr.log("readme", rr.TextDocument(README, media_type=rr.MediaType.MARKDOWN), static=True)
for codec in ["av1", "h264", "h265", "vp9"]:
# Log video asset which is referred to by frame references.
video_path = os.path.dirname(__file__) + f"/../../../tests/assets/video/Big_Buck_Bunny_1080_10s_{codec}.mp4"
video_asset = rr.AssetVideo(path=video_path)
rr.log(codec, video_asset, static=True)
# Send automatically determined video frame timestamps.
frame_timestamps_ns = video_asset.read_frame_timestamps_ns()
rr.send_columns(
codec,
# Note timeline values don't have to be the same as the video timestamps.
indexes=[rr.TimeNanosColumn("video_time", frame_timestamps_ns)],
columns=rr.VideoFrameReference.columns_nanoseconds(frame_timestamps_ns),
)
# Use the av1 also in a 3D context
rr.log(
"av1",
rr.Transform3D(
translation=[10, 0, 0],
),
static=True, # Static, so it shows up in the "video_time" timeline!
)
rr.log(
"av1",
rr.Pinhole(
resolution=[1920, 1080],
focal_length=1920,
camera_xyz=rr.ViewCoordinates.RBU,
),
static=True, # Static, so it shows up in the "video_time" timeline!
)
blueprint = rrb.Blueprint(
rrb.Grid(
rrb.TextDocumentView(origin="readme", name="Instructions"),
rrb.Spatial3DView(origin="/", name="AV1 frustum", contents="av1"),
rrb.Spatial2DView(origin="av1", name="AV1"),
rrb.Spatial2DView(origin="h264", name="H.264"),
rrb.Spatial2DView(origin="h265", name="H.265"),
rrb.Spatial2DView(origin="vp9", name="VP9"),
),
)
rr.send_blueprint(blueprint, make_active=True, make_default=True)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Interactive release checklist")
rr.script_add_args(parser)
args = parser.parse_args()
run(args)