My Apologies for the generality of the question. I have tried many things but nothing seems to work.
I have a server? (let's call it Server A) that resides in a local area network where there is also an IP-Webcam. That webcam is constantly providing an RTSP feed on the address... let's say... rtsp://192.168.1.50:554/cam.sdp
. The camera doesn't have access to the outside world (it must stay in the LAN, and therefore, only has access to server A, no to server B), but server A does. Sadly, Server A doesn't have a public IP, so I can not reach into Server A from anywhere in the world. Server A can go out if it wants but no one can get into Server A... (it's an spoiled brat... too many toys when it was a kid)
Now, there's another server (server B, to be original) in the aforementioned outside world which is a regular web server with its public IP and all. That server allows people to reach into it (not spoiled, very nice... sets the table, does the dishes... that kind of stuff). Both Server A and Server B are my computers and are running Ubuntu 12.04 and some Python applications I designed (Server B is actually running Django, but I don't think that's too relevant). What I mean by this is that I have control over what's going on in both servers. I can install/uninstall packages, I can open ports, close ports... whatever is needed (I can even format them if I want, although I don't think that would help much... or yes... who knows?)
_____________ _____________
----------- | | | |
__ | | | | | |
| \| WebCam |================| Server A |===========| INTERNET |===========| Server B |
|__/| | ->/cam.sdp <--| |----------------- > --------------> * |
| | |___________| |___________|
-----------
The question is: How can I grab the RTSP stream with server A dump it onto a designated socket of server B and open it (with a program able to understand RTSP feeds, such as VLC)?
I'm guessing I need something like an RTSP proxy, maybe? But I don't really know where to start.
Any hint, link... would be appreciated.
Thank you in advance
I don't know RTSP, but it seems to be a standard TCP-only protocol. Try to run on server A:
ssh -g -R 554:192.168.1.50:554 server_B_hostname
This will open the public port 554 on Server B, and forward it to 192.168.1.50:554 from A's point of view.
Some servers have sshd configured to refuse the ssh -g -R forwarding (for no good reason). If you can, you should check /etc/ssh/sshd_config on Server B and add AllowTcpForwarding yes
.
RTSP is a controlling protocol which usually runs on port 554 , but videostreams are port negotiated using SDP, meaning that on handshaking the port for RTP transport (UDP)will be decided and for each transport, port number varies. So perhaps you need to forward a range of ports or fix the transport port to a fixed value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With