In this article, I describe how to set up a VLC stream in command line
Table of Contents generated with DocToc
Scenario
I have a mp3 file that I want to stream across a network using http
Requirements:
- Stream the mp3 file
- Has to be done via command line
- mp3 file should play as a loop
Procedure
Below, I detail the procedure to stream a loop of a single MP3 file, both using the GUI, and the CLI
GUI
Now, if we had access to a GUI, it is very simple to set up a stream without loop:
- Open the VLC media player
- Add the mp3 file to the playlist
- go to media-> Stream…
- Add the files using the add button.
- Click on Stream
- In next window verify the path, and click next
- Destination setup: select http and click add
- Change IP and path if you wish, click next (I chose port: 8080 path: /stream)
- Transcoding options: I chose transcode, Audio-MP3
- Miscellaneous Options (It showed the following in the generated stream output string):
:sout=#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{mux=mp3,dst=:8080/stream} :sout-keep
- Click stream, and you are done
To loop, just click on the loop button in the GUI.
CLI
- Run the command:
cvlc <path to mp3 file> --sout="#transcode{vcodec=none,acodec=mp3,ab=128,channels=2,samplerate=44100}:http{mux=mp3,dst=:8080/stream}" --sout-keep --loop
Accessing the stream
In a VLC instance, or a web radio player, type out the address as:
http://ipaddress:8080/stream