Tuesday, August 2, 2016

Connecting to Desktop VLC

In this guide you will learn how to connect VLC Direct Pro Free with VLC Player (installed in Windows, Linux or Mac). Once connected, you will be able to stream all kind of media content (videos, music and photos) between PC/Mac and Android devices.

Before you start, you must have installed VLC Player in your PC or Mac. You can find it <HERE>

If you have installed VLC 2.0.1 or VLC 2.0.4, please uninstall it and install VLC 2.2.4 because 2.0.1 and 2.0.4 versions crash when streaming to Android.
Other versions that work fine: 1.1.112.0.0 ,2.0.32.0.52.0.62.0.72.0.82.1.02.1.12.1.2, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4

Once you have installed VLC in your PC or Mac, you must configure VLC to connect with VLC Direct Pro Free

No matter whether you have VLC installed in a PC, Linux or Mac OSX, the player needs to be started with some specific parameters in order to be able to connect with VLC Direct Pro Free and stream media to and from Android.

If you have VLC installed in Windows, we recommend you to use VLCDIRECT.BAT script which automatically configures VLC to connect with VLC Direct Pro Free. You can find it <HERE>

 

Running VLC from Command Line

If you are a Linux or Mac OSX user, or if you simply want to have full control of the VLC startup process, you can use the command line approach.

The parameters to be used will depend on the version of VLC you have installed.

To run the commands required to start VLC with parameters you must open a terminal. In windows you can do that in Windows->Search->cmd<enter>





Running VLC 1.1.x series from command line

VLC will start the web interface listening in port 8080, if the port is used, it will try with 8081 and so on until it finds an available port.

Be carefull because VLC won't tell you in which port is actually listening. VLC Direct Pro Free will try to find it in port 8080, but if VLC listens in other you must change it in VLC Direct Pro Free->menu->settings->Manual Configuration->Web Interface Port

You can check on which port is VLC listening from your web browser:

http://127.0.0.1:8080/requests/status.xml
http://127.0.0.1:8081/requests/status.xml
http://127.0.0.1:8082/requests/status.xml

the one which returns an xml response is the port to be used.
Another way to know the port is with the VLC messages log:



The good thing about VLC 1.x series is that the program only requires one parameter:
--extraintf=http

Here's the command line to execute for all operating systems supported:



Windows (32bits):
"C:\Program Files\VideoLan\VLC\vlc.exe" --extraintf=http
Windows (64bits):
"C:\Program Files (x86)\VideoLan\VLC\vlc.exe" --extraintf=http

Linux: 
vlc --extraintf=http
Mac OSX:
/Applications/VLC.app/Contents/MacOS/VLC --extraintf=http
Parameters Description
  • --extraintf=http: Automaticaly enables the web interface



Configure and run VLC 2.0.x from command line

CONFIGURATION
By default, the web interface in VLC 2.0.x series are only accessible from localhost. To allow VLC Direct Pro Free connect to the VLC web interface, you need to configure VLC to listen for remote connections (i.e connections from LAN or Internet).

If you see the messages log of VLC you will see something like this when you enable the web interface:



Note the lines that start with "restricted... ". This means VLC is only listening only for connections coming from localhost.

By default, the configuration file that must be edited is named .hosts or .host, and it is located in the following paths depending on the operating system:

Windows (32bits): C:\Program Files\VideoLan\VLC\lua\http\.hosts
Windows (64bits): C:\Program Files (x86)\VideoLan\VLC\lua\http\.hosts
Linux: /usr/share/vlc/lua/http/.host
Mac: /Applications/VLC.app/Contents/MacOS/share/http/.hosts

Note that you might need administrator (or root) privileges to find, modify and save the file.

