Create object to read video files
Use a VideoReader
object to read files containing video
data. The object contains information about the video file and enables you to read data
from the video. You can create a VideoReader
object using the
VideoReader
function, query information about the video using the
object properties, and then read the video using object functions.
For more information, see Supported Video and Audio File Formats.
sets the properties v
= VideoReader(filename
,Name,Value
)CurrentTime
, Tag
, and
UserData
using name-value pairs. For example,
VideoReader('myfile.mp4','CurrentTime',1.2)
starts
reading 1.2
seconds into the video. You can specify multiple
name-value pairs. Enclose each property name in single quotes followed by the
corresponding value.
hasFrame | Determine if video frame is available to read |
read | Read one or more video frames |
readFrame | Read next video frame |
VideoReader.getFileFormats | File formats that VideoReader supports |
For some AVI, MOV, or MP4 files on Windows®, using the readFrame
function to read all of the frames in the
file can result in a different number of frames than the value returned by the
NumFrames
property of the VideoReader
object.
The macOS platform no longer supports certain older video file formats. To
read such files using VideoReader
:
Open the video file using the QuickTime player. If the player detects the file to be of an older format, then it automatically converts the file to a newer format.
Save the newly converted video file.
Use VideoReader
to read this newly converted
video file.