Main Content

To Multimedia File

Write video frames and audio samples to multimedia file

  • To Multimedia File block

Libraries:
Computer Vision Toolbox / Sinks

Description

TheTo Multimedia Fileblock writes video frames, audio samples, or both to a multimedia file (.avi,.wav,.mj2,.mp4, or.m4vformat).

You can compress the video frames or audio samples by selecting a compression algorithm. You can also control the type of video or audio in addition to other related properties the multimedia file receives.

If you have a金宝app®Coder™license, you can generate a code from a model containing this block. To run a generated executable file, you may need to add precompiled shared library files to your system path. SeeSimulink Shared Library Dependencies, and加速仿真软件模型金宝appfor details.

Note

This block supports code generation for platforms that have file I/O available. You cannot use this block withSimulink Desktop Real-Time™software, because that product does not support file I/O.

This block performs best on platforms with Version 11 or later of Windows Media®Player software. This block supports only uncompressed RGB24 AVI files on Linux®andMacplatforms.

Ports

Input

expand all

Specify the input image frame as a matrix or an array. To write an intensity image frame to a multimedia file, specify it as anM-by-Nmatrix. For a color image frame, specify it as anM-by-N-by-3 array.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVI,MJ-2000,WMV, orMPEG4.

  • If theFile typeparameter value is notMJ-2000, set theWriteparameter toVideo and audioorVideo only.

  • If theFile typeparameter value isAVIorMPEG4, set theFile color formatparameter toRGB.

  • Set theImage signalparameter toOne multidimensional signal.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the red color component of the input image frame as anM-by-Nmatrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVI,MJ-2000,WMV, orMPEG4.

  • If theFile typeparameter value is notMJ-2000, set theWriteparameter toVideo and audioorVideo only.

  • If theFile typeparameter value isAVIorMPEG4, set theFile color formatparameter toRGB.

  • Set theImage signalparameter toSeparate color signals.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the green color component of the input image frame as anM-by-Nmatrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVI,MJ-2000,WMV, orMPEG4.

  • If theFile typeparameter value is notMJ-2000, set theWriteparameter toVideo and audioorVideo only.

  • If theFile typeparameter value isAVIorMPEG4, set theFile color formatparameter toRGB.

  • Set theImage signalparameter toSeparate color signals.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the blue color component of the input image frame as anM-by-Nmatrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVI,MJ-2000,WMV, orMPEG4.

  • If theFile typeparameter value is notMJ-2000, set theWriteparameter toVideo and audioorVideo only.

  • If theFile typeparameter value isAVIorMPEG4, set theFile color formatparameter toRGB.

  • Set theImage signalparameter toSeparate color signals.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the luma component of the input image frame as anM-by-Nmatrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVIorMPEG4.

  • Set theWriteparameter toVideo and audioorVideo only.

  • Set theFile color formatparameter toYCbCr 4:2:2.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the blue-difference chrominance component of the input image as anM-by-N/2 matrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVIorMPEG4.

  • Set theWriteparameter toVideo and audioorVideo only.

  • Set theFile color formatparameter toYCbCr 4:2:2.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the red-difference chrominance component of the input image as anM-by-N/2 matrix.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVIorMPEG4.

  • Set theWriteparameter toVideo and audioorVideo only.

  • Set theFile color formatparameter toYCbCr 4:2:2.

Data Types:single|double|int8|int16|int32|uint8|uint16|uint32|Boolean

Specify the input audio signal as a vector or a matrix. When specified as a matrix, the block treats each column as an independent channel.

Dependencies

To enable this port:

  • Set theFile typeparameter toAVI,WAV,WMA,MPEG4,FLAC, orOGG.

  • If theFile typeparameter value isAVI,WMV, orMPEG4set theWriteparameter toVideo and audioorAudio only.

Data Types:single|double|int16|int32|uint8

Parameters

expand all

Specify the name for the multimedia file the block writes. The block appends a file extension automatically based on the specifiedFile typeparameter. If the specified file name, including the file extension, already exists, the block overwrites the data in the existing file with the new input data.

By default, the block saves the file in the current working directory. To specify a different file location, click theSave As...button.

Specify the type of multimedia file to write. The block supports theAVI,WAV,MJ2000,WMA,WMV,MPEG4,FLAC, andOGGfile formats.

Specify the type of media to write. Depending on the value of theFile typeparameter, you can selectVideo only,Audio only, orVideo and audio.

Type of file Supported type of media
AVI
  • Video only

  • Audio only

  • Video and audio

WMV
  • Video only

  • Video and audio

MPEG4
  • Video only

  • Audio only

Dependencies

To enable this parameter, set theFile typeparameter toAVI,WMV, orMPEG4.

Specify a video compression algorithm to reduce the size of the output file. The available options depend on the value of theFile typeparameter.

  • AVI— Select either theDV Video EncoderorMJPEG Compressoralgorithm. If you do not want to reduce the size of the file, selectNone (uncompressed).

  • MJ2000— Select either theLossyorLosslessalgorithm.

Note

The options for this parameter are the video compression algorithms installed on your system. For information about a specific video compressor, see the documentation for that compressor.

Dependencies

To enable this parameter, set theFile typeparameter toMJ2000orAVI. For theAVIfile type, set theWriteparameter toVideo onlyorVideo and audio.

Specify the compression factor as an integer greater than1.

Dependencies

To enable this parameter, set theFile typeparameter toMJ2000and theVideo compressorparameter toLossy.

Specify the quality of the video as an integer in the range [0, 100].

Dependencies

To enable this parameter, set theFile typeparameter toMPEG4and theWriteparameter toVideo only.

Specify the color format of the video for the output file. The block supports theRGBandYCbCr 4:2:2color formats.

Dependencies

To enable this parameter, set theFile typeparameter toAVIorMPEG4.

Specify how the block accepts an RGB color video input. If you selectOne multidimensional signal, the block accepts input using only theImageport. If you selectSeparate color signals, the block accepts an input video using three separate color channels, divided across theR,G, andBports.

Dependencies

To enable this parameter:

  • Set theFile typeparameter toAVI,MJ-2000,WMV, orMPEG4.

  • Set theWriteparameter toVideo and audioorVideo only.

  • If theFile typeparameter value isAVIorMPEG4, set theFile color formatparameter toRGB.

Specify an audio compression algorithm to reduce the size of the output file. The block supports theCCITT A-Law,CCITT u-Law,GSM 6.10,IMA ADPCM,Microsoft ADPCM, andPCMalgorithms. If you do not want to reduce the size of the file, selectNone (uncompressed).

Note

The options for this parameter are the audio compression algorithms installed on your system. For information about a specific audio compressor, see the documentation for that compressor.

Dependencies

To enable this parameter, use either of these options:

  • Set theFile typeparameter toAVIand set theWriteparameter toVideo and audioorAudio only.

  • Set theFile typeparameter toWAV.

Specify the audio data type for the output file.

Dependencies

To enable this parameter select, use either of these options:

  • Set theFile typeparameter toWAVand theAudio compressorparameter toNone (uncompressed).

  • Set theFile typeparameter toFLAC. This file type supports only the8-bit integer,16-bit integer, and24-bit integerdata types.

Block Characteristics

Data Types

double|integera|single

Direct Feedthrough

no

多维信号

no

Variable-Size Signals

no

Zero-Crossing Detection

no

a金宝app支持16 -和32-bit signed and 8-bit unsigned integers.

Extended Capabilities

Version History

Introduced before R2006a