mindspore.dataset.vision.read_video_timestamps

View Source On Gitee
mindspore.dataset.vision.read_video_timestamps(filename, pts_unit='pts')[source]

Read the timestamps and frames per second of a video file. It supports AVI, H264, H265, MOV, MP4, WMV files.

Parameters
  • filename (str) – The path to the video file to be read.

  • pts_unit (str, optional) – The unit of the timestamps. It can be any of ["pts", "sec"]. Default: "pts".

Returns

  • list, when pts_unit is set to "pts", list[int] is returned, when pts_unit is set to "sec", list[float] is returned.

  • float, the frames per second of the video file.

Raises
  • TypeError – If filename is not of type str.

  • TypeError – If pts_unit is not of type str.

  • RuntimeError – If filename does not exist, or not a regular file, or not a supported video file.

  • RuntimeError – If pts_unit is not in ["pts", "sec"].

Supported Platforms:

CPU

Examples

>>> import mindspore.dataset.vision as vision
>>> video_timestamps, video_fps = vision.read_video_timestamps("/path/to/file")