docarray.document.mixins.video module#

class docarray.document.mixins.video.VideoDataMixin[source]#

Bases: object

Provide helper functions for Document to support video data.

load_uri_to_video_tensor(only_keyframes=False)[source]#

Convert a uri to a video ndarray tensor.

Parameters

only_keyframes (bool) – only keep the keyframes in the video

Return type

T

Returns

Document itself after processed

save_video_tensor_to_file(file, frame_rate=30, codec='h264')[source]#

Save tensor as a video mp4/h264 file.

Parameters
  • file (Union[str, BinaryIO]) – The file to open, which can be either a string or a file-like object.

  • frame_rate (int) – frames per second

  • codec (str) – the name of a decoder/encoder

Return type

T

Returns

itself after processed