classdef VideoFileWriter
%VideoFileWriter Write video frames and audio samples to video file
%   HVFW = dsp.VideoFileWriter returns a video file writer System
%   object, HVFW, that writes video frames and/or audio samples to a
%   video file (such as an AVI file).
%
%   HVFW = vision.VideoFileWriter('PropertyName', PropertyValue, ...)
%   returns a video file writer System object, HVFW, with each
%   specified property set to the specified value.
%
%   HVFW = vision.VideoFileWriter(FILENAME, 'PropertyName',
%   PropertyValue, ...) returns a video file writer System object,
%   HVFW, with Filename property set to FILENAME and other specified
%   properties set to the specified values.
%
%   Step method syntax:
%
%   step(HVFW, I) writes one frame of video, I, to the output file. I is
%   either an M-by-N-by-3 color video signal or an M-by-N intensity signal.
%
%   step(HVFW, Y, CB, CR) writes one frame of YCbCr 4:2:2 data in the color
%   components Y, CB, and CR, to the output file. The width of CB and CR
%   must be half of the width of Y, and the value of the FileColorSpace
%   property must be set to 'YCbCr 4:2:2'.
%
%   step(HVFW, I, AUDIO) writes one frame of video, I, and one frame of
%   audio samples, AUDIO, to the output file when the AudioInputPort
%   property is enabled.
%
%   step(HVFW, Y, CB, CR, AUDIO) writes one frame of YCbCr 4:2:2 data in
%   the color components Y, CB, and CR, and one frame of audio samples,
%   AUDIO, to the output file when the AudioInputPort is enabled  and the
%   value of the FileColorSpace property is set to 'YCbCr 4:2:2'. The width
%   of CB and CR must be half of the width of Y.
%
%   VideoFileWriter methods:
%
%   step     - See above description for use of this method
%   release  - Allow property value and input characteristics changes, and
%              release video file writer resources
%   clone    - Create video file writer object with same property
%              values
%   isLocked - Locked status (logical)
%
%   VideoFileWriter properties:
%
%   Filename        - Name of video file to which to write
%   FileFormat      - Format of created file
%   AudioInputPort  - Choose to write audio data
%   FrameRate       - Frame rate of video data stream
%   AudioCompressor - Algorithm used to compress audio	data
%   VideoCompressor - Algorithm used to compress video data
%   AudioDataType   - Data type of the uncompressed audio
%   FileColorSpace  - Color space used when creating a file
%
%   % EXAMPLE: Write a video to disk. 
%      hmfr = vision.VideoFileReader;
%      finfo = info(hmfr);
%      hvfw = vision.VideoFileWriter('vipmen1.avi', ...
%                         'AudioInputPort', false, ...
%                         'FrameRate', finfo.VideoFrameRate);
%      while ~isDone(hmfr)
%        videoFrame = step(hmfr);
%        step(hvfw, videoFrame);
%      end
%      release(hmfr);
%      release(hvfw);
%
%   See also vision.VideoFileReader, dsp.AudioFileWriter,
%       dsp.AudioFileReader

 
%   Copyright 2004-2010 The MathWorks, Inc.

    methods
        function out=VideoFileWriter
            %VideoFileWriter Write video frames and audio samples to video file
            %   HVFW = dsp.VideoFileWriter returns a video file writer System
            %   object, HVFW, that writes video frames and/or audio samples to a
            %   video file (such as an AVI file).
            %
            %   HVFW = vision.VideoFileWriter('PropertyName', PropertyValue, ...)
            %   returns a video file writer System object, HVFW, with each
            %   specified property set to the specified value.
            %
            %   HVFW = vision.VideoFileWriter(FILENAME, 'PropertyName',
            %   PropertyValue, ...) returns a video file writer System object,
            %   HVFW, with Filename property set to FILENAME and other specified
            %   properties set to the specified values.
            %
            %   Step method syntax:
            %
            %   step(HVFW, I) writes one frame of video, I, to the output file. I is
            %   either an M-by-N-by-3 color video signal or an M-by-N intensity signal.
            %
            %   step(HVFW, Y, CB, CR) writes one frame of YCbCr 4:2:2 data in the color
            %   components Y, CB, and CR, to the output file. The width of CB and CR
            %   must be half of the width of Y, and the value of the FileColorSpace
            %   property must be set to 'YCbCr 4:2:2'.
            %
            %   step(HVFW, I, AUDIO) writes one frame of video, I, and one frame of
            %   audio samples, AUDIO, to the output file when the AudioInputPort
            %   property is enabled.
            %
            %   step(HVFW, Y, CB, CR, AUDIO) writes one frame of YCbCr 4:2:2 data in
            %   the color components Y, CB, and CR, and one frame of audio samples,
            %   AUDIO, to the output file when the AudioInputPort is enabled  and the
            %   value of the FileColorSpace property is set to 'YCbCr 4:2:2'. The width
            %   of CB and CR must be half of the width of Y.
            %
            %   VideoFileWriter methods:
            %
            %   step     - See above description for use of this method
            %   release  - Allow property value and input characteristics changes, and
            %              release video file writer resources
            %   clone    - Create video file writer object with same property
            %              values
            %   isLocked - Locked status (logical)
            %
            %   VideoFileWriter properties:
            %
            %   Filename        - Name of video file to which to write
            %   FileFormat      - Format of created file
            %   AudioInputPort  - Choose to write audio data
            %   FrameRate       - Frame rate of video data stream
            %   AudioCompressor - Algorithm used to compress audio	data
            %   VideoCompressor - Algorithm used to compress video data
            %   AudioDataType   - Data type of the uncompressed audio
            %   FileColorSpace  - Color space used when creating a file
            %
            %   % EXAMPLE: Write a video to disk. 
            %      hmfr = vision.VideoFileReader;
            %      finfo = info(hmfr);
            %      hvfw = vision.VideoFileWriter('vipmen1.avi', ...
            %                         'AudioInputPort', false, ...
            %                         'FrameRate', finfo.VideoFrameRate);
            %      while ~isDone(hmfr)
            %        videoFrame = step(hmfr);
            %        step(hvfw, videoFrame);
            %      end
            %      release(hmfr);
            %      release(hvfw);
            %
            %   See also vision.VideoFileReader, dsp.AudioFileWriter,
            %       dsp.AudioFileReader
        end

        function isInactivePropertyImpl(in) %#ok<MANU>
        end

    end
    methods (Abstract)
    end
    properties
        %AudioCompressor Algorithm used to compress audio data
        %   Specify the type of compression algorithm to use to compress the
        %   audio data. This compression reduces the size of the video
        %   file. Choose 'None (uncompressed)' to save uncompressed audio data
        %   to the video file. The other options reflect the available audio
        %   compression algorithms installed on your system.  This property is 
        %   only available when writing AVI files on Windows (R) platforms.
        AudioCompressor;

        %AudioDataType Data type of the uncompressed audio
        %   Specify the type of uncompressed audio data which is written to the
        %   file.  Note that this property is only applicable when writing 
        %   uncompressed WAV files.
        AudioDataType;

        %AudioInputPort Choose to write audio data
        %   Use this property to control whether the System object writes audio
        %   samples to the video file. This property is false by default.
        AudioInputPort;

        %FileColorSpace Color space used when creating a file
        %   Specify the color space of AVI files as one of [{'RGB'} | 'YCbCr
        %   4:2:2'].  This property is only applicable on Windows (R) platforms
        %   when the FileFormat property is 'AVI'.
        FileColorSpace;

        %FileFormat Format of created file
        %   Specify the format of the file that is created.  On Windows (R)
        %   platforms, this may be one of [{'AVI'} | 'WMV']. On other
        %   platforms, this value is restricted to 'AVI'. These abbreviations
        %   correspond to the following file formats: 
        %   WMV: Windows Media Video
        %   AVI: Audio-Video Interleave
        FileFormat;

        %Filename Name of video file to which to write
        %   Specify the name of the video file as a string. The default
        %   value of this property is 'output.avi'.
        Filename;

        %FrameRate Frame rate of video data stream
        %   Specify the frame rate of the video data in frames per second as a
        %   positive numeric scalar. The default value of this property is 30.
        %   For videos which also contain audio data, the rate of the audio 
        %   data will be determined as the rate of the video multiplied by the 
        %   number of audio samples passed in each invocation of the step 
        %   method.  For example, if you use a frame rate of 30 and pass 1470 
        %   audio samples to the step method, the audio sample rate will be 
        %   1470*30 = 44100 
        FrameRate;

        %VideoCompressor Algorithm used to compress video data
        %   Specify the type of compression algorithm to use to compress the
        %   video data. This compression reduces the size of the video
        %   file. Choose 'None (uncompressed)' to save uncompressed video data
        %   to the video file. The other options reflect the available video
        %   compression algorithms installed on your system.  This property is
        %   only available when writing AVI files on Windows (R) platforms.
        VideoCompressor;

    end
end