Once you find the file, open it with your favourite text editor, and make it look exactly like the text below. Please note the ashes (#) in the begining of the lines.


# ------------------------------------------------------------ START OF THE FILE -----------------------------------------------
#
# Access-list for VLC HTTP interface
# $Id$
#

# localhost
#::1
127.0.0.1

# link-local addresses
#fe80::/64

# private addresses
#fc00::/7
#fec0::/10

# The world (uncommenting these 2 lines is not quite safe)
#::/0
# ------------------------------------------------------------ END OF THE FILE -----------------------------------------------

Then save the file, restart VLC, enable its web interface and run the Automatic Connection Wizard in VLC Direct Pro Free.

After this change, you should see in the VLC messages Box this lines:



Note that this time appears more "restricted... " lines. This means VLC is also listening for connections from any privated network: 192.168.0.0, 172.16.0.0, and 10.0.0.0.

VLC Direct Pro Free should find VLC now.

Important Notes:
This configuration presumes you have your PC/Mac and your android device both connected to the same wifi router. That means both devices are in the same LAN, sharing the same network.




RUNNING VLC
Once you have VLC properly configured to listen to remote connections, run VLC using the following parameters:
--sout-ffmpeg-strict=-2
--rtsp-timeout=99999
--extraintf=http
--http-port=8080

The following are the command lines for each operating system


Windows (32bits):
"C:\Program Files\VideoLan\VLC\vlc.exe" --rtsp-timeout=99999 --sout-ffmpeg-strict=-2 --extraintf=http --http-port=8080

Windows (64bits):
"C:\Program Files (x86)\VideoLan\VLC\vlc.exe" --rtsp-timeout=99999 --sout-ffmpeg-strict=-2 --extraintf=http --http-port=8080 
Linux:
vlc --rtsp-timeout=99999 --sout-ffmpeg-strict=-2 --extraintf=http --http-port=8080


Mac:
/Applications/VLC.app/Contents/MacOS/VLC --rtsp-timeout=99999 --sout-ffmpeg-strict=-2 --extraintf=http --http-port=8080
Parameters Description
  • --extraintf=http:  Automaticaly enables the web interface
  • --rtsp-timeout=99999: Solves a problem that appears since VLC version 2.0.0, which stops streaming from PC/Mac to Android after a few seconds (60 seconds in v2.0.0 to v2.0.7 and 15 seconds in v2.0.8+)
  • --http-port=8080: Defines that Web Interface will listen on port 8080. This port must be setup in VLC Direct Pro Free->menu->settings->Manual Configuration->VLC Web Interface Port
  • --sout-ffmpeg-strict=-2:  Helps VLC find the correct audio codecs for streaming. Without this parameter, streaming from PC/Mac to android will probably show a codec error window in VLC or the videos will have no sound.
Running VLC 2.1.0 and newer from command line


There are a lot of changes between VLC 2.0.x and VLC 2.1.x versions. Good news is that since VLC 2.1, there's no need to edit files to make VLC reachable from VLC Direct Pro Free. But now it requires a HTTP Password to access it. This password can be setup inside vlc (use vlcdirect as password):




Note: The default HTTP Password used by VLC Direct Pro Free is "vlcdirect", so in the following parameters the http-password is always configured as "vlcdirect" so you don't have to change anything in VLC Direct Pro Free.

If you want to use another password, please remember that both passwords must match, so change it in both places: In VLC (with the parameter or in the GUI) and in VLC Direct Pro Free->menu->settings->HTTP Password.

Another way to setup VLC parameters is from command line. To start VLC properly configured use the following parameters:

--rtsp-timeout=99999
--http-password=vlcdirect
--sout-avcodec-strict=-2
--extraintf=http
--http-port=8080


The following are the corresponding command lines for each operating system:


Windows (32bits):
"C:\Program Files\VideoLan\VLC\vlc.exe" --rtsp-timeout=99999 --http-password=vlcdirect --sout-avcodec-strict=-2 --extraintf=http --http-port=8080
Windows (64bits):
"C:\Program Files (x86)\VideoLan\VLC\vlc.exe" --rtsp-timeout=99999 --http-password=vlcdirect --sout-avcodec-strict=-2 --extraintf=http --http-port=8080
Linux:
vlc --rtsp-timeout=99999 --http-password=vlcdirect --sout-avcodec-strict=-2 --extraintf=http --http-port=8080
Mac:
/Applications/VLC.app/Contents/MacOS/VLC --rtsp-timeout=99999 --http-password=vlcdirect --sout-avcodec-strict=-2 --extraintf=http --http-port=8080

Parameters Description
  • --extraintf=http: Automaticaly enables the web interface
  • --rtsp-timeout=99999: Solves a problem that appears since VLC version 2.0.0, which stops streaming from PC/Mac to Android after a few seconds (60 seconds in v2.0.0 to v2.0.7 and 15 seconds in v2.0.8+)
  • --http-password=vlcdirect: Since 2.1.0, VLC uses a password to authenticate connections to its web interface. This password must be setup also in VLC Direct Pro Free->menu->settings->VLC HTTP Password
  • --sout-avcodec-strict=-2: Helps VLC find the correct audio codecs for streaming. Without this parameter, streaming from PC/Mac to android will probably have no sound.
  • --http-port=8080: Defines that Web Interface will listen on port 8080. This port must be setup in VLC Direct Pro Free->menu->settings->Manual Configuration->VLC Web Interface Port