Gauche-ffmpeg Reference Manual

For version 0.2.0

last update: Tue Jan 22 2008

http://www.fixedpoint.jp/gauche-ffmpeg/

Warning: still unstable.

API for libavcodec

class: <avcodec-context>

Each instance of the class has a pointer to its own AVCodecContext.


method: close-input-avcodec (c <avcodec-context>)

Close the <avcodec-context> `c'. GC will do that finally even if you leave it open.


procedure: avcodec-version

Return the libavcodec's version, e.g. "51.27.0".


method: get-bit-rate (c <avcodec-context>)

(For audio only) Return the bit rate of `c'.


method: get-sample-rate (c <avcodec-context>)

(For audio only) Return the sample rate of `c'.


method: get-width (c <avcodec-context>)

(For video only) Return the width of `c'.


method: get-height (c <avcodec-context>)

(For video only) Return the height of `c'.


method: get-codec-name (c <avcodec-context>)

Return its codec name as a string, or #f if failed.


API for libavformat

class: <avformat-context>

Each instance of the class has a pointer to its own AVFormatContext.


procedure: avformat-version

Return the libavformat's version, e.g. "51.6.0".


method: open-input-avformat (path <string>)

Open and return a <avformat-context> of the av file of path `path', or #f if falied.


method: close-input-avformat (c <avformat-context>)

Close a <avformat-context> `c'. GC will do that after all if you do not care.


method: get-duration (c <avformat-context>)

Return the number of seconds in duration of `c'


method: get-file-name (c <avformat-context>)

Return the plain name of the media file of `c', or #f if failed.


procedure: call-with-input-avformat path proc

Call `proc' with a <avformat-context>, which newly open the file of path `path', as a single argument, and return the value `proc' does in case of success.

The <avformat-context> will be closed before the procedure returns with an error or without.


API for libavdevice

procedure: avdevice-version

Return the libavdevice's version, e.g. "52.0.0".


API for ffmpeg

method: open-input-acodec (c <avformat-context>)

method: open-input-vcodec (c <avformat-context>)

method: open-input-avcodec (c <avformat-context>)

The first form opens and returns a audio <avcodec-context> from `c'. The second one does a video <avcodec-context>. And the last simultaneously returns both values i.e. audio and video codec contexts in that order.

Any of them returns #f if failed.


method: get-frame-rate (fc <avformat-context>) (cc <avcodec-context>)

Return two numbers: the numerator and denominator of the frame rate of video with `fc' and `cc'.

Given `cc' must be a video context.

Note: the mothod will be not idempotent (currently at least) since it may occur a side effect for `fc'.


procedure: call-with-input-avcodec fc proc

Call `proc' with the following two arguments: an audio <avcodec-context> and video <avcodec-context>, which are newly opened from `fc'.

Return the value `proc' does in case of success. The <avcodec-context>s will be closed before the procedure returns with an error or without.


© 2006,2007 Takeshi Abe