vision.VideoFileWriter
Write video frames and audio samples to video file
Description
The VideoFileWriter
object writes video frames and audio
samples to a video file. The video and audio can be compressed. The available compression
types depend on the encoders installed on the platform.
Note
This block supports code generation for platforms that have file I/O available. You cannot use this block with Simulink® Desktop Real-Time™ software, because that product does not support file I/O.
This object performs best on platforms with Version 11 or later of Windows Media® Player software. This object supports only uncompressed RGB24 AVI files on Linux® and Mac platforms.
The generated code for this object relies on prebuilt library files. You can run this code
outside the MATLAB® environment, or redeploy it, but be sure to account for these extra library
files when doing so. The packNGo function creates a single zip file containing all of the
pieces required to run or rebuild this code. See packNGo
(Simulink Coder) for more information.
To run an executable file that was generated from an object, you may need to add precompiled shared library files to your system path. See MATLAB Coder and Simulink Shared Library Dependencies for details.
Creation
Syntax
Description
videoFWriter = vision.VideoFileWriter
returns a video file
writer System object, videoFWriter
. It writes video
frames to an uncompressed 'output.avi
' video file. Every call to the
step
method writes a video frame.
videoFWriter = vision.VideoFileWriter(
returns a video file writer object, Filename
)videoFWriter
that
writes video to a file, Filename
. The file type can be
.avi
, .mj2
, .mp4
, and
.m4v
specified by the FileFormat
property.
videoFWriter = vision.VideoFileWriter(___,
configures the video file writer properties, specified as one or more name-value pair
arguments. Unspecified properties have default values.Name,Value
)
Name
is a property name and Value
is the
corresponding value. Name
must appear inside single quotes
(''
). You can specify several name-value pair arguments in any
order as Name1,Value1,...,NameN,ValueN
.
Example: videoFWriter = vision.VideoFileWriter('myFile.avi','FrameRate',...
videoFReader.info.VideoFrameRate);
Properties
Usage
Syntax
Description
writes one frame of video, Filename
= videoFWriter(videoFrame
)videoFrame
, to the output file. The
input video can be an M-by-N-by-3 truecolor RGB
video frame, or an M-by-N grayscale video
frame..
writes one frame of the input video, Filename
= videoFWriter(videoFrame
,audio
)videoFrame
, and one frame of
audio samples, audio
, to the output file. This applies when you set
the AudioInputPort
property to
true
.
writes one frame of YCbCr 4:2:2 video, and one frame of audio samples,
Filename
= videoFWriter(videoFrame
,Y
,Cb
,Cr
,audio
)audio
, to the output file. This applies when you set the AudioInputPort
to true
and the FileColorSpace
property to 'YCbCr 4:2:2
'.
The width of Cb and Cr color components must be half of the width of Y.
Input Arguments
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
Extended Capabilities
Version History
Introduced in R2012a