@@ -117,8 +117,17 @@ class VideoStreamMetadata(StreamMetadata):
117117 or -90 degree rotation, this means width and height are swapped
118118 compared to the raw encoded dimensions in the container.
119119 """
120+ color_primaries : str | None
121+ """Color primaries as reported by FFmpeg. E.g. ``"bt709"``, ``"bt2020"``."""
122+ color_space : str | None
123+ """Color space as reported by FFmpeg. E.g. ``"bt709"``,
124+ ``"bt2020nc"``."""
125+ color_transfer_characteristic : str | None
126+ """Color transfer characteristic as reported by FFmpeg
127+ E.g. ``"bt709"``, ``"smpte2084"`` (PQ), ``"arib-std-b67"`` (HLG)."""
120128 pixel_format : str | None
121- """The source pixel format of the video, as reported by FFmpeg. E.g. ``'yuv420p'``, ``'yuv444p'``, etc."""
129+ """The source pixel format of the video as reported by FFmpeg.
130+ E.g. ``'yuv420p'``, ``'yuv444p'``, etc."""
122131
123132 # Computed fields (computed in C++ with fallback logic)
124133 end_stream_seconds : float | None
@@ -245,6 +254,11 @@ def get_container_metadata(decoder: torch.Tensor) -> ContainerMetadata:
245254 average_fps_from_header = stream_dict .get ("averageFpsFromHeader" ),
246255 pixel_aspect_ratio = _get_optional_par_fraction (stream_dict ),
247256 rotation = stream_dict .get ("rotation" ),
257+ color_primaries = stream_dict .get ("colorPrimaries" ),
258+ color_space = stream_dict .get ("colorSpace" ),
259+ color_transfer_characteristic = stream_dict .get (
260+ "colorTransferCharacteristic"
261+ ),
248262 pixel_format = stream_dict .get ("pixelFormat" ),
249263 ** common_meta ,
250264 )
0 commit comments