# Source_CreateVideoFile

## Using of command

This command is use for create video file. Command use OpenCV function cvCreateVideoWriter with ffmpeg library. Function create and open vodeo file.Than each video frame is write by function Source_WriteVideoFrame.

## Commands parameters

Command has 10 parameters:

1. Select Video writer: This parameter is use for select Video writer structure. You can select VideoWriter_0 to VideoWriter_9. We can work with 10 opened videos in one test program. Selected video writer structure will be use as parameter for commands Source_WriteVideoFrame( for write frame) and Source_ReleaseVideoWriter fro close video file.
2. Path to video file: Parameter sets path with video file name. Click on line with this parameter display Open file dialog.
3. Codec: You can select type of codec which is use for code video to video frame. Available codecs in ffmpeg library are:
   1. MPEG-1
   2. motion-jpeg
   3. MPEG-4.2
   4. MPEG-4.3
   5. MPEG-4
   6. H263
   7. H263I
   8. FLV1
4. Framerate from: You can select from where framerate for video file will be use. You can select Variable_0 to Variable_99. In this case value in selected variable will be use as framerate. You can select also option "Number", than number in next parameter will be use as framerate. Framerate value is number of frames per seconds.
5. Framerate number: If option "Number" is select in previous command , number in this line is use as framerate in video file.
6. Height from: You can select from where height of frames in video file will be use. You can select Variable_0 to Variable_99. In this case value in selected variable will be use as height. You can select also option "Number", than number in next parameter will be use as height. Height value is number in pixels.Height value must be same as a height of a picture frame !!!
7. Height number: If option "Number" is select in previous command, number in this line is use as height of video frames.
8. Width from: You can select from where width of frames in video file will be use. You can select Variable_0 to Variable_99. In this case value in selected variable will be use as width. You can select also option "Number", than number in next parameter will be use as width. Width value is number in pixels.Width value must be same as a width of a picture frame !!!
9. Width number: If option "Number" is select in previous command, number in this line is use as width of video frames.
10. Colour: This option selects if video file will be colour or grayscale. You can select option "Colour", video file will be colour or "Grayscale", video file will be grayscale.

## Error codes

1. Error code -11: Bad video writer index. Error means that Video_writer index is not in range 0 to 9. Check test program file if it has correct format.
2. Error code -12: Bad framerate variable. Error means that variable in framerate is not in range 0 to 99. Check test program file if command has correct format.
3. Error code -13:Bad framerate value. Error means that framerate value is less or equal to 0.
4. Error code -14: Bad height variable. Error means that variable in height is not in range 0 to 99. Check test program file if command has correct format.
5. Error code -15: Bad height value. Error means that height value is less or equal to 0.
6. Error code -16: Bad width variable. Error means that variable in width is not in range 0 to 99. Check test program file if command has correct format.
7. Error code -17: Bad width value. Error means that width value is less or equal to 0.
8. Error code -18: Can not open video file.
9. Error code -100: OpenCV error. Error generated by OpenCV function cvCreateVideoWriter. Explanation of this error will be display in result window.