Integrating splitmuxsink to DeepStream

• Hardware Platform (Jetson / GPU) Jetson NX
• DeepStream Version 6.0
• JetPack Version (valid for Jetson only) Jetpack 4.6 [L4T 32.6.1]
• TensorRT Version8.0.1.6
• Issue Type( questions, new requirements, bugs) Question

Thanks to @kharshit.kr and @Fiona.Chen, I found this post about adding spitmuxsink to DeepStream.

It’s almost the same issue, but I’m using two sinks instead of one.
sink0 is for inference and other related processing.
sink1 is for saving stream into file

Below is my config file,

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=60
kitti-track-output-dir=/opt/nvidia/deepstream/deepstream-6.0/output

[tiled-display]
enable=1
rows=1
columns=1
width=1920
height=1080
#width=3840
#height=2160
gpu-id=0

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI
type=3
num-sources=1
uri=<PATH_TO_VIDEO>
gpu-id=0
#<Addition>#
latency=100

[streammux]
gpu-id=0
batch-size=1
batched-push-timeout=40000

## Set muxer output width and height
width=1920
height=1080
live-source=0
enable-padding=0

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File
type=2
#file 1 live 0
sync=1
source-id=0
gpu-id=0
#<Addition>#
qos=0
source-id=0


[sink1]
enable=1
type=3
container=1
codec=1
enc-type=1
sync=0
bitrate=20000000
profile=0
output-file=/home/nvidia/Desktop/D191_20210204122128.mp4
source-id=0

[osd]
enable=1
gpu-id=0
border-width=3
text-size=15
text-color=1;1;0;1;
text-bg-color=0.3;0.3;0.3;1
font=Arial
show-clock=1
clock-x-offset=1100
clock-y-offset=30
clock-text-size=60
clock-color=1;1;0;0

[primary-gie]
enable=1
gpu-id=0
# Modify as necessary
batch-size=1
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
gie-unique-id=1
config-file=./config.txt


[tracker]
enable=1
tracker-width=1920
tracker-height=1080
ll-lib-file=/opt/nvidia/deepstream/deepstream-6.0/lib/libsort.so
gpu-id=0

[tests]
file-loop=1

When I edit deepstream_sink_bin.c according to the post, it throws a segmentation fault.

$ deepstream-app -c deepstream.txt

# Warning (can be ignored)
(deepstream-app:19512): GLib-GObject-WARNING **: 15:21:16.060: g_object_set_is_valid_property: object class 'GstX264Enc' has no property named 'bufapi-version'

# New warning when I edit my deepstream_sink_bin.c
(deepstream-app:19512): GStreamer-WARNING **: 15:21:16.070: Trying to link elements h264-parser and sink_sub_bin_mux2 that don't share a common ancestor: sink_sub_bin_mux2 hasn't been added to a bin or pipeline, and h264-parser is in sink_sub_bin2
Segmentation fault (core dumped)

My question is, I want to use splitmuxsink only for sink1 so that I can save multiple videos based on size and time while leaving other functionality intact.

I’ll try my best to follow advices.
Appreciate any help!

What happened was, I wanted to save video for 3~5 days, but DeepStream halts when the saved file reaches about 133GB.

...
SYNC_IOC_FENCE_INFO ioctl failed with 9
15:07:43.285193777 22062   0x55a3140190 WARN                 nvinfer gstnvinfer.cpp:1376:convert_batch_and_push_to_input_thread:<primary_gie> error: NvBufSurfTransform failed with error -2 while converting buffer
ERROR from primary_gie: NvBufSurfTransform failed with error -2 while converting buffer
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(1376): convert_batch_and_push_to_input_thread (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie
Quitting
ERROR from qtdemux0: Internal data stream error.
Debug info: qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason error (-5)
deinit...!!!!!
App run failed

Solved it! I’ll share soon if time permits

Glad to see the issue is solved!

@yingliu I managed to implement splitmuxsink, but the issue persists. DeepStream crashs after running for like one day.

SYNC_IOC_FENCE_INFO ioctl failed with 9
15:09:53.305873964 23142   0x55c796a2d0 WARN                 nvinfer gstnvinfer.cpp:1376:convert_batch_and_push_to_input_thread:<primary_gie> error: NvBufSurfTransform failed with error -2 while converting buffer
ERROR from primary_gie: NvBufSurfTransform failed with error -2 while converting buffer
Debug info: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(1376): convert_batch_and_push_to_input_thread (): /GstPipeline:pipeline/GstBin:primary_gie_bin/GstNvInfer:primary_gie
Quitting
ERROR from qtdemux0: Internal data stream error.
Debug info: qtdemux.c(6073): gst_qtdemux_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstDecodeBin:decodebin0/GstQTDemux:qtdemux0:
streaming stopped, reason error (-5)
deinit...!!!!!
App run failed

Can the case run for more than one day with the original deepstream-app?

Unfortunately, we haven’t tried the original app. We didn’t touch anything in filesink.

Can you run with the original app? We need to confirm whether the failure is related to your change or not.

Just finished flashing new JetPack 4.6 for my NX. I’ll try deepstream-app with YOLOv3