What does your pipeline look like? Which element’s pad in the pipeline do you get this value from? If you use a tiler element, the value in the meta data may be modified.
I’m using the DeepStream-app sample.
When I use the [source0] , [source1] , [source2] configuration method, I can correctly get the source_id for each source.
However, when I switch to using [source-list] , all the source_id values are returned as 0.
After my recent testing, I found that when using [source0], [source1], [source2], the frame_meta->source_id values are also all 0. However, this issue does not occur when using the deepstream-app from DeepStream version 6.3.
This should be normal, all_bbox_generated is called after demux/tiler This means that the batch has been split. and the parameter guint index represents source_id.
Can you refer to this faq then get the pipeline dot file ?
####################################################################################################
# SPDX-FileCopyrightText: Copyright (c) 2018-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.
####################################################################################################
[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl
[source-list]
num-source-bins=2
list=file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4;file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h265.mp4
use-nvmultiurisrcbin=0
sensor-id-list=0;1
sensor-name-list=cam0;cam1
use-nvmultiurisrcbin=0
max-batch-size=2
stream-name-display=1
[source-attr-all]
enable=2
# Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=2
gpu-id=0
cudadec-memtype=0
rtsp-reconnect-interval-sec=10
rtsp-reconnect-attempts=-1
select-rtp-protocol=4
[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink/nv3dsink (Jetson only) 3=File
type=1
sync=1
source-id=0
gpu-id=0
nvbuf-memory-type=0
[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink/nv3dsink (Jetson only) 3=File
type=1
sync=1
source-id=1
gpu-id=0
nvbuf-memory-type=0
[osd]
enable=1
gpu-id=0
border-width=1
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0
nvbuf-memory-type=0
[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=0
buffer-pool-size=4
batch-size=4
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
## Set muxer output width and height
width=1920
height=1080
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0
## If set to TRUE, system timestamp will be attached as ntp timestamp
## If set to FALSE, ntp timestamp from rtspsrc, if available, will be attached
# attach-sys-ts-as-ntp=1
# config-file property is mandatory for any gie section.
# Other properties are optional and if set will override the properties set in
# the infer config file.
[primary-gie]
enable=1
gpu-id=0
model-engine-file=../../models/Primary_Detector/resnet18_trafficcamnet_pruned.onnx_b4_gpu0_int8.engine
batch-size=4
#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
interval=0
gie-unique-id=1
nvbuf-memory-type=0
config-file=config_infer_primary.txt
[tracker]
enable=1
# For NvDCF and NvDeepSORT tracker, tracker-width and tracker-height must be a multiple of 32, respectively
tracker-width=960
tracker-height=544
ll-lib-file=/opt/nvidia/deepstream/deepstream/lib/libnvds_nvmultiobjecttracker.so
# ll-config-file required to set different tracker types
# ll-config-file=config_tracker_IOU.yml
# ll-config-file=config_tracker_NvSORT.yml
ll-config-file=config_tracker_NvDCF_perf.yml
# ll-config-file=config_tracker_NvDCF_accuracy.yml
# ll-config-file=config_tracker_NvDeepSORT.yml
gpu-id=0
display-tracking-id=1
[secondary-gie0]
enable=1
model-engine-file=../../models/Secondary_VehicleTypes/resnet18_vehicletypenet_pruned.onnx_b16_gpu0_int8.engine
gpu-id=0
batch-size=16
gie-unique-id=4
operate-on-gie-id=1
operate-on-class-ids=0;
config-file=config_infer_secondary_vehicletypes.txt
[secondary-gie1]
enable=1
model-engine-file=../../models/Secondary_VehicleMake/resnet18_vehiclemakenet_pruned.onnx_b16_gpu0_int8.engine
batch-size=16
gpu-id=0
gie-unique-id=5
operate-on-gie-id=1
operate-on-class-ids=0;
config-file=config_infer_secondary_vehiclemake.txt
[tests]
file-loop=0
Then you can get source id as the below code snippet.
I noticed that in DeepStream version 6.3, the create_pipeline function is called like this:
if (!create_pipeline(appCtx[i], all_bbox_generated, NULL, perf_cb, overlay_graphics))
But in DeepStream 7.0, it’s used like this:
if (!create_pipeline(appCtx[i], NULL, all_bbox_generated, perf_cb, overlay_graphics))
After changing the create_pipeline parameter order in DeepStream 7.0 to match the one in version 6.3, I was able to access frame_meta->source_id inside the all_bbox_generated callback.
Why was this change made? What is the difference between these two ways of passing parameters?
This call simply changes the timing of all_bbox_generated , It is not correct.
Please refer to my comment in the first reply. all_bbox_generated is called after demux/tiler, bbox_generated_post_analytics_cb is called when the batch has not yet been split by nvstreammux.
I have repeatedly explained above that for the four callback functions of create_pipeline, they are added to different elements of the pipeline to represent different processing stages.
You actually replace bbox_generated_post_analytics_cb with all_bbox_generated.
/**
* @brief Create DS Anyalytics Pipeline per the appCtx
* configurations
* @param appCtx [IN/OUT] The application context
* providing the config info and where the
* pipeline resources are maintained
* @param bbox_generated_post_analytics_cb [IN] This callback
* shall be triggered after analytics
* (PGIE, Tracker or the last SGIE appearing
* in the pipeline)
* More info: create_common_elements()
* @param all_bbox_generated_cb [IN]
* @param perf_cb [IN]
* @param overlay_graphics_cb [IN]
*/
Generally speaking, the call timing is as follows, please read the code yourself