I currently have a robot running Ubuntu with ROS installed and an Asus Xtion Pro Live attached. What I'm trying to do is to capture the video and push it to a server, and then have the server re-stream it so that other clients that connect to my server can view the stream. The server is running Windows, has a public ip and does not have ROS installed.
What I currently have now is, while the robot is on the same wifi as a client, use mjpeg_server, and have the client connect directly to the robot to view the stream. What I'm trying to overcome is, if I wanted to use my robot outside and use a 3G/4G dongle, I wouldn't be able to connect to it directly. Or, if I wanted to view the video stream from outside the network. So I want it to push the stream to my server, and then have clients connect to the server to view the stream through a webapp. The server currently runs a webapp on tomcat, using java, javascript jsp, jquery, mssql. I want to add on to the webapp to allow viewing the video stream from the Asus Xtion on my robot, without having to install ROS on the server if possible.
I roughly know that there will be three things I have to do:
- Stream the Asus Xtion camera feed to the server,
- Receive the stream on my server somehow, and
- Have my server re-stream the video.
But I don't really have any idea on how to go about doing this. Can anyone help?
EDIT: I know that with VLC, I can pull a video stream, and then re-stream it. However this won't work for me because I won't be able to pull from the robot; it doesn't have a public ip so it wouldn't be accessible.
Originally posted by Andrew.A on ROS Answers with karma: 324 on 2014-01-20
Post score: 3
Original comments
Comment by Tim Sweet on 2014-01-21:
It seems like this is unrelated to ROS, where would you want to fit ROS in? If you just need a rough implementation, it is possible to stream on OpenCV matrix over TCP/UDP sockets, but don't expect excellent performance for the resolution of the Xtion. If you need more fidelity I'd use videolan.org
Comment by Andrew.A on 2014-01-21:
It doesn't necessarily have to use ROS, but I was thinking perhaps I could use ROS to get the stream produced by mjpeg_server, and then push it out to the server.
Comment by Andrew.A on 2014-01-21:
Also, as far as I know, VLC can only pull a video stream, and then re-stream it. This isn't possible for me because the robot doesn't have a public IP, as I've mentioned I'll be using 3G or 4G. I've also stated in my question that I need to push to the server, not pull from the server.
Comment by Tim Sweet on 2014-01-22:
The mjpeg_server package is serving the OpenCV matrix over TCP, so you could try it. To solve the public IP problem I'd suggest using openvpn (openvpn.net). Either way your going to have terrible quality and latency over 3G/4G, so I would do some processing on the robot to reduce the data size.
Comment by Andrew.A on 2014-01-22:
I do not want clients connecting directly to the robot, because its specs are quite weak. I want the robot to push the stream to the server, and then have clients connect to that server instead. Do you know how I can do this?
Comment by Tim Sweet on 2014-01-22:
I'm trying to say your results over 3G/4G are going to be very poor, likely in the order of a frame every few seconds, plus lag of a few seconds. But if you set up openvpn on the robot and server you will be able to use mjpeg_server to do exactly that.
Comment by Tim Sweet on 2014-01-22:
You could implement it directly by serializing each image (using opencv) over a TCP socket. The server would open a port for listening, and the robot would connect to it and send the image, and the server would deserialize it. That would avoid openvpn assuming the server has a public IP
Comment by Andrew.A on 2014-01-22:
Could you perhaps write an answer with more details on doing this? I get that the results over 3G/4G might be poor, but where does openvpn come in? How will this help? Also, in your second comment, would that mean writing my own ROS package to do the serializing? Lastly, server already has public ip