V-flip does not work with nvtracker or nvstreammux

Setup information:

  • Hardware Platform: Jetson
  • DeepStream Version: 6.1
  • JetPack Version (valid for Jetson only): 4.6-b197
  • TensorRT Version: 8.0
  • Issue Type: bugs
  • How to reproduce the issue ?

Problem:
The below code is expected to rotate the video via flip-method. But When using nvtracker or nvstreamux, the pipeline starts producing empty files. I have to use both nvtracker and nvstreamux in my project.

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

Gst.init(None)

def create_pipeline(elements):
    pipeline = Gst.Pipeline()

    prev_element = None

    for element_info in elements:
        element_name = element_info['name']
        element_type = element_info['type']
        properties = element_info.get('properties', {})

        element = Gst.ElementFactory.make(element_type, element_name)

        if not element:
            print(f"Failed to create element {element_name} of type {element_type}")
            continue

        for prop_name, prop_value in properties.items():
            element.set_property(prop_name, prop_value)

        pipeline.add(element)

        if prev_element:
            prev_element.link(element)

        prev_element = element

    return pipeline

element_list_iva = [
    {'name': "src", 'type': 'nvarguscamerasrc'},
    {'name': "flip_conv", 'type': "nvvidconv", 'properties': {'flip-method': 1}},
    {'name': "nvconv1", 'type': "nvvideoconvert"},

    {'name': "streammux", 'type': "nvstreammux", 'properties': {'width': 1920, 'height': 1080, 'batch-size': 1}},
    {'name': "nvconv2", 'type': "nvvideoconvert",},

    {'name': "tracker", 'type': "nvtracker"},
    {'name': "nvconv3", 'type': "nvvideoconvert",},

    {'name': "enc", 'type': "nvjpegenc"},
    {'name': "filesink", 'type': "filesink", 'properties': {'location': "output.jpg"}}
]

element_list_minimal = [
    {'name': "src", 'type': 'nvarguscamerasrc'},
    {'name': "flip_conv", 'type': "nvvidconv", 'properties': {'flip-method': 1}},
    {'name': "enc", 'type': "nvjpegenc"},
    {'name': "filesink", 'type': "filesink", 'properties': {'location': "output.jpg"}}
]

# element_list = element_list_minimal
element_list = element_list_iva

pipeline = create_pipeline(element_list)

pipeline.set_state(Gst.State.PLAYING)

loop = GLib.MainLoop()

try:
    loop.run()
except:
    pass

pipeline.set_state(Gst.State.NULL)

  1. do you mean it can output correct file without nvtracker or nvstreamux?
  2. can you simplify the pipeline to narrow down this issue?
  1. Yes.
  2. Here is the simplified pipeline:
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GLib

Gst.init(None)

pipeline = Gst.Pipeline()

src = Gst.ElementFactory.make("nvarguscamerasrc", "src")

flip_method = Gst.ElementFactory.make("nvvidconv", "flipmethod")
flip_method.set_property("flip-method", 0)  # Set the desired flip method here

conv1 = Gst.ElementFactory.make("nvvideoconvert", "conv1")

streammux = Gst.ElementFactory.make("nvstreammux", "streammux")
streammux.set_property("width", 1920)  # Set the desired width
streammux.set_property("height", 1080)  # Set the desired height
streammux.set_property("batch-size", 1)

tracker = Gst.ElementFactory.make("nvtracker", "tracker")

sink = Gst.ElementFactory.make("nvvideoconvert", "sink")
sink.set_property("format", Gst.VideoFormat.RGBx)

enc = Gst.ElementFactory.make("nvjpegenc", "enc")

filesink = Gst.ElementFactory.make("filesink", "filesink")
filesink.set_property("location", "output.jpg")

pipeline.add(src, flip_method, conv1, streammux, tracker, sink, enc, filesink)

src.link(flip_method)
flip_method.link(conv1)
conv1.link(streammux)
streammux.link(tracker)
tracker.link(sink)
sink.link(enc)
enc.link(filesink)

pipeline.set_state(Gst.State.PLAYING)

loop = GLib.MainLoop()

try:
    loop.run()
except:
    pass

pipeline.set_state(Gst.State.NULL)

I can’t reproduce the issue by this commandline.
gst-launch-1.0 -v nvarguscamerasrc sensor-id=0 num-buffers=200 ! nvvideoconvert flip-method=6 ! ‘video/x-raw(memory:NVMM),format=NV12’ ! mux.sink_0 nvstreammux name=mux width=1280 height=720 batch-size=1 ! nvtracker tracker-width=640 tracker-height=384 ll-lib-file=/opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so enable-batch-process=1 ll-config-file=/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_tracker_NvDCF_perf.yml ! nv3dsink
here is the running log.log.txt (5.7 KB). btw, we suggest using nvvideoconvert instead of nvvidconv.

I have to use it on Python code and not on commandlist.

AYK, DeepStream SDK is a C lib based on Gstreamer. you can use Gstreamer gst-launch command to test the media pipeline, then use Python code to implement the same pipeline after pipeline runs fine.