I need to receive video from IP camera, decode it, do some work with frames and streaming it to network.
I read the forums and wrote this code:
import cv2 gst_in = "rtspsrc location="rtsp://login:password@ipadress:port" latency=20 ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, format=(string)BGRx! videoconvert ! appsink" cap = cv2.VideoCapture(gst_in, cv2.CAP_GSTREAMER) gst_out = "appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw,format=RGBA ! nvvidconv ! nvv4l2h264enc insert-sps-pps=true ! h264parse ! rtph264pay pt=96 ! tcpserversink host=ipadress port=8001 sync=false" out = cv2.VideoWriter(gst_out, cv2.CAP_GSTREAMER, 0, float(25), (1920, 1080)) while True: _,frame = cap.read() ....... do some work with frame..... out.write(frame)
That’s running without errors. I received decoded frame from camera and do some operations with them.
But when I try to open this stream in VLC on another client, the connection is established and stops after 10 seconds with the error " live555 error: no data received in 10s, aborting"
For opening this stream in VLC i create SDP file:
The idea to use OpenCV and Gstreamer for this task is correct?
Why i have error “no data received” when i send frame to GStreamer?
Is my pipelins for VideoCapture and VideoWriter correct?
- I tryed to use
for getting FPS from camera, but everytime that returns 0
- If i use this pipline:
appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw,format=RGBA ! nvvidconv ! nvv4l2h264enc insert-sps-pps=true ! h264parse ! qtmux ! filesink location=test.mov
then the data is written to the file successfully.
- For opening this stream in VLC i create SDP file:
m=video 8001 RTP/AVP 96
c=IN IP4 192.168.1.43