Cropping input videos

I have the following simple code:

.
.
.
sources = [ "file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_qHD.mp4",
                "file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.mp4",
                "rtsp://127.0.0.1:8191/test"]

    number_sources = len(sources)
    is_live=False
    for i, uri_name in enumerate(sources):
        logging.info("Creating source_bin {}".format(i))
        if uri_name.find("rtsp://") == 0 :
            is_live = True
        source_bin=DS_UTILS.create_source_bin(i, uri_name)
        if not source_bin:
            logging.error("Unable to create source bin")
            sys.exit(1)
        pipeline.add(source_bin)
        padname="sink_%u" %i
        sinkpad= streammux.get_request_pad(padname) 
        if not sinkpad:
            logging.error("Unable to create sink pad bin")
            sys.exit(1)
        srcpad=source_bin.get_static_pad("src")
        if not srcpad:
            logging.error("Unable to create src pad bin")
            sys.exit(1)

        convA = DS_UTILS.create_gst_element("nvvideoconvert", "convA_{}".format(i)); pipeline.add(convA)

        x0,y0,w,h = 400, 180, 72, 360
        convA.set_property('src-crop',"{}:{}:{}:{}".format(x0,y0,w,h))

        padI = convA.get_static_pad("sink")
        padO = convA.get_static_pad("src")
        srcpad.link(padI)
        padO.link(sinkpad)
.
.
.

The idea is crop certain area inside video and work only over this area.
The problem is I am getting the following error:

Error: gst-stream-error-quark: memory type configured and i/p buffer mismatch ip_surf 0 muxer 3 (1): gstnvstreammux.c(616): gst_nvstreammux_chain (): /GstPipeline:pipeline0/GstNvStreamMux:StreamMuxer

However if I comment out the lines,

#x0,y0,w,h = 400, 180, 72, 360
#convA.set_property('src-crop',"{}:{}:{}:{}".format(x0,y0,w,h))

then the code works although obviously I don’t do any cropping!!!.

Also, If I remove the RTSP source, then the code works fine and also perfom the cropping

Any help with that? I need to do a crop and optionally a DEWART transformation, but now I’m stuck on the crop part because of that issue.

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)

• GPU RTX 1650, DS61-dev container on Kubuntu 20.04 host
• DS6.1
• NVIDIA-SMI 515.48.07 Driver Version: 515.48.07

Can you set the “nvbuf-memory-type” property of nvvideoconvert as 3?
https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvvideoconvert.html#gst-properties

1 Like

Thank you so much, It is working right now !!!

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