Chapter 4. Advanced use of VLC
Prev Next
Chapter 4. Advanced use of VLC
Table of Contents
Use the command line
Advanced use of filters
The HTTP interface
Other control interfaces
The Mozilla plugin
Use the command line
All standard operations of VLC should be available from the GUI. However, some complex operations can only be done from the command line and there are situations in which you don"t need or want a GUI. Here is the complete description of VLC"s command line and how to use it
You need to be quite comfortable with command line usage to use this.
Note
Windows users have to use the --option-name="value" syntax instead of the --option-name value syntax.
Getting help
VLC uses a modular structure. The core mainly manages communication between modules. All the multimedia processing is done by modules. There are input modules, demultiplexers, decoders, video output modules, ...
This chapter will only describe the "general" options, i.e. the core options. Each module adds new options. For example, the HTTP input module will add options for caching, proxy, authentication, ...
By using vlc --help, you will get the basic core options. vlc --longhelp will give all the basic options (core + modules). Adding --advanced will give the "advanced options" (for advanced users). So vlc --longhelp --advanced will give you all options.
Also, you might want to get debug informations. To do this, use -v or -vv (this will show lower severity messages). If your console supports it, you can add --color to get messages in color.
Opening streams
The following commands start VLC and start reading the given element(s)
Opening a file
Start VLC with:
% vlc my_fileVLC should be able to recognize the file type. If it does not, you can force demultiplexer and decoder (see below).
A list of all video and audio codecs supported by VLC is available on the VLC features list.
Opening a DVD or VCD, or an audio CD
Start VLC with:
For a DVD with menus :
% vlc dvd://[device][@raw_device][@[title][:[chapter][:angle]]]In most cases, vlc dvd:// or vlc dvd://[device] will do. [device] is for example /dev/dvd on GNU/Linux or D: on Windows (complete path to your DVD drive).
or (DVD without menus) :
% vlc dvdsimple://[device][@raw_device][@[title][:[chapter][:angle]]]or (VCD):
% vlc vcd://[device][@{E|P|E|T|S}[number]]or (Audio CD):
% vlc cdda://[device][@[track]]
Receiving a network stream
To receive an unicast RTP/UDP stream (sent by VLC"s stream output), start VLC with:
% vlc rtp://@:5004If 5004 is the port to which packets are sent. 1234 is another commonly used port number. For more information, look at the Streaming Howto
To receive an multicast RTP/UDP stream (sent by VLC"s stream output), start VLC with:
% vlc rtp://@multicast_address:portTo receive a SSM (source specific multicast) stream, you can use:
% vlc rtp://server_address@multicast_address:portThis only works on OSs that support SSM (Windows XP and Linux)
To receive a HTTP stream, start VLC with :
% vlc http://www.example.org/your_file.mpgTo receive a RTSP stream, start VLC with:
% vlc rtsp://www.example.org/your_stream
Modules selection
VLC always try to select the most appropriate interface, input and output modules, among the ones available on the system, according to the stream it is given to read. However, you may wish to force the use of a specific module with the following options.
--intf allows you to select the interface module.
--extraintf allows you to select extra interface modules that will be launched in addition to the main one. This is mainly useful for special control interfaces, like HTTP, RC (Remote Control), ... (see below)
--aout allows you to select the audio output module.
--vout allows you to select the video output module.
--memcpy allows you to choose a memory copy module. You should probably never touch that.
You can get a listing of the available modules by using vlc -l
Stream Output
The Stream output system allows vlc to become a streaming server.
For more details on the stream output system, please have a look at the Streaming Howto.
Other Options
Audio options
--noaudio disables audio output.
--mono forces VLC to treat the stream in mono audio.
--volume sets the level of audio output (between 0 and 1024)
--aout-rate sets the audio output frequency (Hz). By default, VLC will try to autodetect this.
--desync compensates desynchronization of audio (ms). (If audio and video streams are not synchronized, use this setting to delay the audio stream)
--audio-filter adds audio filters to the processing chain. Available filters are visual (visualizer with spectrum analyzer and oscilloscope), headphone (virtual headphone spatialization) and normalizer (volume normalizer)
Video options
--novideo disables video output.
--greyscale turns video output into grayscale mode.
--fullscreen ( or -f) sets fullscreen video.
--nooverlay disables hardware acceleration for the video output.
--width, --height sets the video window dimensions. By default, the video window size will be adjusted to match the video dimensions.
--zoom adds a zoom factor.
--aspect-ratio forces source aspect ratio. Modes are 4x3, 16x9, ...
--spumargin forces SPU subtitles postion.
--filter adds video filters to the processing chain. You can add several filters, separated by commas
--sout-transcode-sfilter adds video subpictures filter to the processing chain.
Playlist options
--random plays files randomly forever.
--loop loops playlist on end.
--repeat repeats the current item until another item is forced
--play-and-stop stops the playlist after each played item.
Network options
--server-port sets server port.
--iface specifies the network interface to use.
--iface-addr specifies your network interface IP address.
--mtu specifies the MTU of the network interface.
--ipv6 forces IPv6.
--ipv4 forces IPv4.
CPU options
You should probably not touch these options unless you know what you are doing.
--nommx disables the use of MMX CPU extensions.
--no3dn disables the use of 3D Now! CPU extensions.
--nommxext disables the use of MMX Ext CPU extensions.
--nosse disables the use of SSE CPU extensions.
--noaltivec disables the use of Altivec CPU extensions.
Miscellaneous options
--quiet deactivates all console messages.
--color displays color messages.
--search-path specifies interface default search path.
--plugin-path specifies plugin search path.
--no-plugins-cache disables the plugin cache (plugins cache speeds up startup)
--dvd specifies the default DVD device.
--vcd specifies the default VCD device.
--program specifies program (SID) (for streams with several programs, like satellite ones).
--audio-type specifies the default audio type to use with dvds.
--audio-channel specifies the default audio channel to use with dvds.
--spu-channel specifies the default subtitle channel to use with dvds.
--version gives you information about the current VLC version.
--module displays help about specified module. (Shortcut : -p)
Item-specific options
There are many options that are related to items (like --novideo, --codec, --fullscreen).
For all of these, you have the possibility to make them item-specific, using ":" instead of "--" and putting the option just after the concerned item
Examples:
% vlc file1.mpg :fullscreen file2.mpgwill play file1.mpg in fullscreen mode and file2.mpg in the default mode (which is generally no fullscreen), whereas
% vlc --fullscreen file1.mpg file2.mpgwill play both files in fullscreen mode
% vlc --fullscreen file1.mpg :sub-file=file1.srt :no-fullscreen file2.mpg :filter=distortwill play file1.mpg in windowed (no-fullscreen) mode with the subtitles file file1.srt and will play file2.mpg with video filter distort enabled in fullscreen mode (item-specific options override global options)
Advanced use of filters
Filters
These are the old style VLC filters. They only apply to on screen display and thus cannot be streamed.
Deinterlacing video filter
Module name : deinterlace
--deinterlace-mode {discard,blend,mean,bob,linear} choose a deinterlacing mode.
Invert video filter
Module name : invert
Image properties filter
Module name : adjust
--contrast Image contrast in the 0-2 range.
--brightness Image brightness in the 0-2 range.
--hue Image hue in the 0-360range
--saturation Image saturation in the 0-3 range.
--gamma Image gamma in the 0-10 range.
Wall video filter
Module name : wall
This filter splits the output in several windows.
--wall-cols Number of columns.
--wall-rows Number of rows.
--wall-active Select the windows you want to display. To select windows 2 and 4 you would write --wall-active 2,4 . When this option isn"t specified, all windows are displayed.
Video transformation filter
Module name : transform
--transform-type {90,180,270,hflip,vflip} Select rotation angle or symmetry.
Distort video filter
Module name : distort
Clone video filter
This filter clones the output window.
Module name : clone
--clone-count Number of clones.
--clone-vout-list Comma separated string of video output modules.
Crop video filter
Module name : crop
--crop-geometry Set the geometry of the zone to crop. This is set as x + + .
--autocrop Enable automatic black border cropping.
Motion blur filter
Module name : motionblur
--blur-factor Blur factor in the 1-127 range.
Video pictures blending
Module name : blend
Video scaling filter
Module name : scale
Subpictures Filters
These are the new VLC filters. They can be streamed.
Time display sub filter
Module name : time
--time-format Time format string. You can use the following special characters %Y = year, %m = month, %d = day, %H = hour, %M = minute, %S = second.
--time-x X offset from the left in pixels.
--time-y Y offset from the top in pixels.
Marque display sub filter
Module name : marq
--marq-marquee Marquee text to display.
--marq-x X offset from the left in pixels.
--marq-y Y offset from the top in pixels.
--marq-timeout Defines the time the marquee must remain displayed in milliseconds. Default value is 0 (remain forever).
Logo video filter
Module name : logo
This filter can be used both as an old style filter or a subpictures filter.
--logo-file Full path of the PNG file to use.
--logo-x X offset from the left in pixels.
--logo-y Y offset from the top in pixels.
--logo-transparency You can set the logo transparency value here (from 0 for full transparency to 255 for full opacity).
Note
You can move the logo by left-clicking on it.
The HTTP interface
VLC ships with a little HTTP server integrated. It is used both to stream using HTTP, and for the HTTP remote control interface.
To start VLC with the HTTP interface, use:
% vlc -I http [--http-src /directory/ --http-host host:port]If you want to have both the "normal" interface and the HTTP interface, use vlc --extraintf http.
The HTTP interface will start listening at host:port (:8080 if omitted), and will reproduce the structure of /directory at http://host:port/ ( vlc_source_path/share/http if omitted ).
Use a browser to go to http://your_host_machine:port. You should be taken to the main page
VLC is shipped with a set of files that should be enough for generic needs. It is also possible to customize pages. See Appendix B, Building pages for the HTTP interface.
Available pages are :
/index.html gives access to the playlist, allows you to add or delete items and to control playback.
/info.html gives you statistics and data about the usage of the server.
/admin/. This folder gives more power and is therefore protected by a login/password. The default couple is admin/admin. The passwords and users can be changed in the .access file in theVLC_directory/share/http/admin folder. (Each folder can be protected, see Appendix B, Building pages for the HTTP interface for more details).
/vlm/. This folder allows you to control the VideoLAN manager (VLM). The VLM allows you to stream several input streams with only one VLC instance. For more information about VLM, please look at theStreaming Howto.
Other control interfaces
VLC includes a number of so-called interfaces that are not really interfaces, but means of controlling VLC. Nevertheless, they are enabled by setting them as interface or extra interface, either in the Preferences, in General/Interface, or using -I or --extraintf on the command line.
Hotkeys
This module allows you to control VLC and playback via hotkeys. It is always enabled by default. You can use hotkeys in the video output window.
Hotkeys can be hacked by :
% vlc --key- ""Code is composed by modifiers keys (Alt, Shift, Ctrl, Meta, Command) separated by a dash (-) and terminated by a key (a...z, +, =, -, ",", +, , `, /, ;, ", \, [, ], *, Left, Right, Up, Down, Space, Enter, F1...F12, Home, End, Menu, Esc, Page Up, Page Down, Tab, Backspace, Mouse Wheel Up and Mouse Wheel Down). Main controls are available from hotkeys, such as : fullscreen, play-pause, faster, slower, next, prev, stop, quit, vol-up, etc. (use the --longhelp option for full list of functions). For example, for binding fullscreen to Ctrl-f, run :
% vlc --key-fullscreen "Ctrl-f"
RC and RTCI
These two interfaces allow you to control VLC from a command shell (possibly using a remote connexion or a Unix socket.
Start VLC with -I rc or --extraintf rc. When you get the Remote control interface initialized, `h" for help message, press h and Enter to get help about available commands.
To be able to remote connect to your VLC using a TCP socket (telnet-like connexion), use --rc-host your_host:port. Then, by connecting (using telnet or netcat) to the host on the given port, you will get the command shell.
To use a UNIX socket (local socket, this does not work for Windows), use --rc-unix /path/to/socket. Commands can then be passed using this UNIX socket.
The RTCI interface gives you more advanced options, such as marquee control for the marquee subpicture filter (See filter section).
Ncurses
This is a text interface, using ncurses library.
Start VLC with -I ncurses or --extraintf ncurses. You will then get something like that:
[D]
The ncurses interface
Press h to get the list of all available commands, with a short description.
There is also a filebrowser available for the ncurses interface in order to add playlist items. Press "B" to use it.
[D]
The ncurses filebrowser
You can set the filebrowser starting point by launching vlc with the --browse-dir option:
% vlc -I ncurses --browse-dir /filebrowser/starting/point/
Gestures
Gestures provide a simple mouse gestures control. TODO
The Mozilla plugin
VLC can also be embedded in a web browser ! The following browsers are supported Mozilla, Firefox and Safari.
Install the plugin
GNU/Linux Debian
You should already have the following lines in your /etc/apt/sources.list file, if you run Debian Woody:
deb http://download.videolan.org/pub/videolan/debian woody main deb-src http://download.videolan.org/pub/videolan/debian woody mainVLC"s latest packaged version is always in the official Debian unstable branch. However you should still use our apt-get line if you need libdvdcss in its latest version:
deb http://download.videolan.org/pub/videolan/debian sid main deb-src http://download.videolan.org/pub/videolan/debian sid mainInstall the mozilla-plugin-vlc package:
# apt-get update# apt-get install mozilla-plugin-vlc
Windows
Quit Firefox or Mozilla
Copy the two files in VLC_Installation_folder\mozilla (usually C:\Program Files\VideoLAN\VLC\mozilla) to your mozilla plugins directory (Usually C:\Program Files\Mozilla\plugins or C:\Program Files\Mozilla Firefox\plugins).
Restart Firefox or Mozilla
MacOS X
The Mozilla/Safari plugin for MacOS X is only available from vlc version 0.8.5.1 and onwards.
Quit Safari browser
Download the Mozilla/safari plugin package from MacOS X download page.
Run the installer from the dmg image.
Compile the sources yourself
Please look at the developers page for information on how to do this.
Use the plugin
If you open a link to a video file handled by the VLC plugin (To get the list of handled types, browse to about:plugins) or a page with an embedded video, the plugin should open and read the video.
Build HTML pages that use the plugin (version <= 0.8.5)
The following API description is only valid uptill version 0.8.5 of the mozilla plugin.
Additionally to viewing video on all pages, you can build custom pages that will use the advanced features of the plugin, using Javascript functions to control playback or extract information from the plugin.
The vlc plugin supports the following function calls:
play() : Start playing media in the plugin.
pause() : Pause playback.
stop() : Stop media playback.
fullscreen() : Switch the video to full screen.
set_volume(vol) : Set the volume. vol has to be an int in the 0-200 range.
get_volume() : Get the current volume setting.
mute() : Toggle volume muting.
set_int_variable(var_name, value) :
set_bool_variable(var_name, value) :
set_str_variable(var_name, value) :
get_int_variable(var_name) :
get_bool_variable(var_name) :
get_str_variable(var_name) :
clear_playlist() : Clear the playlist.
add_item(mrl) : Append an item whose location is given by the Media Resource Locator to the playlist.
next()
previous()
isplaying() : return true if the plugin is playing something.
get_length() : Get the media"s length in seconds.
get_position() : Get the current position in the media in percent.
get_time() : Get the current position in the media in seconds.
seek(seconds,is_relative) : If is_relative is true, seek relatively to current time, else seek from beginning of the stream. Seek time is specified in seconds.
Here are a few examples of HTML pages that use the Mozilla plugin.
Example 1
In this example, the plugin will read an HTTP stream inside the web page. If the user goes fullscreen, he will have to press f to go back in normal view.
Demo of VLC mozilla pluginDemo of VLC mozilla plugin - Example 1
Play video1 Pause video1 Stop video1 FullscreenExample 2
In this example, the plugin will read a multicast RTP/UDP stream in a dedicated video output window.
Demo of VLC mozilla pluginDemo of VLC mozilla plugin - Example 2
Play video2 Stop video2 FullscreenBuild HTML pages that use the plugin (version > 0.8.5.1)
Additionally to viewing video on all pages, you can build custom pages that will use the advanced features of the plugin, using Javascript functions to control playback or extract information from the plugin.
The vlc plugin exports serveral objects that can be accessed for setting and getting information. When used improperly the API"s will throw an exception that includes a string that explains what happened. For example when asking for vlc.input.length when there is no playlist item playing.
The vlc plugin knows the following objects:
audio : Access audio properties.
input : Access input properties.
playlist : Access playlist properties.
video : Access video properties.
log : Access log properties.
messages : Access to log message properties.
iterator : Access to log iterator properties.
The following JavaScript code shows howto get a reference to the vlc plugin. This reference can then be used to access the objects of the vlc plugin.
VLC Mozilla plugin test pageRoot objectreadonly properties
VersionInfo : returns version information string
read/write properties
none
methods
vlc.versionInfo() : returns version information string
Audio object
readonly properties
none
read/write properties
vlc.audio.mute : boolean value to mute and ummute the audio
vlc.audio.volume : a value between [0-200] which indicates a percentage of the volume.
vlc.audio.track : a value between [0-65535] which indicates the audio track to play or that is playing. (supported in vlc version > 0.8.6)
vlc.audio.channel : an integer between 1 and 5 that indicates which audio channel mode is used, values can be: "1=stereo", "2=reverse stereo", "3=left", "4=right", "5=dolby". Use vlc.audio.channel to check if setting of the new audio channel has succeeded. (supported in vlc version > 0.8.6)
Audio Channel:StereoReverse stereoLeftRightDolby
vlc.audio.toggleMute() : boolean toggle that mutes and unmutes the audio based upon the previous state
Input object
readonly properties
vlc.input.length : length of the input file in number of milliseconds
vlc.input.fps : frames per second returned as a float
vlc.input.hasVout : a boolean that returns true when the video is being displayed, it returns false when video is not displayed
read/write properties
vlc.input.position : normalized position in multimedia stream item given as a float value between [0.0 - 1.0]
vlc.input.time : the absolute position in time given in milliseconds, this property can be used to seek through the stream
vlc.input.time = vlc.input.time = vlc.input.time +
vlc.input.state : current state of the input chain given as enumeration (IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ERROR=6)
vlc.input.rate : input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.)
methods
none
Playlist object
readonly properties
vlc.playlist.itemCount : number that returns the amount of items currently in the playlist
vlc.playlist.isPlaying : a boolean that returns true if the current playlist item is playing and false when it is not playing
read/write properties
none
methods
vlc.playlist.add(mrl) : add a playlist item as MRL (Multimedia Resource Locator). The MRL must be given as a string.
vlc.playlist.add(mrl,name,options) : add a playlist item as MRL (Multimedia Resource Locator), with metaname "name" and options "options". All input values must be given as string.
vlc.playlist.play() : start playing the current playlist item
vlc.playlist.togglePause() : toggle the pause state for the current playlist item
vlc.playlist.stop() : stop playing the current playlist item
vlc.playlist.next() : iterate to the next playlist item
vlc.playlist.prev() : iterate to the previous playlist item
vlc.playlist.clear() : empty the current playlist, all items will be deleted from the playlist
vlc.playlist.removeItem(number) : remove the given item number (which cannot be greater then vlc.playlist.itemCount)
Video object
readonly properties
vlc.video.width : returns the horizontal size of the video
vlc.video.height : returns the vertical size of the video
read/write properties
vlc.video.fullscreen : when set to true the video will be displayed in fullscreen mode, when set to false the video will be shown inside the video output size. The property takes a boolean as input.
vlc.video.aspectRatio : get and set the aspect ratio to use in the video screen. The property takes a string as input value. Valid values are: "1:1", "4:3", "16:9", "16:10", "221:100" and "5:4"
methods
vlc.video.toggleFullscreen() : toggle the fullscreen mode based on the previous setting
Log object
readonly properties
vlc.log.messages : returns a messages object
read/write properties
vlc.log.verbosity : write number [-1,0,1,2,3] for changing the verbosity level of the log messages. The numbers have the following meaning: -1 disable, 0 info, 1 error, 2 warning, 3 debug.
methods
none
Messages object
readonly properties
messages.count : returns number of messages in the log
messages.severity : number that indicates the severity of the log message (0 = info, 1 = error, 2 = warning, 3 = debug)
message.name : name of VLC module that printed the log message (e.g: main, http, directx, etc...)
message.type : type of VLC module that printed the log message (eg: input, access, vout, sout, etc...)
message.message : the message text
read/write properties
none
methods
messages.clear() : clear the current log buffer. It should be called as frequently as possible to not overflow the plugins logging buffer. Call this method after the log messages of interest are read.
messages.iterator() : returns a messages iterator object, which is used to iterate over the messages in the log. Don"t clear the log buffer while holding an iterator object.
Iterator object
readonly properties
iterator.hasNext : returns a boolean that indicates when true, that wheter vlc.log.messages.next() returns the next message.
read/write properties
none
methods
iterator.next() : returns the next message object it the log
Prev Next
Chapter 3. Basic use of VLC Home Appendix A. GNU General Public License