Initializes or reinitializes video writer
retval = vid.open(filename, frameSize)
retval = vid.open(filename, frameSize, 'OptionName',optionValue, ...)
Input
- filename Name of the output video file
- frameSize Size of the video frames
[width, height]
.
Output
- retval bool, indicates if video is successfully initialized
Options
- FourCC 4-character code of codec used to compress the
frames. List of codes can be obtained at [FOURCC]. FFMPEG
backend with MP4 container natively uses other values as
FourCC code: see [ObjectType], so you may receive a
warning message from OpenCV about fourcc code conversion.
Examples are:
- PIM1 MPEG-1 codec
- MJPG Motion-JPEG codec
- MP42 MPEG-4 (Microsoft)
- DIV3 DivX MPEG-4 Part 2
- DIVX DivX codec
- XVID XVID MPEG-4 Part 2
- U263 H263 (default)
- I263 ITU H.263
- FLV1 Sorenson Spark (Flash Video)
- X264 H.264
- AVC1 MPEG-4 Part 10/H.264 (Apple)
- WMV1 Windows Media Video 7 (Microsoft)
- WMV2 Windows Media Video 8 (Microsoft)
- -1 prompts with codec selection dialog (Windows only)
- FPS Framerate of the created video stream. default 25.
- Color If true, the encoder will expect and encode color
frames, otherwise it will work with grayscale frames (the
flag is currently supported on Windows only). default true
The method opens a video writer. On Linux FFMPEG is
used to write videos; on Windows FFMPEG or VFW is used; on
MacOSX QTKit is used.
References
[FOURCC]:
"Video Codecs by FOURCC", http://www.fourcc.org/codecs.php
[ObjectType]:
http://www.mp4ra.org/codecs.html