This page explains how VLC Media Player can be used to stream a file locally over UDP. Streaming locally means that the streaming device and all the receiving device(s) should be present in the same local network (so they should be connected to the same router) for the streaming to work.
To stream a media file over UDP, make the following modifications in the std block:
Set access=udp, and
Set dst=address:port (where address is the IP address of the receiving device).
The destination IP address can be:
A unicast address (when streaming to a specific device), or
A multicast address (when streaming to multiple device in the network).
You can pick any port number to stream (except for a few reserved ports). For this example, we will stream on port number 8090.
For this example, let’s assume that the network IP addresses of the devices involved are:
Streaming to the multicast IP address essentially means that the stream will the pushed to all the devices in the local network. So any device that wishes to receive the stream can connect to the relevant port and start receiving.
To receive the stream, run the following code on all the receiving devices:
$ vlc udp://@239.255.255.250:8090
In this case, we need to use the multicast IP address to receive the stream.
The network would might look something like the following. Notice that as udp is a push protocol, it pushes the stream to all the devices in the local network.
When streaming over UDP, you can use SAP announcements. This will help to “discover” streams on the receiving devices and seamlessly connect without having to execute any code. Refer to Using SAP while Streaming to understand how to use SAP announcements.
Instead of using the #std{access=udp syntax, we can use the alternate syntax #udp{ to stream over UDP. The alternate syntax is just a stortcut for calling the access=udp part of the std module, so all the other parameters remain the same.