How to separate nvdewarper with 4 surfers to become 4 separate streams

Questions
I have config_nvdewarper.txt config and use docker deepstream-6.1:devel to run with pipeline:
gst-launch-1.0 filesrc location=sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! nvdewarper config-file=configs/config_dewarper.txt source-id=6 nvbuf-memory-type=3 ! m.sink_0 nvstreammux name=m width=960 height=752 batch-size=4 num-surfaces-per-frame=4 ! nvmultistreamtiler width=1280 height=2880 rows=1 columns=1 ! nvvideoconvert ! ‘video/x-raw’ ! x264enc ! mp4mux ! filesink location=output.mp4

File output.mp4 has a background:

But I want to make 4 different frames instead of 1 frame showing 4 surfaces, I want your help, thanks for reading !!

File config dewarper:
config_dewarper.txt (625 Bytes)

Configure:
GPU NVIDIA GeForce RTX 2080 Ti
DeepStream Version 6.1
TensorRT Version 8.2.5.1
NVIDIA GPU Driver Version 510.85.02

You may use nvvideoconvert src-crop to parse the tiled video.

E.G.
gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! nvdewarper config-file=config_dewarper_test.txt source-id=6 ! m.sink_0 nvstreammux name=m width=1520 height=1160 batch-size=4 num-surfaces-per-frame=4 ! nvmultistreamtiler width=1520 height=1160 rows=1 columns=1 ! tee name=t t.src_0 ! queue ! nvvideoconvert src-crop="0:0:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output0.mp4 t.src_1 ! queue ! nvvideoconvert src-crop="0:290:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output1.mp4

@Fiona.Chen I tried your example to crop with 4 videos but it didn’t work, here is the pipeline I use:

gst-launch-1.0 filesrc location=sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! nvdewarper config-file=configs/config_dewarper.txt source-id=6 ! m.sink_0 nvstreammux name=m width=1520 height=1160 batch-size=4 num-surfaces-per-frame=4 ! nvmultistreamtiler width=1520 height=1160 rows=1 columns=1 ! tee name=t t.src_0 ! queue ! nvvideoconvert src-crop=“0:0:1520:290” ! ‘video/x-raw,width=760,height=580’ ! x264enc ! mp4mux ! filesink location=output0.mp4 t.src_1 ! queue ! nvvideoconvert src-crop=“0:290:1520:290” ! ‘video/x-raw,width=760,height=580’ ! x264enc ! mp4mux ! filesink location=output1.mp4 t.src_2 ! nvvideoconvert src-crop=“0:580:1520:580” ! ‘video/x-raw,width=760,height=580’ ! x264enc ! mp4mux ! filesink location=output2.mp4 t.src_3 ! nvvideoconvert src-crop=“0:870:1520:870” ! ‘video/x-raw,width=760,height=580’ ! x264enc ! mp4mux ! filesink location=output3.mp4

why can’t it output 4 videos, the pipeline only works with t.src_0, t.src_1 and t.src_2

Your crop parameters for t.src_2 and t.src_3 are wrong. Please read the document: Gst-nvvideoconvert — DeepStream 6.2 Release documentation

gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! nvdewarper config-file=config_dewarper_test.txt source-id=6 ! m.sink_0 nvstreammux name=m width=1520 height=1160 batch-size=4 num-surfaces-per-frame=4 ! nvmultistreamtiler width=1520 height=1160 rows=1 columns=1 ! tee name=t t.src_0 ! queue ! nvvideoconvert src-crop="0:0:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output0.mp4 t.src_1 ! queue ! nvvideoconvert src-crop="0:290:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output1.mp4 t.src_2 ! queue ! nvvideoconvert src-crop="0:580:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output2.mp4 t.src_3 ! queue ! nvvideoconvert src-crop="0:870:1520:290" ! 'video/x-raw,width=760,height=580' ! x264enc ! mp4mux ! filesink location=output3.mp4

@Fiona.Chen oh, sorry for the confusion, thanks for the help.
Can I ask you one more question, if I don’t want to crop like that and want to convert the 4 sufaces in nvdewarper into 4 squares of this type
image
instead of that vertical style? How can I fix that pipeline ?

Currently dewarper plugin can only output vertical surfaces.

Thank you so much for your help !
May I ask you if I can use pipeline like this to dewarper multiple output files like above:

gst-launch-1.0 filesrc location=sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! tee name=t t.src_0 ! queue ! nvdewarper config-file=one_config_dewarper.txt source-id=1 ! m.sink_0 nvstreammux name=m batch-size=2 width=1080 height=720 ! nvstreamdemux name=demux demux.src_0 ! nvvideoconvert ! x264enc ! mp4mux ! filesink location=videot.mp4 demux.src_1 ! nvvideoconvert ! x264enc ! mp4mux ! filesink location=videot2.mp4 t.src_1 ! queue ! nvdewarper config-file=one_config_dewarper2.txt source-id=2 ! m.sink_1

For each config dewarper will be 1 surface. But I try to run the above pipeline and it doesn’t work, can you help me fix it.
Here are the 2 configs I tried for the pipeline:
one_config_dewarper.txt (2.4 KB)
one_config_dewarper2.txt (2.4 KB)

No, the nvstreamdemux can not demux the multiple surfaces.

Please try the following pipeline:
gst-launch-1.0 filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_office.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvideoconvert ! tee name=t t.src_0 ! queue ! nvdewarper config-file=config_dewarper_test0.txt source-id=1 ! m.sink_0 nvstreammux name=m width=3800 height=2900 batch-size=4 num-surfaces-per-frame=1 ! nvstreamdemux name=demux demux.src_0 ! queue ! nvvideoconvert ! 'video/x-raw,width=1900,height=1450' ! x264enc ! mp4mux ! filesink location=output0.mp4 demux.src_1 ! queue ! nvvideoconvert ! 'video/x-raw,width=1900,height=1450' ! x264enc ! mp4mux ! filesink location=output1.mp4 demux.src_2 ! queue ! nvvideoconvert ! 'video/x-raw,width=1900,height=1450' ! x264enc ! mp4mux ! filesink location=output2.mp4 demux.src_3 ! queue ! nvvideoconvert ! 'video/x-raw,width=1900,height=1450' ! x264enc ! mp4mux ! filesink location=output3.mp4 t.src_1 ! queue ! nvdewarper config-file=config_dewarper_test1.txt source-id=2 ! m.sink_1 t.src_2 ! queue ! nvdewarper config-file=config_dewarper_test2.txt source-id=3 ! m.sink_2 t.src_3 ! queue ! nvdewarper config-file=config_dewarper_test3.txt source-id=4 ! m.sink_3

config_dewarper_test0.txt (181 Bytes)
config_dewarper_test1.txt (178 Bytes)
config_dewarper_test2.txt (182 Bytes)
config_dewarper_test3.txt (180 Bytes)

1 Like

Thanks so much for your help ! I will try the above pipeline for my app ! Thanks.

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.