# RTSP stream with openCV: Missing installation?

**URL:** <https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869>\
**Category:** Jetson Xavier NX\
**Tags:** rtsp\
**Created:** [November 11, 2021, 7:33pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869 "2021-11-11T19:33:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 11, 2021, 7:33pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/1 "2021-11-11T19:33:47Z")

</div>

I would like to stream video to rtsp from opencv in python.

There are a lot of threads in here that mentioned about it like these links

> [@How to stream video to network from python?](https://forums.developer.nvidia.com/t/how-to-stream-video-to-network-from-python/128732):
>
> Hi. The problem: 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,forma…

> [@Streaming video to VLC via RTSP](https://forums.developer.nvidia.com/t/streaming-video-to-vlc-via-rtsp/159636/10):
>
> Hi, I try your suggestion and the multicast also. It only works in the same Jetson. When I try to open the sdp file using another board or PC, it didn’t works. I try to change the cv2.VideoCapture(0) to: gst\_cap = “v4l2src device=/dev/video0 ! video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw(memory:NVMM), format=(string)NV12 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! a…

but the problem is, when the code run to

```auto
if not out.isOpened() :
    print("Writer failed")
    exit()
print('Writer opened')

```

This would cause “Writer failed” error. So I think I might miss some installation somewhere? There is not many information on this so if anyone could give some guide, it would be very helpful.

FYI: Here is my code run on Jetson Nano that cause the error above

```auto
import cv2
import os
import numpy as np

cap = cv2.VideoCapture(RTSP_URL, cv2.CAP_FFMPEG)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(cap.get(cv2.CAP_PROP_FPS))

gst_out = "appsrc ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 " \
             " ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5000"

out = cv2.VideoWriter(gst_out,cv2.CAP_GSTREAMER,0, float(fps), (int(width), int(height)), True)

print('Writer opened')
if not cap.isOpened():
    print('Cannot open RTSP stream')
    exit(-1)

while True:
    _, frame = cap.read()
    out.write(frame)

    if cv2.waitKey(1) == 27:
        break

cap.release()
cv2.destroyAllWindows()
"""

```

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 11, 2021, 7:36pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/2 "2021-11-11T19:36:03Z")

</div>

Also, I installed GStreamer following this website  
[https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/accelerated\_gstreamer.html#wwpID0E0R40HA](https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/accelerated_gstreamer.html#wwpID0E0R40HA)

But same error occurs

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [November 12, 2021, 3:31am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/4 "2021-11-12T03:31:28Z")

</div>

Hi,  
Please check if you can run the sample and see video preview:  
[Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL](https://forums.developer.nvidia.com/t/doesnt-work-nvv4l2decoder-for-decoding-rtsp-in-gstreamer-opencv/140321/3)

If yes, may try to apply the string in _cv2.VideoCapture()_ to  
[Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL](https://forums.developer.nvidia.com/t/displaying-to-the-screen-with-opencv-and-gstreamer/140648/9)

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 14, 2021, 7:14am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/5 "2021-11-14T07:14:08Z")

</div>

Hi, I tried using code on the first link but it failed.  
I even tried it using my local PC (windows) and it also failed, but using VLC can open the link to

> rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny\_115k.mov

My environment is Python 3.6, Opencv 4.2.0 so I changed my code a little bit although it still failed

```auto
cap = cv2.VideoCapture(
        "rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! rtph264depay ! h264parse ! "
        "nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink ", cv2.CAP_FFMPEG)

```

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [November 15, 2021, 2:28am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/6 "2021-11-15T02:28:18Z")

</div>

Hi,  
`cv2.CAP_FFMPEG` looks not required. Please remove it from _cv2.VideoCapture()_ and try again.

You may also try _gst-launch-1.0_ command with _fakesink_ to make sure the gstreamer command is good:

```auto
$ gst-launch-1.0 rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! fakesink

```

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 15, 2021, 6:34pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/7 "2021-11-15T18:34:49Z")

</div>

Hi, not having cv2,CAP\_FFMPEG will give this error

```auto
OpenCV(4.5.4-dev) D:\a\opencv-python\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink in function 'cv::icvExtractPattern'

```

And the command line with gst-launch-1.0 gives error:

```auto
-bash: syntax error near unexpected token `('

```

I checked my installation with this command

```auto
$ gst-inspect-1.0 --version
gst-inspect-1.0 version 1.8.0
GStreamer 1.8.0

```

Not sure if this is enough to verify that it is good or not though

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 15, 2021, 6:55pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/8 "2021-11-15T18:55:12Z")

</div>

Okay, so I removed `(string)` part from your code and now it gives this error

```auto
(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.155: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideosink.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideosink.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.156: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvivafilter.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvivafilter.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.156: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnveglglessink.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnveglglessink.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.157: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstomx.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstomx.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.157: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvdrmvideosink.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvdrmvideosink.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.157: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvidconv.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.158: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvtee.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvtee.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.158: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvv4l2camerasrc.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvv4l2camerasrc.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.159: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideo4linux2.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.159: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvegltransform.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvegltransform.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.159: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnveglstreamsrc.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnveglstreamsrc.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.159: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideosinks.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideosinks.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.160: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.160: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvjpeg.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.160: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideocuda.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvvideocuda.so: file too short

(gst-plugin-scanner:264): GStreamer-WARNING **: 18:47:26.161: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvcompositor.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvcompositor.so: file too short

```

which is weird so I check with `ldconfig` and it gives this error

```auto
 ldconfig
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libv4lconvert.so.0.0.999999 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libv4l2.so.0.0.999999 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_calib3d.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_flann.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_core.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_gapi.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_imgproc.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_dnn.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_features2d.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_ml.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_dnn.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_photo.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_stitching.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_gapi.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_video.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_objdetect.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_videoio.so.4.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_imgproc.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_photo.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_flann.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_features2d.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libgstnvivameta.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_gapi.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_core.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libnvsample_cudaprocess.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_ml.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_stitching.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_videoio.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_dnn.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_calib3d.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_video.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libgstnvegl-1.0.so.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libgstnvexifmeta.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/libopencv_objdetect.so.4.1.1 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvdecode2eglimage.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvexif.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvofsdk.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvtracebuf.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvapputil.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcuvidv4l2.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvid_mapper.so.1.0.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvodm_imager.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvavp.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvid_mapper.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnveglstream_camconsumer.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcam_imageencoder.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurface.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcameratools.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmm.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcapture.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libtegrav4l2.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvcuvidvideocodec.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvtvmr.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so.1.0.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvtestresults.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmm_contentpipe.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvomxilclient.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_utils.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcamv4l2.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvargus.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvargus_socketserver.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvtnr.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvvideocodec.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnveventlib.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvomx.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmm_parser.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_video.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnveglstreamproducer.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvscf.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvosd.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvargus_socketclient.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurftransform.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmm_utils.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvvidconv.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvdsbufferpool.so.1.0.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvbufsurface.so.1.0.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvv4lconvert.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcamlog.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvcamerautils.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvv4l2.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmedia.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmmlite_image.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libv4lconvert.so.0 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvparser.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvmmlite.so is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/aarch64-linux-gnu/tegra/libnvdsbufferpool.so is empty, not checked.

```

Seems like the build is broken somehow?

I followed instruction here though (although I did it in docker)

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [November 16, 2021, 4:22am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/9 "2021-11-16T04:22:29Z")

</div>

Hi,  
Please check if you incude this file in docker:

```auto
/etc/nvidia-container-runtime/host-files-for-container.d/l4t.csv

```

Seems like it is missing so you are not able to see the gstreamer libs.

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 17, 2021, 2:35am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/10 "2021-11-17T02:35:03Z")

</div>

Hi, it seems like there is no such file you mentioned in the docker so I tried adding `--runtime nvidia` but it shows following error

```auto
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: exit status 1, stdout: , stderr: nvidia-container-cli: initialization error: driver error: failed to process request: unknown.

```

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [November 25, 2021, 10:34am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/11 "2021-11-25T10:34:06Z")

</div>

Hi,  
If you have another Jetson device, we would suggest set up the device with SDKManager as a comparison. The samples should work well on default release. Setting up a working device should help you do further investigation.

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [November 30, 2021, 5:39pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/12 "2021-11-30T17:39:49Z")

</div>

Hi, I reinstalled the whole SDK package and now it works properly. I can fetch steam from my webcam and save to file via opencv (with gstreamer backend), however I want to open the video stream via RTSP but I think I am missing something.

```auto

import cv2
import os
import numpy as np
RTSP_URL = "rtsp://admin@192.168.100.100:554/cam/realmonitor?channel=1&subtype=0"

cap = cv2.VideoCapture(RTSP_URL, cv2.CAP_FFMPEG)
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = int(cap.get(cv2.CAP_PROP_FPS))

gst_out = "appsrc ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 " \
             " ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=rtsp://127.0.0.1 port=8554"

out = cv2.VideoWriter(gst_out, cv2.CAP_GSTREAMER, 0, float(30), (int(width), int(height)))
if not out.isOpened() :
    print("Writer failed")
    exit()
print('Writer opened')
if not cap.isOpened():
    print('Cannot open RTSP stream')
    exit(-1)

count = 0

while True:
    _, frame = cap.read()
    out.write(frame)
out.release()

```

Any idea on how to fix this? I am pretty sure it has to be on this line

```auto
gst_out = "appsrc ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 " \
             " ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=rtsp://127.0.0.1 port=8554"

```

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [December 1, 2021, 3:11am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/13 "2021-12-01T03:11:22Z")

</div>

Hi,  
We have tried to set up UDP and don’t have much experience about setting up RTSP. This would need other users to share experience.

Have searched online and this may help:  
[How to create x264 RTSP server with OpenCV Python with GStreamer backend - Stack Overflow](https://stackoverflow.com/questions/67376753/how-to-create-x264-rtsp-server-with-opencv-python-with-gstreamer-backend)

---

<div class="post-metadata">

**Author:** ![jobpasin](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@jobpasin](https://forums.developer.nvidia.com/u/jobpasin)\
**Post date:** [December 7, 2021, 7:01pm UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/14 "2021-12-07T19:01:08Z")

</div>

Hi, the code in the link works wonderfully. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [December 29, 2021, 6:15am UTC](https://forums.developer.nvidia.com/t/rtsp-stream-with-opencv-missing-installation/194869/16 "2021-12-29T06:15:49Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
