Perl bindings for libav/ffmpeg
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



Module to make transcoding, saving and broadcasting AV streams simple.

Documentation, usage and examples are in perldoc. To view:
perldoc lib/AV/

See lib/AV/Streamer/App/ for a sample command-line
application similar to ffmpeg.



This module requires libav development libraries, >= 0.7
(available from

Debian: aptitude install libavformat-dev libavcodec-dev pkg-config

To install this module type the following:

   perl Makefile.PL
   make test
   make install



This module is an attempt to encapsulate high-level media streaming
operations in a perl module. It does this by wrapping libav in an XS
interface which is utilized by various sub-modules. (libav was
formally the FFmpeg project, but forked off due to developer drama).

To understand how this module is put together, you must be familiar
with how media files are structured and how libav reflects this.

A media file or media stream is generally encapsulated in a transport
format which can contain any number of video, audio or subtitle
streams. For a concrete example think of a DVD (containing a MPEG TS),
which lets you select different audio or subtitles for the same video
stream. Common transport or container formats are MOV, AVI,
WebM/Matroska, FLV, MPEG TS (transport stream), OGG.  These transports
are handled by libavformat which understands how to mux and demux
streams inside a given container. A container open for reading or
writing with associated parameters is represented by an

Each stream inside a container contains video or audio data which is
encoded and decoded by a codec. Common codecs are MPEG1 video, MPEG2
(DVD video), MPEG3 audio (aka MP3), MPEG4 and h264, WMV, AAC, FLV,
Vorbis, Theora. libavcodec contains a vast and impressive number of
codecs, and a coder or decoder instance is represented by an
AVCodecContext which is an AVCodec reference plus encoding/decoding

Example media format (DVD):
| Transport (MPEG-TS)                  |
|                                      |
|    |------------------|              |
|    | stream 1 (video) |              |
|    |------------------|              |
|                                      |
|    |--------------------------|      |
|    | stream 2 (english audio) |      |
|    |--------------------------|      |
|                                      |
|    |--------------------------|      |
|    | stream 2 (german audio)  |      |
|    |--------------------------|      |
|                                      |
|    |------------------------------|  |
|    | stream 3 (english subtitles) |  |
|    |------------------------------|  |
|                                      |
|    |------------------------------|  |
|    | stream 4 (german subtitles)  |  |
|    |------------------------------|  |
|                                      |

If you were to read in an AVI file and decode it for playback with
libavformat and libavcodec, you would first create an AVFormatContext
for reading AVI files. Once the file is opened and loaded, you would
be able to access the audio and video streams contained therein. You
would locate the appropriate AVCodecs for decoding the stream data and
get AVCodecContexts for each stream.

This module attempts to simplify this process. See
AV::Streamer POD docs for details on usage.



This library makes use of code copied from Max Vohra's Video::FFmpeg
module and Martin Boehm's avcodec sample application. Absolutely no
help at all was given by anyone from the FFmpeg and libav teams who
like to pretend I don't exist.


Copyright (C) 2011 by Mischa Spiegelmock

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.