Mod vlc

From FreeSWITCH Wiki
Jump to: navigation, search



You HAVE to have libvlc version 1.2 or later for mod_vlc to work. Both for the reason that libvlc version 1.2 is LGPL and because there are new APIs in 1.2 that are required.

The Debian Wheezy package for vlc had a segfault in one of the lua playlist plugins making that version of vlc useless with Freeswitch. If you enable the debian wheezy-backports and install that version(2.1) of vlc it'll work fine.


Does mod_vlc support path resolution for sound files like other FS modules.
Not yet, no.
Does mod_vlc allow multiple channels to stream the same audio source?
Yes, but right now it will open a separate stream from the audio source for each caller. It is on the TODO list to allow additional callers to share the same source stream.
Does mod_vlc support [random audio file or stream] ?
Honestly the answer is probably yes. Since vlc has a huge list of supported audio codecs. Basically give it a try in vlc player. If that works then it'll most likely work in mod_vlc.
Can mod_vlc be used to stream calls?
Yes, now it can. Use the format of the --sout option in vlc. Such as: <action application="record" data="#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128,deinterlace}:


To stream raw audio, use the following command in your dialplan <action application="record" data ="vlc://#standard{access=http,mux=raw,dst=interfaceip:someport/somevariable}"/>
The stream can be accessed using an http get request to http://ipoffreeswitchserver:port/variablename (You won't be able to play it vlc)

This can be useful if you want to stream conferences raw (possibly for ASR applications, and then you can do end-pointing using ESL because mod_conference throws events on start/end of speech). In the conference profile you'd do something like:

<param name="auto-record" value="vlc://#standard{access=http,mux=raw,dst=${conference_name}}"/>

To stream raw audio, use the following command in your dialplan:

<action application="record" data ="vlc://#standard{access=http,mux=raw,dst=localip:someport/somevariable}"/>

If you are peculiar about latency, you might want to use access=file, let the module write to a file, and as it only does write lock you can read from the same file through an external script and stream yourself. Its much faster, the only catch is that you need to take care of synchronization.

Can you add [random feature] to mod_vlc?
There are four good ways to have the feature added: Add the feature request to the list below, catch me on IRC (quentusrex or quentusrex_), contact or send me a patch.


Using vlc from wheezy-backports repo

run these commands as a user with sudo access:

sudo echo 'deb wheezy-backports main contrib non-free' >> /etc/apt/sources.list

sudo echo 'Package: *' >> /etc/apt/preferences.d/backports.pref

sudo echo 'Pin: release a=backports' >> /etc/apt/preferences.d/backports.pref

sudo echo 'Pin-Priority: 10' >> /etc/apt/preferences.d/backports.pref

sudo apt-get update

sudo apt-get -t wheezy-backports install vlc-dbg libvlc-dev libvlccore-dev

or as root:

echo 'deb wheezy-backports main contrib non-free' >> /etc/apt/sources.list

echo 'Package: *' >> /etc/apt/preferences.d/backports.pref

echo 'Pin: release a=backports' >> /etc/apt/preferences.d/backports.pref

echo 'Pin-Priority: 10' >> /etc/apt/preferences.d/backports.pref

apt-get update

apt-get -t wheezy-backports install vlc-dbg libvlc-dev libvlccore-dev

Using vlc git repository

1. install required packages

apt-get install libavcodec-dev libavutil-dev libavformat-dev liba52-0.7.4-dev

2. Checkout libvlc using the following:

git:// to get 

3. configure the libvlc:

./configure --prefix=/usr/ --disable-vlc --disable-lua --disable-mad --disable-swscale --disable-postproc --disable-xcb --disable-alsa

4. make and make install, and you're ready to go.

Installing on Ubuntu

Install Dependencies

apt-get install libavcodec-dev libavutil-dev libavformat-dev liba52-0.7.4-dev libvlc-dev

Enable module in build

Edit modules.conf in source directory to add mod_vlc.

formats/mod_vlc    <--- NEW


./configure && make install

You can also use make mod_vlc-install

Enable module in runtime

Edit /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml to add mod_vlc to the list.

    <load module="mod_native_file"/>
    <!--For icecast/mp3 streams/files-->
    <load module="mod_vlc"/>          <------- NEW

Load the Module

from the CLI, run "load mod_vlc"

From packaged library

Debian now has VLC 2.0 packaged (squeeze-backports/wheezy). I am now testing with the packaged version of the library.

For Mac OS

Download and install VLC for mac to /Applications/

and then compile with the following Makefile

include $(BASE)/build/modmake.rules

Usage Examples

The dialplan syntax I use are one of the following:

  <action application="playback" data="vlc://"/>
  <action application="playback" data="vlc://mms://"/>
  <action application="playback" data="vlc:///usr/local/freeswitch/sounds/vlc.mp3"/>
  <action application="record" data="vlc:///path/to/file.mp3"/>


If you are having troubles, first change the value of vlc_args in mod_vlc.c.

The documentation for the libvlc library is located at:


Following list not in priority order.

  1. Determine if a new instance is needed for each independant inbound stream, or if a global instance can handle all inbound and outbound streams
  2. Test multiple concurrent listeners to the same stream.
    1. Look into have a single libvlc thread stream the file and write to the audio buffer, and multiple readers
    2. Test multiple input streams simultaniously
    3. Load test multiple requests(both multiple to the same stream, and multiple unique streams) to look for issues
  3. Enable proper seeking support
  4. Add video support
  5. Confirm streaming from file works on differnt sample rates. 8k, 16k, etc.


Finally got back around to working on this module and getting it to a working public state. -Quentusrex, 20 months after starting the module.