Streaming media via VLC telnet interface

Streaming media over network is one of very hot topic these days, and it can be done very quickly using VLC. For simple one or two media files streaming, it is okay to create several VLC instances for the job.

$ vlc v4l2:///dev/video0:chroma=mjpg --sout ‘#rtp{mux=ts,sdp=rtsp://IP:PORT/live.sdp}’$ vlc video.mp4 --sout ‘#rtp{mux=mpegts,sdp=rtsp://IP:PORT/live.sdp}’

However, this method doesn’t work if there are lots of media input for streaming. So,VideoLAN Manager, or VLM, was created for such use-case.
We will need to interact to VLM via telnet, so we need to start a VLC telnet server.

After opening a telnet server, we can connect to send the command,

$ telnet 4212
Connected to
Escape character is ‘^]’.
VLC media player 2.1.6 Rincewind
Welcome, Master

From the prompt >, we can send anything and VLM will take care of it.

On VLM, there are two types on streaming,

  • vod: A vod media is commonly used for Video on Demand. It will be launched only if a vod client asks for it.
  • broadcast: A broadcast media is very close to a TV program or channel. It is launched, stopped or paused by the administrator and may be repeated several times. The client has no control over this media.

On VLM, each media stream must have a name on the very first line to declare the resource,

Syntax:new RESOURCE_NAME (broadcast|vod)

After that, we need to setup properties for the declared resource, such as input, output, mux …


For example of the two VLC commands at the top of this post, I will convert into VLM syntax for streaming via telnet prompt,

> new LIVE broadcast
> setup LIVE input v4l2:///dev/video0:chroma=mjpg
> setup LIVE output #rtp{mux=ts,sdp=rtsp://:8888/live.sdp}
> setup LIVE enabled
> control LIVE play
> new VIDEO vod
> setup VIDEO input /home/petehouston/projects/sample-media/video.mp4
> setup VIDEO enabled

To play the broadcast, simply make request to its output

$ vlc rtsp://localhost:8888/live.sdp

For VOD, is a bit different from broadcast, it requires input only; and you must start VLC telnet interface with RTSP server information, including RTSP host IP and RTSP port. To request, append the resource name,

$ vlc rtsp://localhost:9000/VIDEO

Using VLM, we can reduce much of workload and make it easier for streaming. To learn more about VLM script and command, read the VLM streaming guide.

Tested on Ubuntu 14.04, Raspbian, Debian Wheezy/Jessie, all working fine.

Have fun :)

Written by

Code / Design / Love @

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store