Good afternoon POB community
If you read my last IT post you know that I do work in IT and I like to write down the stuff that I learn to memorise it better and since I joined Hive I decided to blog these entries here! Enjoy! 🤣
I will try to keep this entry shorter than the previous one.
Multicast Video Streaming with VLC over LAN
Today I will show you how to setup a streaming with VLC over a Multicast address (a particular class D address used to enable multiple addresses to connect to the same host at the same time *) in the same LAN (your home connection for example) . At work we use this tool that I'll show today to push Multicast streams over the whole network to check if certain security and QoS (quality of service) policies are configured correctly, if certain connections are allowed, etc...
* Imagine when you connect to an online stream of a youtuber of gamer on twitch, most likely your PC like the PCs of many other watchers will connect to the server streaming the video through a multicast address over the internet, over a specific port using a specific protocol
And in this guide I will show you a little bug/error that we found in the VLC software, we couldn't make it work and had to spend a bit of time around it to find the fixt eventually, I will make sure to highlight that part in the guide!
Lab Scenario
For today's tutorial I will set up a home lab with 2 devices, Windows and Linux, I will setup one as the server pushing the stream and use the other to connect to the server and receive the stream in real time. I will also try to connect to the same stream with my Android device to test the multi-connectivity.
I will set this up over my LAN connection at home so all machines will have a local address in range 192.168.1.x /24.
Quickly at the end I will recreate the same stream but this time with 2 devices connected to a LAN on a dumb subnet (no internet) and will also capture some packets with Wireshark to show what happens between the devices when a Multicast stream takes place!
What we need
- 2-3 devices (any OS) in the same LAN
- VLC installed on all the devices (can be found on their official website)
- LAN connection (In this case I'll use my existing LAN connecting from my router, but we can create our own LAN with a switch+router setup or directly connecting the devices to a router)
- A video for the test
(I just downloaded one from herequicky, this one first download link on the page)
Let's start the test
Server device - Windows Machine
Because we will setup the stream over a Class D Multicast Address (224.0.0.0 - 239.255.255.255) (a special range of address reserved for multicast purposes) we don't really need to know the IP address of the server, we only need the Multicast address and the Port over which we want to send the stream. Let's start setting up the stream.
For this test I will stream the video over Multicast address 228.0.0.1, you can use any within the 224.0.0.0-239.255.255.255 range)




At the bottom in New destination we need to select RTP/MPEG Transport Stream and click Add:


As we said previously we'll use 228.0.0.1 and I'll leave the default port 5004*, then click Next:


Previously I mentioned an error/bug, at this point is where we need to APPLY THE FIX in order for the Stream to work!
Check out the Next Step!
Check out the Next Step!
Make sure to tick Stream all elementary streams at this stage, this will change the config file (Generated stream output string)!
The bug is in the way the software creates the final configuration file (or Generated stream output string), it fails to define an important value: TTL (time to live), let me try to explain with the help of some pictures.
Basically VLC will take all the options we just defined and will make a config string out of it, let's have a look at what that means:

We can see within the string some of the options we defined such as the dst=228.0.0.1 value and the port=5004 value.
The error is in the fact that we have a value that is missing! TTL (Time to live) is not defined in the config, so in order to fix the issue we can simply add it ourselves manually, like I did here (you can see I added manually the value ttl=10 to the string, you can use any number really as long as it's higher than 1):

Now that the string is correct we can finally click on Stream and this will start our stream!
The server is now streaming and pushing the video to the network over Port 5004 and Multicast address 228.0.0.1 (I will capture some packets with Wireshark to show you this later!):

I selected also Repeat 1 always so the stream will keep looping itself.
Client devices - Linux & Android
Linux
Now we can jump over the other machines and try to connect to the Stream we created. Let's start with Linux. In the VLC software we need to go to Media and select Open Network Stream:
In the next window we'll need to input the network address of our stream:
If you remember our Stream is an RTP stream, in order to connect to the Stream we need to input the following string in VLC:
rtp://@228.0.0.1:5004
This will tell VLC to which address connect over port 5004 using RTP as a protocol:

Next click on play and we should be able to see our stream on the screen:

Android
For the Android part the app is a bit more intuitive to use and on the home screen we can see a huge + NEW STREAM button which we can use to connect to a streaming address:

After clicking it it will prompt us to enter the address to where we want to connect (same as before):
rtp://@228.0.0.1:5004


If you are wondering how I did manage to connect my Android to this LAN, I used a type C Ethernet Adapter, I recently found out that it works on Android and I use it with an app called WifiMan to get info about the connection, this is a game changer, now at work I test Ethernet lines with my phone and no need to bring a heavy laptop (LOL IT and Laziness... You know it ahahaha!)
And Andoid being based on Linux is just next level, I can pull out a terminal (like CMD for Windows we have bash for Linux and it works on Android, the app i use is called Termux) and ping stuff! Lovely 😎
In my next IT post maybe I can do a quick overview of how I use these particular tools with my Android phone and what I use them for!
Wireshark captures
As I previously mentioned now I want to quickly set up a LAN between the two devices and sniff some packets with Wireshark to show you the stream using the Multicast address 228.0.0.1 and port 5004.
To set up a LAN I will use a Router and a Switch, router will be set in range 192.168.2.x so we should see devices in that IP range connecting to multicast address 228.0.0.1 through port 5004 while streaming and connecting to the stream.
As always I want first to check the devices have all IP addresses and ping between them, Windows PC has 192.168.2.5 and Linux has 192.168.2.6
Here's the screen of my Linux machine getting IP address 192.168.2.6 able to ping Windows 192.168.2.5, this is enough to make sure we have connectivity.

Here are some captures from the Windows (SENDING STREAM) and you can see our Windows machine (192.168.2.5) as the source, the 228.0.0.1 Multicast address as the destination and port 5004 being used as the destination port:

If we look into the UDP field we can see more clearly port 5004 as the destination port:

And if we check the IPv4 field we can see more clearly our source and destination addresses, as well as the TTL=10 field we added manually when setting up the stream, remember?

For the last screenshot I wanted to show you the Linux packet capture (receiving machine):

As you can see we see pretty much the same thing as on the Windows machine, if you think about it we are sending a stream over 228.0.0.1 and not directly to 192.168.2.6 (Linux) and that's why we do not see any activity from our Linux machine in the capture, the machine is just listening and not sending anything over the network, the only machine that is sending packets over the network is 192.168.2.5 (Windows).
In both captures we can see that the stream is being sent over Multicast address 228.0.0.1 (and MAC address 01:00:5e:00:00:01 which is a multicast mac address) and this is exactly what I was expecting from this test!
If the test were carried over a live network and not just an empty LAN (no internet) we would have seen so much more stuff going on, also for clarity the multicast stream was the only process running on the PCs in order to have less clutter in our capture.
That's it for today, I hope you enjoyed my quick guide and learned a thing or two, are you ready to get some testing done? 😜
This particular kind of test was useful for us when we were setting up the new enterprise network and wanted to check if multicast streams were working over particular subnets and if the PPS policies were right and so on and so forth, IT gibberish LOL