According to Wikipedia: "Real Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by Macromedia for streaming audio, video and data over the Internet, between a Flash player and a server. Macromedia is now owned by Adobe, which has released an incomplete version of the specification of the protocol for public use."

The protocol has several variants:

  • RTMP: the 'original' protocol uses TCP port 1935
  • RTMPS: the RTMP protocol over a secure SSL connection using HTTPS
  • RTMPE: an encrypted version of RTMP developed by Adobe
  • RTMPT: the RTMP protocol encapsulated within HTTP requests to traverse firewalls. It is a cleartext protocol using TCP ports 80 and 443 to bypass corporated firewalls. The encapsulated session may carry plain RTMP, RTMPS, or RTMPE packets within.

RTMP Streaming

VLC versions 2.0.x and above support RTMP streaming through ffmpeg/libav. When librtmp support is enabled for ffmpeg/libav then RTMPS might work too. However I have not tested RTMPS streaming yet, so I cannot claim "it works".

The scenario where VLC and RTMP is mostly used as capture and transcoding application that generates a single stream. Distribution to multiple clients is done by another application. The most popular one for this role is Wowza.

VLC connects directly to a RTMP streamer, such as Wowza, and does not listen for incoming requests. Thus it is not possible to view the RTMP stream directly from VLC. You need to connect to Wowza for viewing the stream. This can be done with VLC:

$ vlc rtmp://rtmp.server.com:1935/path/to/stream

A word of caution is needed here. RTMP streaming towards a Wowza server is not entirely stable from VLC. There is a timing dependant bug that causes Wowza to closes the connection. The issue is related to Audio and Video timestamps. Using the "audio-desync" option in combination with RTMP streaming is not a good idea.

Webcam RTMP streaming

In the following examples a webcam is used for RTMP. Other type of capture devices, devices or files could have been used also.

Windows example

On Windows capture devices are implemented using a DirectShow interface. The VLC module that uses this interface is called "DirectShow" or "dshow" for short. The commandline for RTMP streaming from a webcam (or any dshow devices) is as follows:

$ vlc dshow://"" --sout '#transcode{vcodec=h264,vb=300,fps=25,scale=1,acodec=mp4a,ab=64,channels=2}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://rtmp.server.com:1935/path/to/stream}'

The DirectShow options are also available from the QT interface, by opening the menu "Media|Open Capture Device". Advanced options are available directly from this dialog for each DirectShow device.

Linux example

On Linux capture device are implemented with the "video for linux" (v4l2) interface. The commandline for RTMP streaming from a webcam (or any v4l2 devices) is as follows:

$ vlc v4l2:// --v4l2-fps=25 --sout '#transcode{vcodec=h264,vb=300,fps=25,scale=1,acodec=mp4a,ab=64,channels=2}:std{access=rtmp,mux=ffmpeg{mux=flv},dst=rtmp://rtmp.server.com:1935/path/to/stream}'

The example above auto discovers a v4l2 device and selects the first device capable of providing a picture. Usually this is a webcam. Other options like video standard (PAL, NTSC), chroma, width and height are choosen depending on the best match for this session. Be aware that it depends on the device itself which values capabilities have. VLC its video for linux (v4l2) modules prints the values it discovers when it has been started with debug option on ("-vvv"). The v4l2 module provides the following options to fine tune the capture device:

  • --v4l2-dev=: specify the video device to use
  • --v4l2-standard=: the video standard to use, for example: SECAM, PAL, NTSC and more
  • --v4l2-width=
    : video width (in pixels) to use
  • --v4l2-height=
    : video height (in pixels) to use

There are more options to v4l2 then just mentioned. A complete list of options for the v4l2 module can be obtained using the following commandline:
$ vlc -H -p v4l2 --advanced

The list of options is also available from the QT interface, by opening the menu "Media|Open Capture Device". Then press the 'Advanced" button in the dialog.