I'd like to receive a RTSP stream via VLC, but when I try to run

sudo -u non_root_user cvlc -vvv -I dummy rtsp://ip:port/x.sdp 

I get:

Unable to determine our source address: This computer has an invalid IP    address: 0x0

I think that the ports might be closed, because when I disabled firewall, I was able to receive the stream. I'd like to ask you how to set the iptables so I can receive RTSP. Thanks.


You've run into an ugly hack in Live555, the library VLC uses to provide the RTSP client feature. (VLC's RTSP server code is VLC-specific.) The hack attempts to figure out which IP your machine appears to use on the LAN. (Ugly as the hack is, I don't know a better way for Live555 to do this.)

You have to open UDP port 15947 in your firewall to fix the error that you've run into. That's the "test port" Live555 uses for this hack.

Having done that, you might also have to open additional ports to receive your stream, depending on how your firewall works. RTSP is only a stream control protocol, not a stream delivery protocol. Think of RTSP as "VCR buttons" for the actual stream delivery protocol: play, stop, pause, FF, rewind.... The RTSP client negotiates stream delivery ports with the server as part of the "play" action.

The upshot of this is that the client (VLC in this case) is going to ask the server to send the media to it on a particular port in the RTSP SETUP command:

SETUP rtsp:// RTSP/1.0
CSeq: 4
User-Agent: LibVLC/2.0.2 (LIVE555 Streaming Media v2011.12.23)
Transport: RTP/AVP;unicast;client_port=60860-60861

That is, VLC is telling the RTSP server it wants the media delivered on ports 60860 and 60861 via RTP. The client picks those ports randomly. If your firewall blocks them, it will block the stream delivery even though the RTSP negotiation succeeded.

In the best case, your firewall will either not block such high ports, or it will have some stateful inspection feature that lets it unblock them when it sees this RTSP negotiation.

If your firewall does block it, you can debug it with Wireshark. It understands the RTSP protocol. Right-click a packet in the RTSP stream and say "Follow TCP stream". In the window that pops up, find the RTSP SETUP command. Then start Wireshark again, this time looking for UDP traffic on those ports. (All of this while the RTSP client continues downloading the stream, or trying to.)

  • I've solved it by enabling port 15947 as you stated, thanks for a nice reply. Oct 8 '12 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.