Documentation:Advanced Use of VLC

From VideoLAN Wiki
Revision as of 00:45, 7 November 2006 by Dionoea (talk | contribs)
Jump to navigation Jump to search

Use the command line

TODO: completely outdated

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. You can also append --help-verbose if you want more detailed help.

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_file

VLC 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 UDP stream (sent by VLS or VLC's stream output), start VLC with:

% vlc  udp:[@:server_port]

If you use the default port (1234), vlc udp: will do. For more information, look at the Streaming Howto.

To receive an multicast UDP stream (sent by VLS or VLC's stream output), start VLC with:

% vlc udp:@multicast_address[:server_port]

To receive a SSM (source specific multicast) stream, you can use:

% vlc udp:server_address@multicast_address[:server_port]

This only works on OSs that support SSM (Windows XP and recent Linux kernels).

To receive a HTTP stream, start VLC with:

% vlc http://www.example.org/your_file.mpg

To receive a RTSP stream, start VLC with:</para>

% 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 <module> allows you to select the interface module.
  • --extraintf <module> 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 <module> allows you to select the audio output module.
  • --vout <module> allows you to select the video output module.
  • --memcpy <module> 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 <integer> sets the level of audio output (between 0 and 1024).
  • --aout-rate <integer> sets the audio output frequency (Hz). By default, VLC will try to autodetect this.
  • --desync <integer> compensates desynchronization of audio (ms). (If audio and video streams are not synchronized, use this setting to delay the audio stream)
  • --audio-filter <string> adds audio filters to the processing chain. Available filters are visual (visualizer with spectrum analyzer and oscilloscope), headphone (virtual headphone patialization) 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 <integer> sets the video window dimensions. By default, the video window size will be adjusted to match the video dimensions.
  • --zoom <float> adds a zoom factor.
  • --aspect-ratio <mode> forces source aspect ratio. Modes are 4x3, 16x9, ...
  • --spumargin <integer> forces SPU subtitles postion.
  • --filter <string> adds video filters to the processing chain. You can add several filters, separated by commas
  • --sub-filter <string> adds video subpictures filter to the processing chain.

Playlist options

  • --random plays files randomly forever.
  • --loop loops playlist on end.
  • --repeat repeats current item until another item is forced
  • --play-and-stop stops the playlist after each played item.

Network options

  • --server-port <integer> sets server port.
  • --iface <string> specifies the network interface to use.
  • --iface-addr <string> specifies your network interface IP address.
  • --mtu <integer> 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 <string> specifies interface default search path.
  • --plugin-path <string> specifies plugin search path.
  • --no-plugins-cache disables the plugin cache (plugins cache speeds up startup)
  • --dvd <string> specifies the default DVD device.
  • --vcd <string> specifies the default VCD device.
  • --program <integer> specifies program (SID) (for streams with several programs, like satellite ones).
  • --audio-type <integer> specifies the default audio type to use with dvds.
  • --audio-channel <integer> specifies the default audio channel to use with dvds.
  • --spu-channel <integer> specifies the default subtitle channel to use with dvds.
  • --version gives you information about the current VLC version.
  • --module <module> displays help about specified module. (Shortcut: -p)

<sect2><title>Item-specific options</title>

<para>There are many options that are related to items (like --novideo, --codec, --fullscreen).</para>

<para>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</para>

<para>Examples:</para>

<itemizedlist>

<listitem> <screen> <prompt>% </prompt><userinput>vlc file1.mpg :fullscreen file2.mpg</userinput> </screen> <para>will play file1.mpg in fullscreen mode and file2.mpg in the default mode (which is generally no fullscreen), whereas </para> <screen> <prompt>% </prompt><userinput>vlc --fullscreen file1.mpg file2.mpg</userinput> </screen> <para>will play both files in fullscreen mode</para> </listitem>


<listitem> <screen> <prompt>% </prompt><userinput>vlc --fullscreen file1.mpg :sub-file=file1.srt :no-fullscreen file2.mpg :filter=distort</userinput> </screen> <para>will 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)</para> </listitem>


</itemizedlist>

</sect2>

</sect1>

<sect1><title>Advanced use of filters</title>

<sect2><title>Filters</title>

<para>These are the old style VLC filters. They only apply to on screen display and thus cannot be streamed.</para>

<sect3><title>Deinterlacing video filter</title>

<para>Module name : <emphasis>deinterlace</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--deinterlace-mode {discard,blend,mean,bob,linear}</emphasis> choose a deinterlacing mode.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Invert video filter</title>

<para>Module name : <emphasis>invert</emphasis></para>

</sect3>

<sect3><title>Image properties filter</title>

<para>Module name : <emphasis>adjust</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--contrast <float></emphasis> Image contrast in the 0-2 range.</para></listitem> <listitem><para><emphasis>--brightness <float></emphasis> Image brightness in the 0-2 range.</para></listitem> <listitem><para><emphasis>--hue <integer></emphasis> Image hue in the 0-360 range</para></listitem> <listitem><para><emphasis>--saturation <float></emphasis> Image saturation in the 0-3 range.</para></listitem> <listitem><para><emphasis>--gamma <float></emphasis> Image gamma in the 0-10 range.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Wall video filter</title>

<para>Module name : <emphasis>wall</emphasis></para>

<para>This filter splits the output in several windows.</para>

<itemizedlist> <listitem><para><emphasis>--wall-cols <integer></emphasis> Number of columns.</para></listitem> <listitem><para><emphasis>--wall-rows <integer></emphasis> Number of rows.</para></listitem> <listitem><para><emphasis>--wall-active <string></emphasis> 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.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Video transformation filter</title>

<para>Module name : <emphasis>transform</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--transform-type {90,180,270,hflip,vflip}</emphasis> Select rotation angle or symmetry.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Distort video filter</title>

<para>Module name : <emphasis>distort</emphasis></para>

</sect3>

<sect3><title>Clone video filter</title>

<para>This filter clones the output window.</para>

<para>Module name : <emphasis>clone</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--clone-count <integer></emphasis> Number of clones.</para></listitem> <listitem><para><emphasis>--clone-vout-list <string></emphasis> Comma separated string of video output modules.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Crop video filter</title>

<para>Module name : <emphasis>crop</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--crop-geometry <string></emphasis> Set the geometry of the zone to crop. This is set as <width> x <height> + <left offset> + <top offset>.</para> </listitem> <listitem><para><emphasis>--autocrop</emphasis> Enable automatic black border cropping.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Motion blur filter</title>

<para>Module name : <emphasis>motionblur</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--blur-factor <integer></emphasis> Blur factor in the 1-127 range.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Video pictures blending</title>

<para>Module name : <emphasis>blend</emphasis></para>

</sect3>

<sect3><title>Video scaling filter</title>

<para>Module name : <emphasis>scale</emphasis></para>

</sect3>

</sect2>

<sect2><title>Subpictures Filters</title>

<para>These are the new VLC filters. They can be streamed.</para>

<sect3><title>Time display sub filter</title>

<para>Module name : <emphasis>time</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--time-format <string></emphasis> Time format string. You can use the following special characters %Y = year, %m = month, %d = day, %H = hour, %M = minute, %S = second.</para> </listitem> <listitem><para><emphasis>--time-x <integer></emphasis> X offset from the left in pixels.</para></listitem> <listitem><para><emphasis>--time-y <integer></emphasis> Y offset from the top in pixels.</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Marque display sub filter</title>

<para>Module name : <emphasis>marq</emphasis></para>

<itemizedlist> <listitem><para><emphasis>--marq-marquee <string></emphasis> Marquee text to display.</para></listitem> <listitem><para><emphasis>--marq-x <integer></emphasis> X offset from the left in pixels.</para></listitem> <listitem><para><emphasis>--marq-y <integer></emphasis> Y offset from the top in pixels.</para></listitem> <listitem><para><emphasis>--marq-timeout <timeout></emphasis> Defines the time the marquee must remain displayed in milliseconds. Default value is 0 (remain forever).</para></listitem> </itemizedlist>

</sect3>

<sect3><title>Logo video filter</title>

<para>Module name : <emphasis>logo</emphasis></para>

<para>This filter can be used both as an old style filter or a subpictures filter.</para>

<itemizedlist> <listitem><para><emphasis>--logo-file <string></emphasis> Full path of the PNG file to use.</para></listitem> <listitem><para><emphasis>--logo-x <integer></emphasis> X offset from the left in pixels.</para></listitem> <listitem><para><emphasis>--logo-y <integer></emphasis> Y offset from the top in pixels.</para></listitem> <listitem><para><emphasis>--logo-transparency <integer></emphasis> You can set the logo transparency value here (from 0 for full transparency to 255 for full opacity).</para></listitem> </itemizedlist>

<note><para>You can move the logo by left-clicking on it.</para></note>

</sect3>

</sect2>

</sect1>

<sect1><title>The HTTP interface</title>

<para> VLC ships with a little HTTP server integrated. It is used both to stream using HTTP, and for the HTTP remote control interface. </para>

<para> To start VLC with the HTTP interface, use: </para>

<screen> <prompt>% </prompt><userinput>vlc -I http [--http-src /directory/ --http-host host:port]</userinput> </screen>

<para>If you want to have both the "normal" interface and the HTTP interface, use <userinput>vlc --extraintf http</userinput>.</para>

<para> The HTTP interface will start listening at host:port (<all interfaces>:8080 if omitted), and will reproduce the structure of /directory at http://host:port/ ( vlc_source_path/share/http if omitted ). </para>


<para>Use a browser to go to http://your_host_machine:port. You should be taken to the main page</para>

<para> VLC is shipped with a set of files that should be enough for generic needs. It is also possible to customize pages. See <xref linkend="http" />. </para>


<para>Available pages are : </para>

<itemizedlist>

<listitem><para><emphasis>/index.html</emphasis> gives access to the playlist, allows you to add or delete items and to control playback.</para></listitem> <listitem><para><emphasis>/info.html</emphasis> gives you statistics and data about the usage of the server.</para></listitem> <listitem><para><emphasis>/admin/</emphasis>. 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 <emphasis>.access</emphasis> file in the <emphasis>VLC_directory/share/http/admin</emphasis> folder. (Each folder can be protected, see <xref linkend="http" /> for more details).</para></listitem> <listitem><para><emphasis>/vlm/</emphasis>. 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 the <ulink url="http://www.videolan.org/doc/streaming-howto/en">Streaming Howto</ulink>.</para></listitem>

</itemizedlist>

</sect1>

<sect1><title>Other control interfaces</title>

<para>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.</para>


<sect2><title>Hotkeys</title>

<para>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. </para> <para>Hotkeys can be hacked by : </para> <screen> <prompt>% </prompt><userinput>vlc --key-<function> '<code>'</userinput></screen>

<para> 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 <emphasis>--longhelp</emphasis> option for full list of functions). For example, for binding fullscreen to Ctrl-f, run :</para>

