Appsink not working in DeepStream python example

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
T4
• DeepStream Version
5.0
• JetPack Version (valid for Jetson only)
NA
• TensorRT Version
7.0.0.11
• NVIDIA GPU Driver Version (valid for GPU only)
440.64.00
• Issue Type( questions, new requirements, bugs)
I am trying to add appsink into deepstream_test_3.py.

def new_buffer(sink, data):
    print('new_buffer')
    sample = sink.emit('pull-sample')
    return Gst.FlowReturn.OK

....

def main(args):
    ...
    sink = Gst.ElementFactory.make("appsink", "appsink0")
    sink.set_property('emit-signals', True)
    sink.set_property('sync', False)
    sink.set_property('drop', True)
    sink.connect("new-sample", new_buffer)

I am running this as

python3 deepstream_test_3.py file:///opt/nvidia/deepstream/deepstream-5.0/sources/deepstream_python_apps/apps/deepstream-test3/test.h264

But after processing and printing the inference output for the first 10 frames, the pipeline hangs forever. Am I missing some flag setting for the appsink?

FYI I got it working by removing the data argument to new_buffer.

Please feel free to delete this issue in case it is not adding value to others.

A followup question here:

print(frame_meta.ntp_timestamp)

This is printing 0 when called from the appsink’s new-sample callback but prints the proper NTP timestamp when printed from the tiler_src_pad_buffer_probe method of deepstream_test_3.py. Why is the timestamp 0 in the appsink’s buffer?

The NN annotations are all proper. Only the ntp timestamp seems to be incorrect.

tiler_src_pad_buffer_probe is before the nvmultistreamtiler in the pipeline, so the ntp_timestamp for each stream is meaningful. Your appsink is after nvmultistreamtiler in the pipeline, nvmultistreamtiler will combine multiple streams into one new stream, so ntp_timestamp in each separated stream means nothing to the new combined stream, the new combined stream does not provide any ntp_timestamp information.

1 Like