Gstreamer ffmpeg Plugin Install Fail

Jetson Info:

Software part of jetson-stats 4.2.12 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin - Jetpack 5.1.1 [L4T 35.3.1]
NV Power Mode[0]: MAXN
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:
 - Module: Check with sudo
Platform:
 - Distribution: Ubuntu 20.04 focal
 - Release: 5.10.104-tegra
jtop:
 - Version: 4.2.12
 - Service: Active
Libraries:
 - CUDA: 11.4.315
 - cuDNN: 8.6.0.166
 - TensorRT: 8.5.2.2
 - VPI: 2.2.7
 - Vulkan: 1.3.204
 - OpenCV: 4.10.0 - with CUDA: YES

I try theese code to start rtsp server with gmsl camera:

import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstRtspServer', '1.0')
from gi.repository import Gst, GstRtspServer, GObject

class RTSPServer:
    def __init__(self):
        # 初始化 GStreamer
        Gst.init(None)
        
        # 創建 RTSP 伺服器
        self.server = GstRtspServer.RTSPServer()
        
        # 設定 RTSP 伺服器端口
        self.server.set_service("8554")

        # 建立媒體工廠,並設置 GStreamer 管道
        factory = GstRtspServer.RTSPMediaFactory()
        factory.set_launch((
            "v4l2src device=/dev/video0 ! "
            "videoscale ! "
            "nvvideoconvert ! "
            "x264enc ! "
            "h264parse ! "  
            "rtph264pay name=pay0 pt=96"
        ))
        factory.set_shared(True)  # 允許多個客戶端共享

        # 將工廠掛載到 RTSP 伺服器的 "/mystream" 路徑
        self.server.get_mount_points().add_factory("/mystream", factory)

    def start(self):
        # 啟動 RTSP 伺服器
        self.server.attach(None)
        print("RTSP server is running at rtsp://127.0.0.1:8554/mystream")
        GObject.MainLoop().run()

# 啟動 RTSP 伺服器
if __name__ == "__main__":
    server = RTSPServer()
    server.start()

But I use VLC Player use rtsp to play,
like theese error:

ubuntu@EAC-5000:~/workspaces$ python3 '/home/ubuntu/workspaces/deep_stream_view/DeepStream-gi/deepstream_gi_mu
lti_display_rtsp.py'
RTSP server is running at rtsp://127.0.0.1:8554/mystream
/home/ubuntu/workspaces/deep_stream_view/DeepStream-gi/deepstream_gi_multi_display_rtsp.py:36: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
  GObject.MainLoop().run()
x264 [error]: baseline profile doesn't support 4:2:2

And I try install ffmpeg:

sudo apt install ffmpeg

But still can’t find avenc_h264 element:

ubuntu@EAC-5000:~/workspaces$ gst-inspect-1.0 avenc_h264
No such element or plugin 'avenc_h264'

How can I install?
Thanks!!!

1.There is no avenc_h264 element, only x264enc element

I guess you are using DS-6.3, install the dependencies using the following command

apt-get update
apt-get install -y gstreamer1.0-libav
apt-get install --reinstall -y gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libavutil56 libavcodec58 libavformat58 libavfilter7 libx264-155 libde265-dev libde265-0 libx265-179 libvpx6 libmpeg2encpp-2.1-0 libmpeg2-4 libmpg123-0

2.It is recommended that you use nvv4l2h264enc, which is hardware encoding and has higher performance.
For v4l2 pipeline, please refer to this FAQ

1 Like

change to nvv4l2h264enc can work.
thanks!

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