Linux,Unix,BSD/Jetson

[jetson] Namespace GstRtspServer not available 오류 해결 방법

채윤아빠 2023. 11. 15. 09:41
728x90
반응형

문제점 및 증상

DeepStream SDK 파이썬 예제중에서 "rtsp"로 출력하는 예제를 실행했더니, 다음과 같이 "ValueError: Namespace GstRtspServer not available" 오류가 발생하였습니다.

nvidia@nvidia-OrinNX16G:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out$ python deepstream_test1_rtsp_out.py
Traceback (most recent call last):
  File "deepstream_test1_rtsp_out.py", line 26, in 
    gi.require_version('GstRtspServer', '1.0')
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GstRtspServer not available

해결 방안

다음과 같이 python-gi-dev 패키지를 설치하고, "gir1.2-gst-rtsp-server-1.0" 패키지를 설치하면 간단하게 해결됩니다.

nvidia@nvidia-OrinNX16G:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out$ sudo apt install -y python-gi-dev
[sudo] password for nvidia:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-gi-dev is already the newest version (3.36.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nvidia@nvidia-OrinNX16G:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out$ sudo apt-get install gir1.2-gst-rtsp-server-1.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  gir1.2-gst-rtsp-server-1.0
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.2 kB of archives.
After this operation, 75.8 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 gir1.2-gst-rtsp-server-1.0 arm64 1.16.2-3 [15.2 kB]
Fetched 15.2 kB in 5s (2,980 B/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package gir1.2-gst-rtsp-server-1.0:arm64.
(Reading database ... 160958 files and directories currently installed.)
Preparing to unpack .../gir1.2-gst-rtsp-server-1.0_1.16.2-3_arm64.deb ...
Unpacking gir1.2-gst-rtsp-server-1.0:arm64 (1.16.2-3) ...
Setting up gir1.2-gst-rtsp-server-1.0:arm64 (1.16.2-3) ...

실행 확인

예제에 어떤 옵션이 있는지 파라미터 없이 실행하면 다음과 같은 도움말이 표시됩니다.

nvidia@nvidia-OrinNX16G:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out$ python deepstream_test1_rtsp_out.py
usage: deepstream_test1_rtsp_out.py [-h] -i INPUT [-c {H264,H265}] [-b BITRATE]

RTSP Output Sample Application Help

optional arguments:
  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Path to input H264 elementry stream
  -c {H264,H265}, --codec {H264,H265}
                        RTSP Streaming Codec H264/H265 , default=H264
  -b BITRATE, --bitrate BITRATE
                        Set the encoding bitrate

다음과 같이 예제 동영상을 파라미터로 입력하면, rtsp 서버가 실행됩니다.

nvidia@nvidia-OrinNX16G:/opt/nvidia/deepstream/deepstream/sources/deepstream_python_apps/apps/deepstream-test1-rtsp-out$ python deepstream_test1_rtsp_out.py -i /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
Creating Pipeline

Creating Source

Creating H264Parser

Creating Decoder

Creating H264 Encoder
Creating H264 rtppay
Playing file /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264
Adding elements to Pipeline

Linking elements in the Pipeline


 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8554/ds-test ***


Starting pipeline

Opening in BLOCKING MODE
Opening in BLOCKING MODE

RTSP를 지원하는 영상 재생 프로그램으로 "rtsp://:8554/ds-test"로 동영상 재생을 해보면, 객체인식된 화면 결과를 RTSP를 통하여 확인할 수 있습니다.


참고자료