The package provides functions for performing IO operations. They are currently specific to reading and writing video.

Video, start_pts=0, end_pts=None)[source]

Reads a video from a file, returning both the video frames as well as the audio frames

  • filename (str) – path to the video file

  • start_pts (int, optional) – the start presentation time of the video

  • end_pts (int, optional) – the end presentation time


  • vframes (Tensor[T, H, W, C]) – the T video frames

  • aframes (Tensor[K, L]) – the audio frames, where K is the number of channels and L is the number of points

  • info (Dict) – metadata for the video and audio. Can contain the fields video_fps (float) and audio_fps (int)[source]

List the video frames timestamps.

Note that the function decodes the whole video frame-by-frame.


filename (str) – path to the video file


  • pts (List[int]) – presentation timestamps for each one of the frames in the video.

  • video_fps (int) – the frame rate for the video, video_array, fps, video_codec='libx264', options=None)[source]

Writes a 4d tensor in [T, H, W, C] format in a video file

  • filename (str) – path where the video will be saved

  • video_array (Tensor[T, H, W, C]) – tensor containing the individual frames, as a uint8 tensor in [T, H, W, C] format

  • fps (Number) – frames per second


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources