H264 decoder for RTSP stream inside the docker

Hi…I am working on Nvidia Jetson AGX Xavier within Dockerized container…I want to take input from RTSP stream…it’s encoding type is H264 and .avi video input.Input stream frame size is 1920x1080 and 25 FPS

I have used this GStreamer pipeline

cap = cv2.VideoCapture(‘rtspsrc location=“rtsp_link” latency=200 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! appsink’, cv2.CAP_GSTREAMER)

It is able to read the frames but after reading frames, frames got completely blurred ,that’s why object detection is not happening.
Kindly help me to solve this issue ASAP. Thank You!

Hi,
Please try this:

cap = cv2.VideoCapture("rtsp_link")

or

cap = cv2.VideoCapture('rtspsrc location=“rtsp_link” latency=200 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink', cv2.CAP_GSTREAMER)

Thank You for reply

When I am trying this
cap = cv2.VideoCapture(“rtsp_link”)
then it is able to read the frame,detection is also happening, but after sometime it is getting stopped.(around 1 min)

While I am trying below one

cap = cv2.VideoCapture(‘rtspsrc location=“rtsp_link” latency=200 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink’, cv2.CAP_GSTREAMER)

It is started but not going for further execution, also I am sharing my memory usage


Hi,
Please try this command and see if you can get good content in saved mkv file:

gst-launch-1.0 rtspsrc location=“rtsp_link” latency=200 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! queue ! nvv4l22h64enc ! h264parse ! matroskamux ! filesink location=a.mkv

And does it work well without docker?

Hi…

Without docker also all these gstreamer pipeline is not working

Within Docker with this new provided GStreamer pipeline getting this problem

Hi,
It looks like you manually build OpenCV package. The default version should be 4.1.1 but the log shows 4.4.0.

Please check if you can apply the RTSP URI to this sample and run:
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL

If you cannot successfully run this sample, we would suggest re-flash the system and try default 4.1.1.

Hi,
I have checked with this code ,It is giving me this error(without docker)

Without replacing the RTSP is also giving the same error

Hi…I have another similar AGX xavier…there is also same OpenCV version installed but GStreamer pipeline is working there.There is only 1 difference in VPI…is that creating problem…I am sharing both configuration…Please can you check and help me.

My system on which I am currently working(GStreamer is not working)—>

Another similar system won which GStreamer is working—>

What should I do?
Thanks

Hi,
If you fail to run the sample in executing the command directly(without docker), we would suggest re-flash the system image. The sample should be successfully run on default releases.

Okay…Thank You!

Hi,
I have tried to install VPI with “sudo apt install nvidia-vpi” and it worked. Now without re-flashing also GStreamer is working fine within and outside of the docker.
Thank you for support!

1 Like

Hi…
After installing VPI GStreamer is now working . The sample RTSP is running but still I am getting problem in reading frames from actual site RTSP. Code is started but stalled

FYI camera(with public access RTSP) and Jetson AGX Xavier are at different network, is that creating a problem? What can be the issue?
Please help

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Sorry for the late response, is this still an issue to support? Thanks