VideoReader
Create object to read video files
Description
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.
Creation
Description
sets the properties v
= VideoReader(filename
,Name,Value
)CurrentTime
, Tag
, and
UserData
using name-value arguments. For example,
VideoReader('myfile.mp4','CurrentTime',1.2)
starts
reading 1.2
seconds into the video. You can specify multiple
name-value arguments. Enclose each property name in single quotes followed by
the corresponding value.
Input Arguments
Properties
Object Functions
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 |
Examples
Limitations
For some MP4 files, the
NumFrames
property can return different values in Windows®, Mac, and Linux® platforms. This variation results from differences in the underlying platform-specific APIs.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 from the value returned by theNumFrames
property of theVideoReader
object.
Tips
On Windows platforms, you cannot modify or delete an AVI file that is referenced by a
VideoReader
object in your workspace. To removeVideoReader
objects from your workspace, use theclear
function.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.