this is my first question here (as I remember) so if I'm doing something wring with the process please let me know.
Here is the situation: I have a computer with access to an IP Camera streaming video with rtsp and h264 encoded. This computer is in a local network and not accessible from outside (neither the IP camera). I have a server with a public IP and it is accessible with Internet. What I want, is to forward the rtsp video stream to that server, so it can access to it as the local computer can.
I have tried doing that with ffmpeg CLI, but I got better results with Gstreamer CLI. Here is the commands I got until now:
For the sender:
gst-launch-1.0 rtspsrc location=rtsp://urlToCamera ! udpsink host=127.0.0.1 port=5000
For receiver:
gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink
This was using for now the same computer as sender and receiver, but I tried to change host IP to another computer of mine and it works, but the problem is that when the video's image changes, the video looks pixelated, like if some data was lost. I don't know if that is because of the use of udpsink, I tried to forward it by TCP but it is to slow like if the video was paused, but maybe I didn't do that the correct way of course.
I'm totally new on this topic about video conversion and transport, so the questions are:
- Is there a way of improving this to solve the pixelated frames? Like adjusting some value, I saw in other posts that I could change the I-frame interval but I can't find that property in Gstreamer or where to put it.
- If you have a different solution of doing this but with python scripts and accesing the forwarded stream with cv2 on the server side would be nice because I'm doing all this to reach that exact functionality. (But using usual cv2 imencode/imdecode functions to send frame by frame take a lot of the band width, that is why we want to forward the video in h264 codec)
If you could give me a direct example or just a guide to a possible solution I would appreciate that so much. Oh, the resolution of the camera is 640x480 with bitrate 1024 and 30FPS by the way.
Thanks in advance.