<screen> <prompt>% </prompt><userinput>vlc --key-fullscreen 'Ctrl-f'</userinput> </screen>

</sect2>

<sect2><title>RC and RTCI</title>

<para>These two interfaces allow you to control VLC from a command shell (possibly using a remote connexion or a Unix socket.</para>

<para>Start VLC with <emphasis>-I rc</emphasis> or <emphasis>--extraintf rc</emphasis>. When you get the <userinput>Remote control interface initialized, `h' for help</userinput> message, press h and Enter to get help about available commands.</para>

<para>To be able to remote connect to your VLC using a TCP socket (telnet-like connexion), use <emphasis>--rc-host your_host:port</emphasis>. Then, by connecting (using telnet or netcat) to the host on the given port, you will get the command shell.</para>

<para>To use a UNIX socket (local socket, this does not work for Windows), use <emphasis>--rc-unix /path/to/socket</emphasis>. Commands can then be passed using this UNIX socket.</para>

<para>The RTCI interface gives you more advanced options, such as marquee control for the marquee subpicture filter (See filter section).</para>

</sect2>

<sect2><title>Ncurses</title>

<para>This is a text interface, using ncurses library.</para>

<para>Start VLC with <emphasis>-I ncurses</emphasis> or <emphasis>--extraintf ncurses</emphasis>. You will then get something like that:</para>

<mediaobject>

 <imageobject>
   <imagedata fileref="images/play-howto/intf-ncurses-playlist.jpg" format="JPG" />
 </imageobject>
 <textobject><para>The ncurses interface</para></textobject>
 <para>The ncurses interface</para>

</mediaobject>

<para>Press h to get the list of all available commands, with a short description.</para>

<para>There is also a filebrowser available for the ncurses interface in order to add playlist items. Press 'B' to use it.</para>

<mediaobject>

 <imageobject>
   <imagedata fileref="images/play-howto/intf-ncurses-filebrowser.jpg" format="JPG" />
 </imageobject>
 <textobject><para>The ncurses filebrowser</para></textobject>
 <para>The ncurses filebrowser</para>

</mediaobject>

<para>You can set the filebrowser starting point by launching vlc with the <emphasis>--browse-dir</emphasis> option:</para>

<screen> <prompt>% </prompt><userinput>vlc -I ncurses --browse-dir /filebrowser/starting/point/</userinput> </screen>

</sect2>

<sect2><title>Gestures</title> <para>Gestures provide a simple mouse gestures control. TODO</para> </sect2>


</sect1>

<sect1><title>The Mozilla plugin</title>

<para> VLC can also be embedded in a web browser ! The following browsers are supported <ulink url="http://www.mozilla.org/">Mozilla</ulink>, <ulink url="http://www.mozilla.org/products/firefox/">Firefox</ulink> and <ulink url="http://www.apple.com/macosx/features/safari">Safari</ulink>. </para>

<sect2><title>Install the plugin</title>

<sect3><title>GNU/Linux Debian</title>

<para> You should already have the following lines in your <filename>/etc/apt/sources.list</filename>

file, if you run Debian Woody:

</para>

<programlisting>

    deb http://download.videolan.org/pub/videolan/debian woody main
    deb-src http://download.videolan.org/pub/videolan/debian woody main

</programlisting>

<para>

VLC'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:

</para>

<programlisting>

    deb http://download.videolan.org/pub/videolan/debian sid main
    deb-src http://download.videolan.org/pub/videolan/debian sid main

</programlisting>

<para> Install the <emphasis>mozilla-plugin-vlc</emphasis> package:</para>

<screen> <prompt># </prompt><userinput>apt-get update</userinput> <prompt># </prompt><userinput>apt-get install mozilla-plugin-vlc</userinput> </screen>

</sect3>

<sect3><title>Windows</title>

<para>Quit Firefox or Mozilla</para>

<para>Copy the two files in <emphasis>VLC_Installation_folder\mozilla</emphasis> (usually <emphasis>C:\Program Files\VideoLAN\VLC\mozilla</emphasis>) to your mozilla plugins directory (Usually <emphasis>C:\Program Files\Mozilla\plugins</emphasis> or <emphasis>C:\Program Files\Mozilla Firefox\plugins</emphasis>).</para>

<para>Restart Firefox or Mozilla</para>

</sect3>

<sect3><title>MacOS X</title>

<para><emphasis>The Mozilla/Safari plugin for MacOS X is only available from vlc version 0.8.5.1 and onwards.</emphasis></para> <para>Quit Safari browser</para> <para>Download the Mozilla/safari plugin package from <ulink url="http://www.videolan.org/vlc/download-macosx.html">MacOS X download page</ulink>.</para> <para>Run the installer from the dmg image.</para> </sect3>

<sect3><title> Compile the sources yourself </title>

<para>Please look at the <ulink url="http://developers.videolan.org">developers page</ulink> for information on how to do this. </para>

</sect3> </sect2>

<sect2><title>Use the plugin</title>

<para>If you open a link to a video file handled by the VLC plugin (To get the list of handled types, browse to <userinput>about:plugins</userinput>) or a page with an embedded video, the plugin should open and read the video.</para>

</sect2>

<sect2><title> Build HTML pages that use the plugin (version <= 0.8.5) </title>

<para><emphasis>The following API description is only valid uptill version 0.8.5 of the mozilla plugin.</emphasis></para>

<para>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.</para>

<para>The vlc plugin supports the following function calls:</para>

<itemizedlist> <listitem><para><command>play()</command> : Start playing media in the plugin.</para></listitem> <listitem><para><command>pause()</command> : Pause playback.</para></listitem> <listitem><para><command>stop()</command> : Stop media playback.</para></listitem> <listitem><para><command>fullscreen()</command> : Switch the video to full screen.</para></listitem> <listitem><para><command>set_volume(vol)</command> : Set the volume. <emphasis>vol</emphasis> has to be an int in the 0-200 range.</para></listitem> <listitem><para><command>get_volume()</command> : Get the current volume setting.</para></listitem> <listitem><para><command>mute()</command> : Toggle volume muting.</para></listitem> <listitem><para><command>set_int_variable(var_name, value)</command> : </para></listitem> <listitem><para><command>set_bool_variable(var_name, value)</command> : </para></listitem> <listitem><para><command>set_str_variable(var_name, value)</command> : </para></listitem> <listitem><para><command>get_int_variable(var_name)</command> : </para></listitem> <listitem><para><command>get_bool_variable(var_name)</command> : </para></listitem> <listitem><para><command>get_str_variable(var_name)</command> : </para></listitem> <listitem><para><command>clear_playlist()</command> : Clear the playlist.</para></listitem> <listitem><para><command>add_item(mrl)</command> : Append an item whose location is given by the Media Resource Locator to the playlist.</para></listitem> <listitem><para><command>next()</command></para></listitem> <listitem><para><command>previous()</command></para></listitem> <listitem><para><command>isplaying()</command> : return true if the plugin is playing something.</para></listitem> <listitem><para><command>get_length()</command> : Get the media's length in seconds.</para></listitem> <listitem><para><command>get_position()</command> : Get the current position in the media in percent.</para></listitem> <listitem><para><command>get_time()</command> : Get the current position in the media in seconds. </para></listitem> <listitem><para><command>seek(seconds,is_relative)</command> : If is_relative is true, seek relatively to current time, else seek from beginning of the stream. Seek time is specified in seconds.</para></listitem> </itemizedlist>

<para> Here are a few examples of HTML pages that use the Mozilla plugin. </para>

<simplesect><title> Example 1 </title>

<para> In this example, the plugin will read an HTTP stream inside the web page. If the user goes fullscreen, he will have to press <keycap>f</keycap> to go back in normal view.

</para>

<programlisting> <html> <head><title>Demo of VLC mozilla plugin</title></head>

<body>

<h1>Demo of VLC mozilla plugin - Example 1</h1>

<embed type="application/x-vlc-plugin"

        name="video1"
        autoplay="no" loop="yes" width="400" height="300"
        target="http://server.example.org/video1.vob" />

<br />

 <a href="javascript:;" onclick='document.video1.play()'>Play video1</a>
 <a href="javascript:;" onclick='document.video1.pause()'>Pause video1</a>
 <a href="javascript:;" onclick='document.video1.stop()'>Stop video1</a>
 <a href="javascript:;" onclick='document.video1.fullscreen()'>Fullscreen</a>

</body> </html> </programlisting>

</simplesect>

<simplesect><title> Example 2 </title>

<para> In this example, the plugin will read a multicast UDP stream in a dedicated video output window. </para>

<programlisting> <html> <head><title>Demo of VLC mozilla plugin</title></head>

<body>

<h1>Demo of VLC mozilla plugin - Example 2</h1>

<embed type="application/x-vlc-plugin"

        name="video2"
        autoplay="no" loop="no" hidden="yes"
        target="udp:@239.255.12.42" />

<br />

 <a href="javascript:;" onclick='document.video2.play()'>Play video2</a>
 <a href="javascript:;" onclick='document.video2.stop()'>Stop video2</a>
 <a href="javascript:;" onclick='document.video2.fullscreen()'>Fullscreen</a>

</body> </html> </programlisting>

</simplesect> </sect2>

<sect2><title> Build HTML pages that use the plugin (version > 0.8.5.1) </title>

<para>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.</para>

<para>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.</para>

<para>The vlc plugin knows the following objects:</para>

<itemizedlist> <listitem><para><command>audio</command> : Access audio properties.</para></listitem> <listitem><para><command>input</command> : Access input properties.</para></listitem> <listitem><para><command>playlist</command> : Access playlist properties.</para></listitem> <listitem><para><command>video</command> : Access video properties.</para></listitem> <listitem><para><command>log</command> : Access log properties.</para></listitem> <listitem><para><command>messages</command> : Access to log message properties.</para></listitem> <listitem><para><command>iterator</command> : Access to log iterator properties.</para></listitem> </itemizedlist>

<para>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. </para>

<programlisting> <html> <title>VLC Mozilla plugin test page</title> <body> <embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"

   width="640"
   height="480"
   id="vlc">

</embed> <script language="Javascript"> <!-- var vlc = document.getElementById("vlc"); vlc.audio.toggleMute(); !--> </script> </body> </html> </programlisting>

<simplesect><title> Root object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>VersionInfo</command> : returns version information string</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>vlc.versionInfo()</command> : returns version information string</para></listitem> </itemizedlist>

</simplesect>

<simplesect><title> Audio object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>vlc.audio.mute</command> : boolean value to mute and ummute the audio</para></listitem> <listitem><para><command>vlc.audio.volume</command> : a value between [0-200] which indicates a percentage of the volume.</para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>vlc.audio.toggleMute()</command> : boolean toggle that mutes and unmutes the audio based upon the previous state</para></listitem> </itemizedlist>

</simplesect>

<simplesect><title> Input object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>vlc.input.length</command> : length of the input file in number of milliseconds</para></listitem> <listitem><para><command>vlc.input.fps</command> : frames per second returned as a float</para></listitem> <listitem><para><command>vlc.input.hasVout</command> : a boolean that returns true when the video is being displayed, it returns false when video is not displayed</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>vlc.input.position</command> : normalized position in multimedia stream item given as a float value between [0.0 - 1.0]</para></listitem> <listitem><para><command>vlc.input.time</command> : the absolute position in time given in milliseconds, this property can be used to seek through the stream <programlisting> <!-- absolute seek in stream !--> vlc.input.time = <absolute seek> <!-- relative seek in stream !--> vlc.input.time = vlc.input.time + <relative seek> </programlisting></para></listitem> <listitem><para><command>vlc.input.state</command> : current state of the input chain given as enumeration (IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ERROR=6)</para></listitem> <listitem><para><command>vlc.input.rate</command> : input speed given as float (1.0 for normal speed, 0.5 for half speed, 2.0 for twice as fast, etc.)</para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist> </simplesect>

<simplesect><title> Playlist object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>vlc.playlist.itemCount</command> : number that returns the amount of items currently in the playlist</para></listitem> <listitem><para><command>vlc.playlist.isPlaying</command> : a boolean that returns true if the current playlist item is playing and false when it is not playing</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>vlc.playlist.add(mrl)</command> : add a playlist item as MRL (Multimedia Resource Locator). The MRL must be given as a string.</para></listitem> <listitem><para><command>vlc.playlist.add(mrl,name,options)</command> : add a playlist item as MRL (Multimedia Resource Locator), with metaname 'name' and options 'options'. All input values must be given as string.</para></listitem> <listitem><para><command>vlc.playlist.play()</command> : start playing the current playlist item</para></listitem> <listitem><para><command>vlc.playlist.togglePause()</command> : toggle the pause state for the current playlist item</para></listitem> <listitem><para><command>vlc.playlist.stop()</command> : stop playing the current playlist item</para></listitem> <listitem><para><command>vlc.playlist.next()</command> : iterate to the next playlist item</para></listitem> <listitem><para><command>vlc.playlist.prev()</command> : iterate to the previous playlist item</para></listitem> <listitem><para><command>vlc.playlist.clear()</command> : empty the current playlist, all items will be deleted from the playlist</para></listitem> <listitem><para><command>vlc.playlist.removeItem(number)</command> : remove the given item number (which cannot be greater then vlc.playlist.itemCount)</para></listitem> </itemizedlist> </simplesect>

<simplesect><title> Video object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>vlc.video.width</command> : returns the horizontal size of the video</para></listitem> <listitem><para><command>vlc.video.height</command> : returns the vertical size of the video</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>vlc.video.fullscreen</command> : 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.</para></listitem> <listitem><para><command>vlc.video.aspectRatio</command> : 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" </para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>vlc.video.toggleFullscreen()</command> : toggle the fullscreen mode based on the previous setting</para></listitem> </itemizedlist>

</simplesect>

<simplesect><title> Log object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>vlc.log.messages</command> : returns a messages object</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>vlc.log.verbosity</command> : 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.</para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

</simplesect>

<simplesect><title> Messages object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>messages.count</command> : returns number of messages in the log</para></listitem> <listitem><para><command>messages.severity</command> : number that indicates the severity of the log message (0 = info, 1 = error, 2 = warning, 3 = debug)</para></listitem> <listitem><para><command>message.name</command> : name of VLC module that printed the log message (e.g: main, http< directx, etc...)</para></listitem> <listitem><para><command>message.type</command> : type of VLC module that printed the log message (eg: input, access, vout, sout, etc...)</para></listitem> <listitem><para><command>message.message</command> : the message text</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>messages.clear()</command> : 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.</para></listitem> <listitem><para><command>messages.iterator()</command> : 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.</para></listitem> </itemizedlist>

</simplesect>

<simplesect><title> Iterator object </title>

<para>readonly properties</para> <itemizedlist> <listitem><para><command>iterator.hasNext</command> : returns a boolean that indicates when true, that wheter vlc.log.messages.next() returns the next message.</para></listitem> </itemizedlist>

<para>read/write properties</para> <itemizedlist> <listitem><para><command>none</command></para></listitem> </itemizedlist>

<para>methods</para> <itemizedlist> <listitem><para><command>iterator.next()</command> : returns the next message object it the log</para></listitem> </itemizedlist>

</simplesect>

</sect2>

</sect1>

</chapter>

This page is part of official VLC media player Documentation (User GuideStreaming HowToHacker GuideModules)
Please read the Documentation Editing Guidelines before you edit the documentation
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.