Module torchvid

Class ImageFrame

ImageFrame:to_byte_tensor () Copies video frame pixel data into a torch.ByteTensor.
ImageFrame:to_float_tensor () Copies video frame pixel data into a torch.FloatTensor.
ImageFrame:timestamp () Get the timestamp of this image frame (in seconds).

Class Video

Video.new (path) Creates a new Video.
Video:duration () Get the duration of the video in seconds.
Video:guess_image_frame_rate () Guess the average frame rate of the video in FPS.
Video:get_image_frame_count () Get the number of image frames in the video.
Video:filter (pixel_format_name[, filterchain='null']) Apply a filterchain to the video.
Video:next_image_frame () Read the next video frame from the video.
Video:seek (seek_target) Seek to the first keyframe before the frame number specified.


Class ImageFrame

ImageFrame:to_byte_tensor ()
Copies video frame pixel data into a torch.ByteTensor.

Returns:

    torch.ByteTensor A tensor representation of the pixel data.
ImageFrame:to_float_tensor ()
Copies video frame pixel data into a torch.FloatTensor.

For most pixel formats, this means that all channels will contain values between 0 and 1. If the pixel format is YUV, the chroma channels will contain values between -1 and 1.

Returns:

    torch.FloatTensor A tensor representation of the pixel data.
ImageFrame:timestamp ()
Get the timestamp of this image frame (in seconds).

Returns:

    number The timestamp (in seconds).

Class Video

Video.new (path)
Creates a new Video.

Parameters:

  • path string Absolute or relative path to a video file.

Returns:

    Video
Video:duration ()
Get the duration of the video in seconds.

Returns:

    number The duration of the video in seconds.
Video:guess_image_frame_rate ()
Guess the average frame rate of the video in FPS.

Returns:

    number The frame rate, or zero if unknown.
Video:get_image_frame_count ()
Get the number of image frames in the video.

Returns:

    number The number of frames, or zero if unknown.
Video:filter (pixel_format_name[, filterchain='null'])
Apply a filterchain to the video.

Parameters:

  • pixel_format_name string The desired output pixel format.
  • filterchain string A description of the filterchain. (default 'null')

Returns:

    number The duration of the video in seconds.
Video:next_image_frame ()
Read the next video frame from the video.

Returns:

    ImageFrame
Video:seek (seek_target)
Seek to the first keyframe before the frame number specified.

Parameters:

  • seek_target number The position to seek to (in seconds).

Returns:

    Video This video object.
generated by LDoc 1.4.3 Last updated 2016-07-14 00:41:25