I ran into an issue when streaming a video using RTP with VLC in Windows 10.
I have 2 laptops, one for streaming a short video using RTP over UDP and another one for receiving and displaying the video stream. My concern is that I can stream to a given destination address and port e.g. 10.0.0.140:5006 but I cannot stream from the same port of a given address e.g. 10.0.0.130:5006. The server port (one the first laptop) has to be the same as the client port.
I followed a tutorial to stream a video using RTP / MPEG Transport Stream and I checked on Wireshark but I always have the streaming source port not set to 5006 as I wanted (Instead, it opens random server ports).
I checked on the internet for an answer to this but I found nothing helpful for my problem. I also checked in VLC preferences I set RTP port to 5006 but still the same behavior...
Does anyone know how to change udp server port of VLC to stream exclusively from port 5006 ?
Thanks!
I finally found out the solution by myself.
I did not set a static UDP server port, but I redirect the packets on postrouting using Ubuntu over a Virtual Machine.
To post-redirect the packets, I opened a terminal, and followed the two following steps:
Declare the wanted UDP port number in iptables
iptables -A OUTPUT -p udp --sport 5006 --dport 5006 -j ACCEPT
Redirect output data in nat's table to the previously declared UDP port number
iptables -t nat -A POSTROUTING -o eth0 -p udp -j SNAT --to :5006
This method allows to redirect any UDP packets output to source port 5006 before sending them on the network.