主要内容

To Multimedia File

流视频帧和音频样本到多媒体文件

图书馆

Sinks

dspsnks4

  • 到多媒体文件块

描述

TheTo Multimedia Fileblock writes video frames, audio samples, or both to a multimedia (.avi,.wav,.wma,.mp4,.gg,.flac或.wmv) file.

你可以压缩视频帧或音频样本by selecting a compression algorithm. You can connect as many of the input ports as you want. Therefore, you can control the type of video and/or audio the multimedia file receives.

不te

该块支持具有文件I/O金宝app的平台代码生成。您不能使用此块金宝app®桌面实时™软件,因为该产品不支持文件I/O。金宝app

该块在Windows Media的版本11或更晚的平台上表现最好®Player software. This block supports only uncompressed RGB24 AVI files on Linux®苹果电脑平台。

视窗®7UAC (User Account Control), may require administrative privileges to encodeWMVWMAfiles.

The generated code for this block 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. SeepackNGo(Simulink Coder)了解更多信息。

To run an executable file that was generated from a model containing this block, you may need to add precompiled shared library files to your system path. SeeUnderstanding C Code Generation in DSP System Toolboxfor details.

Cross-Platform Supported File Formats for Audio Files

音频文件可以是所有平台上的以下格式:

  • WAV

  • Flac

  • OGG

  • MPEG4(only onWindows 7的和苹果系统)

默认格式为wav。该块支持MPEG-4 金宝appAAC音频文件Windows 7的, and macOS. You can use both M4A and MP4 extensions. The following platform specific restrictions apply when writing these files:

Windows 7的 苹果系统
  • Only sample rates of 44100 and 48000 Hz are supported.

  • 对于MPEG-4 AAC文件格式,仅允许单声道或立体声输出。对于所有其他格式,允许两个以上的音频输出通道。

  • 对于MPEG-4 AAC文件格式,仅允许单声道或立体声输出。对于所有其他格式,允许两个以上的音频输出通道。

  • The output data is padded on both the front and back of the signal, with extra samples of silence.

    Windows AAC编码器将尖锐的淡入淡入淡出和淡出的音频信号淡出,从而在写入磁盘时导致样品中的信号稍长。

  • 不t all sampling rates are supported, although the Mac Audio Toolbox API do not explicitly specify a restriction.

  • A minimum of 1025 samples per channel must be written to the MPEG-4 AAC file.

端口

Port 描述

图片

M-经过-N-by-3矩阵RGB,强度或YCBCR 4:2:2信号。

R,G,B

代表RGB视频流的一个平面的矩阵。R,G或B端口的输入必须具有相同的维度和数据类型。

Audio

M-经过-Nmatrix.Mis the number of samples in each channel, andNis the number of channels.

Y, Cb, Cr

Matrix that represents one frame of the YCbCr video stream. The Y, Cb, and Cr ports use the following dimensions:

Y:MxN
CB:Mx N 2
CR:Mx N 2

Dialog Box

The主要的pane of theTo Multimedia File块对话框显示如下。

文件名

指定多媒体文件的名称。该块将文件保存在当前文件夹中。要指定其他文件或位置,请单击Save As...按钮。

File type

指定多媒体文件的文件类型。您可以选择AVI,WAV,MJ2000,WMA,WMV,MPEG4,FlacC, orOGG。By default, theFile type被设定为WAV

Specify whether the block writes video frames, audio samples, or both to the multimedia file. You can select视频和音频,Video only, orAudio only。This parameter is visible only when you setFile typetoAVI,MPEG4, orOGG

音频压缩机

Select the type of compression algorithm to use to compress the audio data. This compression reduces the size of the multimedia file. Choose没有(未压缩)将未压缩的音频数据保存到多媒体文件中。

不te

此参数列表中可用的其他项目是系统上安装的音频压缩算法。有关特定音频压缩机的信息,请参见该压缩机的文档。

音频数据类型

选择音频数据类型。您可以使用音频数据类型parameter only for uncompressed wave files.

视频压缩机

Select the type of compression algorithm to use to compress the video data. This compression reduces the size of the multimedia file. Choose没有(未压缩)将未压缩的视频数据保存到多媒体文件中。

不te

此参数列表中可用的其他项目是系统上安装的视频压缩算法。有关特定视频压缩机的信息,请参见该压缩机的文档。

压缩因子(> 1)

将压缩因子指定为更大的整数标量1。此参数仅适用于File type被设定为MJ2000视频压缩机被设定为有损。默认情况下,此参数设置为10

File color format

Select the color format of the data stored in the file. You can select eitherRGB或者YCbCr 4:2:2

图片signal

指定块如何接受颜色视频信号。如果您选择一个多维信号, the block accepts anM-经过-N-经过-Pcolor video signal, wherePis the number of color planes, at one port. If you selectSeparate color signals,其他端口出现在块上。每个港口接受一个M-经过-Nplane of an RGB video stream.

视频质量(0-100)

Quality of the video specified as an integer scalar in the range [0 100]. This parameter is applicable only when文件名被设定为MPEG4被设定为Video only。默认情况下,此参数设置为75

Troubleshooting

在外面运行可执行文件MATLAB

要在Shell中运行生成的独立可执行应用程序,您需要将环境设置为以下内容:

平台 Command
苹果电脑

setenv DYLD_LIBRARY_PATH "${DYLD_LIBRARY_PATH}:$MATLABROOT/bin/maci64" (csh/tcsh)

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$MATLABROOT/bin/maci64 (Bash)

有关更多信息,请参阅Append library path to "DYLD_LIBRARY_PATH" in MAC

Linux

setenv ld_library_path $ {ld_library_path}:$ matlabroot/bin/glnxa64(csh/tcsh)

export ld_library_path = $ ld_library_path:$ matlabroot/bin/glnxa64(bash)

视窗

设置路径=%路径%;%matlabroot%\ bin \ win64

金宝app支持的数据类型

要使该块正确显示视频数据,必须在两次浮点像素值之间01。任何其他数据类型都需要其数据类型支持的最小值和最大值之间的像素值。金宝app

检查您使用的特定编解码器以获取支持的音频率。金宝app

Port 金宝app支持的数据类型 Supports Complex Values?

图片

  • 双精度浮点

  • 单精度浮点

  • 布尔

  • 8-, 16- 32-bit signed integers

  • 8-, 16- 32-bit unsigned integers

R,G,B

Same as Image port

Audio

  • 双精度浮点

  • 单精度浮点

  • 16位签名的整数

  • 32位签名的整数

  • 8位未签名的整数

Y, Cb, Cr

Same as Image port

Extended Capabilities

Version History

在R2006a之前引入