vision.BinaryFileWriter System object

Package: vision

Write binary video data to files

Description

The BinaryFileWriter object writes binary video data to files.

Construction

H = vision.BinaryFileWriter returns a System object, H, that writes binary video data to an output file, output.bin in the I420 Four Character Code format.

H = vision.BinaryFileWriter(Name,Value) returns a binary file writer System object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

H = vision.BinaryFileWriter(FILE,Name,Value) returns a binary file writer System object, H, with the Filename property set to FILE and other specified properties set to the specified values.

Properties

Filename

Name of binary file to write to

Specify the name of the binary file as a string. The default is the file output.bin.

VideoFormat

Format of binary video data

Specify the format of the binary video data as Four character codes, or Custom. The default is Four character codes.

FourCharacterCode

Four Character Code video format

Specify the binary file format from the available list of Four Character Code video formats. For more information on Four Character Codes, see http://www.fourcc.org. This property applies when you set the VideoFormat property to Four character codes.

BitstreamFormat

Format of data as planar or packed

Specify the data format as Planar or Packed. This property applies when you set the VideoFormat property to Custom. The default is Planar.

VideoComponentCount

Number of video components in video stream

Specify the number of video components in the video stream as 1, 2, 3 or 4. This number corresponds to the number of video component outputs. This property applies when you set the VideoFormat property to Custom. The default is 3.

VideoComponentBitsSource

How to specify the size of video components

Indicate how to specify the size of video components as Auto or Property. If this property is set to Auto, each component will have the same number of bits as the input data type. Otherwise, the number of bits for each video component is specified using the VideoComponentBits property. This property applies when you set the VideoFormat property to Custom. The default is Auto.

VideoComponentBits

Bit size of video components

Specify the bit size of video components using a vector of length N, where N is the value of the VideoComponentCount property. This property applies when you set the VideoComponentBitsSource property to Property. The default is [8 8 8].

VideoComponentOrder

Arrange video components in binary file

Specify how to arrange the components in the binary file. This property must be set to a vector of length N, where N is set according to how you set the BitstreamFormat property. When you set the BitStreamFormat property to Planar, you must set N equal to the value of the VideoComponentCount property. Otherwise, you can set N equal to or greater than the value of the VideoComponentCount property.

This property applies when you set the VideoFormat property to Custom. The default is [1 2 3].

InterlacedVideo

Whether data stream represents interlaced video

Set this property to true if the video stream represents interlaced video data. This property applies when you set the VideoFormat property to Custom. The default is false.

LineOrder

How to fill binary file

Specify how to fill the binary file as Top line first, or Bottom line first. If this property is set to Top line first, the object first fills the binary file with the first row of the video frame. Otherwise, the object first fills the binary file with the last row of the video frame. The default is Top line first.

SignedData

Whether input data is signed

Set this property to true if the input data is signed. This property applies when you set the VideoFormat property to Custom. The default is false.

ByteOrder

Byte ordering as little endian or big endian

Specify the byte ordering in the output binary file as Little endian, or Big endian. This property applies when you set the VideoFormat property to Custom. The default is Little endian.

Methods

cloneCreate binary file writer object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepWrite video frame to output file

Examples

Write video to a binary video file

 filename = fullfile(tempdir,'output.bin');
 hbfr = vision.BinaryFileReader;
 hbfw = vision.BinaryFileWriter(filename);

 while ~isDone(hbfr)
 		[y,cb,cr] = step(hbfr);
 		step(hbfw,y,cb,cr);
 end

 release(hbfr); % close the input file
 release(hbfw); % close the output file
 

Algorithms

This object implements the algorithm, inputs, and outputs described on the Write Binary File block reference page. The object properties correspond to the block parameters.

Was this topic helpful?