Trouble replicating a pipeline with Gst.ElementFactory.make

• Hardware Platform (Jetson / GPU) Jetson Orin Nano
• DeepStream Version 7.0
• JetPack Version (valid for Jetson only) 6.0
• TensorRT Version 8.6.2

I am trying to replicate this code using Gst.ElementFactory.make instead of Gst.parse_launch

import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib
import time

# Initialize GStreamer
Gst.init(None)

pipeline = Gst.parse_launch(
    "uridecodebin uri=<rtsp-url> ! "
    "nvvideoconvert ! video/x-raw(memory:NVMM), format=NV12 ! "
    "m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 batched-push-timeout=40000 ! "
    "nvinfer config-file-path=config-file.txt !"
    "nvdsosd !"
    "nvvideoconvert ! openh264enc ! h264parse ! "
    "qtmux ! filesink location=output2.mp4"
)
# Start the pipeline
pipeline.set_state(Gst.State.PLAYING)

# Let the pipeline run for 10 seconds
time.sleep(60)

# Send EOS to gracefully end the pipeline
pipeline.send_event(Gst.Event.new_eos())

# Wait for the pipeline to finish processing the EOS
bus = pipeline.get_bus()
msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.EOS)

# Stop and clean up
pipeline.set_state(Gst.State.NULL)

The thing is that the program doesn’t stop running after 60 seconds when I try to replicate it.

I think I am getting the linkage between uridecodebin, nvvideoconvert and streammux wrong. How can I link these elements?

after sleeping, you can add “pipeline.set_state(Gst.State.NULL)” to exit.

I got it to work after some attempts. Thanks!

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