vision.VideoFileReader
(To be removed) Read video frames and audio samples from video file
The vision.VideoFileReader
system object will be removed in a future
release. Use the VideoReader
object instead.
Description
The VideoFileReader
object reads video frames, images,
and audio samples from a video file. The object can also read image files.
Platforms | File Formats |
---|---|
All Platforms | AVI, including uncompressed, indexed, grayscale, and Motion JPEG-encoded video
( Note
|
All Windows® | MPEG-1 ( |
Windows 7 or later | MPEG-4, including H.264 encoded video ( |
Macintosh | Most formats supported by QuickTime Player, including: Note: For OS X Yosemite (Version 10.10) and
later, MPEG-4/H.264 files written using |
Linux® | Any format supported by your installed plug-ins for GStreamer 1.0 or higher, as listed
on https://gstreamer.freedesktop.org/documentation/plugins_doc.html, including Ogg Theora ( |
To read a file:
Create the
vision.VideoFileReader
object and set its properties.Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?
Creation
Syntax
Description
returns a video file reader System object™, videoFReader
= vision.VideoFileReader(Filename
)videoFReader
, that sequentially reads video frames
or audio samples from an input file, Filename
.
additionally
sets properties using one or more name-value pairs. Enclose each property name in
quotes. For example, videoFReader
= vision.VideoFileReader(___,Name,Value
)videoFReader =
vision.VideoFileReader('PlayCount',1)
Properties
Usage
Syntax
Description
returns the next video
frame.I
= videoFReader()
[___,
also returns one frame of audio samples, audio
] = videoFReader()audio
. This syntax
requires that you set the AudioOutputPort
property to
true
.
[___,
also returns the end-of-file indicator, EOF
] = videoFReader()EOF
. The object sets
EOF
to true
each time the output contains the
last audio sample and/or video frame.
Output Arguments
Object Functions
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)
Examples
Tips
Video Reading Performance on Windows Systems:To achieve better video reader performance on Windows for MP4 and MOV files, MATLAB uses the system's graphics hardware for decoding. However, in some cases using the graphics card for decoding can result in poorer performance depending on the specific graphics hardware on the system. If you notice slower video reader performance on your system, turn off the hardware acceleration by typing:
Hardware acceleration can be reenabled by typing:matlab.video.read.UseHardwareAcceleration('off')
matlab.video.read.UseHardwareAcceleration('on')