Skip to content

Instantly share code, notes, and snippets.

@flbuddymooreiv
Last active August 29, 2015 14:18
Show Gist options
  • Save flbuddymooreiv/04c6f42d209427b51b05 to your computer and use it in GitHub Desktop.
Save flbuddymooreiv/04c6f42d209427b51b05 to your computer and use it in GitHub Desktop.
VLC streaming

The following bits assume a server:

  • IP address 192.168.0.1
  • Broadcasting rtsp on port 8554

Server streaming a file

/usr/bin/cvlc /path/to/file/or/playlist \
    --sout '#rtp{host=192.168.0.1,port=8554,sdp=rtsp://192.168.0.1:8554/}'

Note: The trailing / on the sdp parameter of the sout cvlc parameter is important when connecting from the client.

Server streaming a URL

/usr/bin/cvlc http://listen.radiotunes.com/public3/classicalperiod.pls \
    --sout '#rtp{host=192.168.0.1,port=8554,sdp=rtsp://192.168.0.1:8554/}'

Note: The trailing / on the sdp parameter of the sout cvlc parameter is important when connecting from the client.

Client

/usr/bin/cvlc --no-repeat rtsp://192.168.0.1:8554/ vlc://quit

Note: The trailing slash on the URL is important when connecting!

Client with automatic retry

This is nice for the client to be reconnecting automatically as the broadcast station is going down and coming back up while changing tracks/streams

while true; do
        /usr/bin/cvlc --no-repeat rtsp://192.168.0.1:8554/ vlc://quit \
            >> /home/pi/vlc.out 2>&1
        sleep 5
done;

Note: The trailing slash on the URL is important when connecting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment