Skip to contents

A VideoWriter object contains an OpenCV video writer to an output file.

Function for creating VideoWriter objects.

Usage

videoWriter(
  outputFile,
  fourcc,
  fps,
  height,
  width,
  isColor = TRUE,
  api = "ANY"
)

Arguments

outputFile

An character string corresponding to the path to an output file.

fourcc

A 4-character string corresponding to the fourcc code of the codec to be used. A list of fourcc codes can be obtained at this archived page of the fourcc site https://www.fourcc.org/codecs.php. Alternatively, the integer value corresponding to a fourcc code.

fps

A numeric value corresponding to the framerate of the output video.

height

An integer value corresponding to the height of the video in pixels.

width

An integer value corresponding to the width of the video in pixels.

isColor

A logical indicating whether the output video is a color (default: TRUE) or grayscale (FALSE) video.

api

A character string corresponding to the API to use for reading the video from the file (see Note; default: "ANY").

Value

A VideoWriter object.

Slots

dim,ncol,nrow

Functions returning the dimensions of the object.

codec

Function returning the codec of the object.

fps

Function returning the frame rate of the object.

api

Function returning the api use to write frames to the output file.

output

Function returning the path to the output file.

get,set

Functions to access and set internal properties of the object.

open,isOpened

Functions to open a new video write or check the status of the video writer.

write

Function to write a frame to the output file.

release

Function to release the object from memory.

Note

Hereafter is a list of all supported APIs. Note that not all APIs will be available on your computer (actually most of them will not be).

"ANY":

automatically select an API.

"VFW":

Video For Windows.

"V4L", "V4L2":

Video For Linux.

"FIREWIRE", "FIREWARE", "IEEE1394", "DC1394", "CMU1394":

IEEE 1394 drivers.

"QT":

Quicktime.

"UNICAP":

Unicap drivers.

"DSHOW":

DirectShow.

"PVAPI":

PvAPI, Prosilica GigE SDK.

"OPENNI":

OpenNI (for Kinect).

"OPENNI_ASUS":

OpenNI (for Asus Xtion).

"XIAPI":

XIMEA Camera API.

"AVFOUNDATION":

AVFoundation framework for iOS and OSX > Lion.

"GIGANETIX":

Smartek Giganetix GigEVisionSDK.

"MSMF":

Microsoft Media Foundation.

"WINRT":

Microsoft Windows Runtime using Media Foundation.

"INTELPERC":

Intel Perceptual Computing SDK.

"OPENNI2":

OpenNI2 (for Kinect).

"OPENNI2_ASUS":

OpenNI2 (for Asus Xtion and Occipital Structure sensors).

"GPHOTO2":

gPhoto2 connection.

"GSTREAMER":

GStreamer.

"FFMPEG":

FFMPEG library.

"IMAGES":

OpenCV Image Sequence.

"ARAVIS":

Aravis SDK.

"OPENCV_MJPEG":

Built-in OpenCV MotionJPEG codec.

"INTEL_MFX":

Intel MediaSDK.

See also

videoWriter

Author

Simon Garnier, garnier@njit.edu

Examples

if (FALSE) { # \dontrun{
writer <- videoWriter("test.mp4", "H264", 25, 1080, 1920)
release(writer)
} # }