Regarding getting an error in deepstream 6.4 jetson orin after stream comes

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) -Jetson Orin
• DeepStream Version - 6.4
• JetPack Version (valid for Jetson only) - 6.0+b106
• TensorRT Version - 8.6.4
• NVIDIA GPU Driver Version (valid for GPU only) - 12.2
• Issue Type( questions, new requirements, bugs) - we are running deepstream 6.4 for displaying single camera stream but not able get stream so it is showing an error so how can i reproduce of an issue
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

jetson@ubuntu:/media/jetson/CCCOMA_X64FRE_EN-GB_DV9/pandian/fps$ GST_DEBUG=3 python3 fps.py
Creating Pipeline

Creating streamux

Creating source_bin 0

rtsp://admin:Sieora123@10.147.20.64:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1


Creating source bin
source-bin-00
/media/jetson/CCCOMA_X64FRE_EN-GB_DV9/pandian/fps/fps.py:220: DeprecationWarning: Gst.Element.get_request_pad is deprecated
sinkpad= streammux.get_request_pad(padname)
Creating nvvidconv1

Creating filter1

Creating tiler

Creating nvosd

Creating EGLSink

Atleast one of the sources is live
Adding elements to Pipeline

Linking elements in the Pipeline

Now playing…
0 : rtsp://admin:Sieora123@10.147.20.64:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1
Starting pipeline

Decodebin child added: source

0:00:00.277658566 4822 0xaaaafaf08f00 WARN udpsrc gstudpsrc.c:1637:gst_udpsrc_open: warning: Could not create a buffer of requested 524288 bytes (Operation not permitted). Need net.admin privilege?
0:00:00.277746344 4822 0xaaaafaf08f00 WARN udpsrc gstudpsrc.c:1647:gst_udpsrc_open: have udp buffer of 212992 bytes while 524288 were requested
0:00:00.295170364 4822 0xffff5c017ea0 FIXME default gstutils.c:4025:gst_pad_create_stream_id_internal:fakesrc0:src Creating random stream-id, consider implementing a deterministic way of creating a stream-id
Decodebin child added: decodebin0

Decodebin child added: rtph264depay0

Decodebin child added: h264parse0

Decodebin child added: capsfilter0

Decodebin child added: nvv4l2decoder0

Opening in BLOCKING MODE
0:00:00.586218626 4822 0xffff48007aa0 WARN v4l2 gstv4l2object.c:4671:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
NvMMLiteOpen : Block : BlockType = 261
NvMMLiteBlockCreate : Block : BlockType = 261
0:00:00.691271305 4822 0xffff48007aa0 WARN v4l2 gstv4l2object.c:4671:gst_v4l2_object_probe_caps:nvv4l2decoder0:src Failed to probe pixel aspect ratio with VIDIOC_CROPCAP: Unknown error -1
In cb_newpad

gstname= video/x-raw
features= <Gst.CapsFeatures object at 0xffffa354e380 (GstCapsFeatures at 0xffff30087540)>
0:00:00.708627580 4822 0xffff48007aa0 WARN v4l2videodec gstv4l2videodec.c:2311:gst_v4l2_video_dec_decide_allocation: Duration invalid, not setting latency
0:00:00.709755798 4822 0xffff48007aa0 WARN v4l2bufferpool gstv4l2bufferpool.c:1116:gst_v4l2_buffer_pool_start:nvv4l2decoder0:pool:src Uncertain or not enough buffers, enabling copy threshold
0:00:00.737098001 4822 0xffff30014520 WARN v4l2bufferpool gstv4l2bufferpool.c:1567:gst_v4l2_buffer_pool_dqbuf:nvv4l2decoder0:pool:src Driver should never set v4l2_buffer.field to ANY
Segmentation fault (core dumped)

#!/usr/bin/env python3
import sys
import gi
import configparser
gi.require_version(‘Gst’, ‘1.0’)
from gi.repository import GObject, Gst
from gi.repository import GLib
from ctypes import *
import time
import numpy as np
import math
import platform
from datetime import datetime
from common.is_aarch_64 import is_aarch64
from common.bus_call import bus_call
from common.FPS import GETFPS
from common.FPS import PERF_DATA
import pyds
import cv2
from queue import Queue
import os
import json

Dictionary to keep track of saved objects

saved_objects = {}

fps_streams={}
perf_data = None

GST_CAPS_FEATURES_NVMM=“memory:NVMM”
OSD_PROCESS_MODE= 0
OSD_DISPLAY_TEXT= 0

def tiler_src_pad_buffer_probe(pad, info, u_data):
global saved_objects
global processed_frames

gst_buffer = info.get_buffer()
if not gst_buffer:
    print("Unable to get GstBuffer")
    return

batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list
while l_frame is not None:
    try:
        frame_meta = pyds.NvDsFrameMeta.cast(l_frame.data)
    except StopIteration:
        break

    # Get the frame buffer
    n_frame = pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)
    # # Map the buffer to an array and create an OpenCV image
    # n_frame = np.array(n_frame, copy=False, order='C')

    # # Draw the line on the frame
    # start_point = (0, 375)
    # end_point = (1920, 375)
    # color = (255, 0, 0)
    # thickness = 2
    # cv2.line(n_frame, start_point, end_point, color, thickness)
    
    l_obj = frame_meta.obj_meta_list
    while l_obj is not None:
        try:
            obj_meta = pyds.NvDsObjectMeta.cast(l_obj.data)
        except StopIteration:
            break

        if obj_meta.unique_component_id == 1:
            tracker_id = obj_meta.object_id

        if obj_meta.unique_component_id == 2:
            # Initialize the count for new tracker_id
            if tracker_id not in saved_objects:
                saved_objects[tracker_id] = 0

            # Proceed only if we haven't saved 3 images for this tracker_id
            if saved_objects[tracker_id] < 1:
                # Extract the bounding box coordinates for the number plate
                rect_params = obj_meta.rect_params

                top = int(rect_params.top)
                left = int(rect_params.left)
                height = int(rect_params.height)
                width = int(rect_params.width)

                box = [top, left, height, width]
                # if (top <= 375 <= top + height):
                # Save the image locally
                filename = save_image(n_frame, box, tracker_id)
                saved_objects[tracker_id] += 1  

                # Read the saved image
                saved_image = cv2.imread(filename)
                success, encoded_image = cv2.imencode('.jpg', saved_image)
                if not success:
                    print("Could not encode image!")
                    return None
                image_bytes = encoded_image.tobytes()

                license_plates = call_aws_rekognition(image_bytes)
                for plate in license_plates:
                    print(f"Detected license plate: {plate}")

        try:
            l_obj = l_obj.next
        except StopIteration:
            break

    stream_index = "stream{0}".format(frame_meta.pad_index)
    global perf_data
    perf_data.update_fps(stream_index)

    try:
        l_frame = l_frame.next
    except StopIteration:
        break

    # Introduce a delay to slow down the frame rate
    time.sleep(0.25)  

return Gst.PadProbeReturn.OK

def cb_newpad(decodebin, decoder_src_pad,data):
print(“In cb_newpad\n”)
caps=decoder_src_pad.get_current_caps()
gststruct=caps.get_structure(0)
gstname=gststruct.get_name()
source_bin=data
features=caps.get_features(0)
print(“gstname=”,gstname)
if(gstname.find(“video”)!=-1):
print(“features=”,features)
if features.contains(“memory:NVMM”):
# Get the source bin ghost pad
bin_ghost_pad=source_bin.get_static_pad(“src”)
if not bin_ghost_pad.set_target(decoder_src_pad):
sys.stderr.write(“Failed to link decoder src pad to source bin ghost pad\n”)
else:
sys.stderr.write(" Error: Decodebin did not pick nvidia decoder plugin.\n")

def decodebin_child_added(child_proxy,Object,name,user_data):
print(“Decodebin child added:”, name, “\n”)
if(name.find(“decodebin”) != -1):
Object.connect(“child-added”,decodebin_child_added,user_data)

def create_source_bin(index,uri):
print(“Creating source bin”)
bin_name=“source-bin-%02d” %index
print(bin_name)
nbin=Gst.Bin.new(bin_name)
if not nbin:
sys.stderr.write(" Unable to create source bin \n")
uri_decode_bin=Gst.ElementFactory.make(“uridecodebin”, “uri-decode-bin”)
if not uri_decode_bin:
sys.stderr.write(" Unable to create uri decode bin \n")
uri_decode_bin.set_property(“uri”,uri)
uri_decode_bin.connect(“pad-added”,cb_newpad,nbin)
uri_decode_bin.connect(“child-added”,decodebin_child_added,nbin)
Gst.Bin.add(nbin,uri_decode_bin)
bin_pad=nbin.add_pad(Gst.GhostPad.new_no_target(“src”,Gst.PadDirection.SRC))
if not bin_pad:
sys.stderr.write(" Failed to add ghost pad in source bin \n")
return None
return nbin

def main():
global vehicles_data, cam_config

# cam_config = json.load(open('cam_config.json', 'r'))
# args = ['file:///home/jetson/Downloads/anpr/License_Plate_Detection_Test.mp4']
args = []

vehicles_data = {}

number_sources=len(args)

global perf_data
perf_data = PERF_DATA(number_sources)

Gst.init(None)
print("Creating Pipeline \n ")
pipeline = Gst.Pipeline()
is_live = True

if not pipeline:
    sys.stderr.write(" Unable to create Pipeline \n")
