Main Content

Write Binary File

Write binary video data to file

  • Write Binary File block

Libraries:
Computer Vision Toolbox / Sinks

Description

The Write Binary File block takes the video data from a Simulink® model and exports it to a binary file.

This block produces a raw binary file with no header information. It has no encoded information providing the data type, frame rate, or dimensionality. The video data for this block appears in row-major format.

Note

This block supports code generation only for platforms that have file I/O available. The block does not support code generation using Simulink Desktop Real-Time™ or Simulink Real-Time™.

Ports

Input

expand all

Luminance component of the input video stream, specified as a scalar, vector, or matrix. The label of this port can be changed using the Component1 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Blue difference component of the input video stream, specified as a scalar, vector, or matrix. The label of this port can be changed using the Component2 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Red difference component of the input video stream, specified as a scalar, vector, or matrix. The label of this port can be changed using the Component3 parameter when the Video format parameter is set to Custom.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Alpha component of the input video stream, specified as a scalar, vector, or matrix. The label of this port can be changed using the Component4 parameter when the Video format parameter is set to Custom.

Dependencies

To enable this port, use one of these options.

  • Set the Video format parameter to Four character codes, and set the Four character code parameter to AYUV or IF09.

  • Set the Video format parameter to Custom, and the Number of inputs parameter to 4. In this case, the name of this port is Alpha.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Transparency component of the input video stream, specified as a scalar, vector, or matrix.

Dependencies

To enable this port, set the Video format parameter to Four character codes, and set the Four character code parameter to Y41T or Y42T.

Data Types: int8 | int16 | int32 | uint8 | uint16 | uint32

Parameters

expand all

Specify the name of the output binary file, with a .bin extension, for the video data. Click Save As to specify the location for the file.

Specify the format of the video data as one of these options.

  • Four character codes (FOURCC) — For more information about these codes, see https://en.wikipedia.org/wiki/FourCC.

  • Custom — Read the video data from a binary file of a custom format.

Select the four character code of the desired codec for the binary file. The value of this parameter also determines the number of input ports on the block. For information on which four character codes enable which input ports, see the table below.

Input Ports for Four Character Codes

Four Character CodesInput Ports
I420Y'|Cb|Cr
AYUVY'|Cb|Cr|A
CLJRY'|Cb|Cr
cyuvY'|Cb|Cr
GREYY'
IF09Y'|Cb|Cr|A
IMC1Y'|Cb|Cr
IMC2Y'|Cb|Cr
IMC3Y'|Cb|Cr
IMC4Y'|Cb|Cr
IUYVY'|Cb|Cr
IY41Y'|Cb|Cr
IYU1Y'|Cb|Cr
IYU2Y'|Cb|Cr
IYUVY'|Cb|Cr
NV12Y'|Cb|Cr
NV21Y'|Cb|Cr
UYNVY'|Cb|Cr
UYNYY'|Cb|Cr
V210Y'|Cb|Cr
Y411Y'|Cb|Cr
Y41PY'|Cb|Cr
Y41TY'|Cb|Cr|T
Y422Y'|Cb|Cr
Y42TY'|Cb|Cr|T
Y8Y'
Y800Y'
YUNVY'|Cb|Cr
YUY2Y'|Cb|Cr
YUYVY'|Cb|Cr
YV12Y'|Cb|Cr
YV16Y'|Cb|Cr
YVU9Y'|Cb|Cr
YVYUY'|Cb|Cr

Dependencies

To enable this parameter, set the Video Format parameter to Four character codes.

If you select Top line first, the block begins filling the binary file with the first row of the video frame. It then fills the file with the other rows in increasing order. If you select Bottom line first, the block begins filling the binary file with the last row of the video frame. It then fills the file with the other rows in decreasing order.

Specify the data format of the binary file as Planar or Packed.

Dependencies

To enable this parameter, set the Video Format parameter to Custom.

Specify the number of components in the input video stream. This parameter sets the number of input ports.

Dependencies

To enable this parameter, set the Video Format parameter to Custom.

Select the Inherit size of components from input data type parameter to indicate that all of the components have the same number of bits as the input data type. If you clear this parameter, you can specify the number of bits for each enabled component using the associated Bits parameter.

Dependencies

To enable this parameter, set the Video Format parameter to Custom.

Specify the name of the input port for the luminance component of the input video stream.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of inputs parameter to 1 or greater.

Specify the name of the input port for the blue difference component of the input video stream.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of inputs parameter to 2 or greater.

Specify the name of the input port for the red difference component of the input video stream.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of inputs parameter to 3 or greater.

Specify the name of the input port for the alpha component of the input video stream.

Dependencies

To enable this parameter, set the Video format parameter to Custom, set the Number of inputs parameter to 4.

Specify the size of the luminance component in the input video stream. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of inputs parameter to 1 or greater, and select the Inherit size of components from input data type parameter.

Specify the size of the blue difference component in the input video stream. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of inputs parameter to 2 or greater, and select the Inherit size of components from input data type parameter.

Specify the size of the red difference component in the input video stream. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of inputs parameter to 3 or greater, and select the Inherit size of components from input data type parameter.

Specify the size of the alpha component in the input video stream. The value of this parameter determines the interpretation of the video stream data as 8-bit, 16-bit, 24-bit, or 32-bit.

Dependencies

To enable this parameter, set the Video format parameter to Custom, and set the Number of inputs parameter to 4, and select the Inherit size of components from input data type parameter.

Specify the arrangement of the components in the binary file. Identify the components by the assigned numerals, from 1 to 4, in the desired order. You must include all enabled components when setting this parameter.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Select this parameter when the video stream contains interlaced video data.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Select this parameter when the input data is signed.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Specify the byte order in the output binary file as either little endian or big endian.

Dependencies

To enable this parameter, set the Video format parameter to Custom.

Block Characteristics

Data Types

integer

Multidimensional Signals

no

Variable-Size Signals

no

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a