MEncoderOutput

Output object writing images to a video file using MEncoder.  MEncoder is started and a pipe is opened for writing images.

Note that there are still countries with laws restricting the distribution of free video compression software for some codecs.

Inherits

See also

Summary
MEncoderOutputOutput object writing images to a video file using MEncoder.
Functions
MEncoderOutput.newRun mencoder and connect to it using a pipe.
closeClose the video encoder.
inspectReturn string with information about this object.
writeWrite a video frame.
status?Indicates whether the video is still open for writing.

Functions

MEncoderOutput.new

def MEncoderOutput.new(mrl,  
fps =  25,
params =  '-ovc lavc -lavcopts vcodec=msmpeg4:vhq:vbitrate=1000:keyint=100 -cache 8192')

Run mencoder and connect to it using a pipe.  The default list of command line parameters will select FFmpeg’s lossless video codec and will use AVI as a container format.

For the best result in terms of rate/distortion you should record the video using the lossless ffv1 codec and then later use MEncoder to do multi pass encoding (see description of “vpass=<1-3>” in the MEncoder man page).  The following string of command line parameters can be used to perform ffv1 compression: “-ovc lavc -lavcopts vcodec=ffv1 -cache 8192”

Parameters

mrlFile to save to
fpsframe rate for video file
paramscommand line parameters specifying container format and codec

close

def close

Close the video encoder.  You can call this method to force destruction of this object.

inspect

def inspect

Return string with information about this object.

Returns

Returns a string which looks like this: “MEncoderOutput( \”file.mpg\” )”

write

def write(image)

Write a video frame.

Parameters

imageimage of type Frame_ or Sequence_

status?

def status?

Indicates whether the video is still open for writing.

def MEncoderOutput.new(mrl,  
fps =  25,
params =  '-ovc lavc -lavcopts vcodec=msmpeg4:vhq:vbitrate=1000:keyint=100 -cache 8192')
Run mencoder and connect to it using a pipe.
def close
Close the video encoder.
def inspect
Return string with information about this object.
def write(image)
Write a video frame.
def status?
Indicates whether the video is still open for writing.
Base class for different types of output sources for images.
This class provides fast (multi-dimensional) Ruby arrays where all elements are of the same type.
Close