print("Creating streamux \n ")

MUXER_OUTPUT_WIDTH=1920
MUXER_OUTPUT_HEIGHT=1080
MUXER_BATCH_TIMEOUT_USEC=40000
streammux = Gst.ElementFactory.make("nvstreammux", "Stream-muxer")
if not streammux:
    sys.stderr.write(" Unable to create NvStreamMux \n")
streammux.set_property('width', MUXER_OUTPUT_WIDTH)
streammux.set_property('height', MUXER_OUTPUT_HEIGHT)
streammux.set_property('batch-size', number_sources)
streammux.set_property('batched-push-timeout', MUXER_BATCH_TIMEOUT_USEC)

pipeline.add(streammux)

for i in range(number_sources):
    print("Creating source_bin ",i," \n ")
    uri_name=args[i]
    if uri_name.find("rtsp://") == 0 :
        is_live = True
    else:
        uri_name=uri_name
    print(uri_name)
    print("*********************")
    source_bin=create_source_bin(i, uri_name)
    if not source_bin:
        sys.stderr.write("Unable to create source bin \n")
    pipeline.add(source_bin)
    padname="sink_%u" %i
    sinkpad= streammux.get_request_pad(padname) 
    if not sinkpad:
        sys.stderr.write("Unable to create sink pad bin \n")
    srcpad=source_bin.get_static_pad("src")
    if not srcpad:
        sys.stderr.write("Unable to create src pad bin \n")
    srcpad.link(sinkpad)



print("Creating nvvidconv1 \n ")
nvvidconv1 = Gst.ElementFactory.make("nvvideoconvert", "convertor1")
if not nvvidconv1:
    sys.stderr.write(" Unable to create nvvidconv1 \n")

print("Creating filter1 \n ")
caps1 = Gst.Caps.from_string("video/x-raw(memory:NVMM), format=RGBA")
filter1 = Gst.ElementFactory.make("capsfilter", "filter1")
if not filter1:
    sys.stderr.write(" Unable to get the caps filter1 \n")
filter1.set_property("caps", caps1)

TILED_OUTPUT_WIDTH=1280
TILED_OUTPUT_HEIGHT=720
print("Creating tiler \n ")
tiler=Gst.ElementFactory.make("nvmultistreamtiler", "nvtiler")
if not tiler:
    sys.stderr.write(" Unable to create tiler \n")
tiler_rows=int(math.sqrt(number_sources))
tiler_columns=int(math.ceil((1.0*number_sources)/tiler_rows))
tiler.set_property("rows",tiler_rows)
tiler.set_property("columns",tiler_columns)
tiler.set_property("width", TILED_OUTPUT_WIDTH)
tiler.set_property("height", TILED_OUTPUT_HEIGHT)
print("Creating nvosd \n ")
nvosd = Gst.ElementFactory.make("nvdsosd", "onscreendisplay")
if not nvosd:
    sys.stderr.write(" Unable to create nvosd \n")

print("Creating EGLSink \n")
sink = Gst.ElementFactory.make("nv3dsink", "nvvideo-renderer")
if not sink:
    sys.stderr.write(" Unable to create egl sink \n")
sink.set_property("qos",0)
sink.set_property("sync",0)


if is_live:
    print("Atleast one of the sources is live")
    streammux.set_property('live-source', 1)



print("Adding elements to Pipeline \n")
pipeline.add(tiler)
pipeline.add(filter1)
pipeline.add(nvvidconv1)
pipeline.add(nvosd)
pipeline.add(sink)

print("Linking elements in the Pipeline \n")
streammux.link(nvvidconv1)
nvvidconv1.link(filter1)
filter1.link(tiler)
tiler.link(nvosd)
nvosd.link(sink)

# create an event loop and feed gstreamer bus mesages to it
loop = GLib.MainLoop()
bus = pipeline.get_bus()
bus.add_signal_watch()
bus.connect ("message", bus_call, loop)

tiler_src_pad=tiler.get_static_pad("sink")
if not tiler_src_pad:
    sys.stderr.write(" Unable to get sink pad \n")
else:
    tiler_src_pad.add_probe(Gst.PadProbeType.BUFFER, tiler_src_pad_buffer_probe, 0)
    GLib.timeout_add(5000, perf_data.perf_print_callback)

# List the sources
print("Now playing...")
for i, source in enumerate(args):
    print(i, ": ", source)

print("Starting pipeline \n")
# start play back and listed to events		
pipeline.set_state(Gst.State.PLAYING)
try:
    loop.run()
except:
    pass
# cleanup
thread_stop = True
print("Exiting app\n")
# print(vehicles_data)
pipeline.set_state(Gst.State.NULL)

if name == ‘main’:
sys.exit(main())

What is your camera? IP camera with H264 stream or H265 stream?

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

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