# source id

**URL:** <https://forums.developer.nvidia.com/t/source-id/107393>\
**Category:** DeepStream SDK\
**Created:** [November 14, 2019, 3:39am UTC](https://forums.developer.nvidia.com/t/source-id/107393 "2019-11-14T03:39:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![iyaqoobi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@iyaqoobi](https://forums.developer.nvidia.com/u/iyaqoobi)\
**Post date:** [November 14, 2019, 3:39am UTC](https://forums.developer.nvidia.com/t/source-id/107393/1 "2019-11-14T03:39:05Z")

</div>

hi  
I have multiple stream sources and I want to get the source id for further use.  
Is it possible to get source id in the “static GstFlowReturn get\_converted\_mat” function?

---

<div class="post-metadata">

**Author:** ![ChrisDing](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/chrisding/32/14043_2.png) [@ChrisDing](https://forums.developer.nvidia.com/u/ChrisDing)\
**Post date:** [November 15, 2019, 3:10am UTC](https://forums.developer.nvidia.com/t/source-id/107393/2 "2019-11-15T03:10:00Z")

</div>

You can get NvDsFrameMeta-\> source\_id in dsexample plugin

---

<div class="post-metadata">

**Author:** ![hrsht.sarma](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/hrsht.sarma/32/16549_2.png) [@hrsht.sarma](https://forums.developer.nvidia.com/u/hrsht.sarma)\
**Post date:** [December 15, 2019, 3:33am UTC](https://forums.developer.nvidia.com/t/source-id/107393/3 "2019-12-15T03:33:15Z")

</div>

I get source\_id as **null**

---

<div class="post-metadata">

**Author:** ![iyaqoobi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@iyaqoobi](https://forums.developer.nvidia.com/u/iyaqoobi)\
**Post date:** [December 16, 2019, 1:21am UTC](https://forums.developer.nvidia.com/t/source-id/107393/4 "2019-12-16T01:21:35Z")

</div>

frame\_meta-\>source\_id

---

<div class="post-metadata">

**Author:** ![ChrisDing](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/chrisding/32/14043_2.png) [@ChrisDing](https://forums.developer.nvidia.com/u/ChrisDing)\
**Post date:** [December 16, 2019, 2:29am UTC](https://forums.developer.nvidia.com/t/source-id/107393/5 "2019-12-16T02:29:24Z")

</div>

It’s better you can read the code and add log to debug:  
[https://devtalk.nvidia.com/default/topic/1061492/deepstream-sdk/deepstream-sdk-faq/](https://devtalk.nvidia.com/default/topic/1061492/deepstream-sdk/deepstream-sdk-faq/) → 6. How to get source\_id

---

<div class="post-metadata">

**Author:** ![hrsht.sarma](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/hrsht.sarma/32/16549_2.png) [@hrsht.sarma](https://forums.developer.nvidia.com/u/hrsht.sarma)\
**Post date:** [December 16, 2019, 2:54am UTC](https://forums.developer.nvidia.com/t/source-id/107393/6 "2019-12-16T02:54:02Z")

</div>

```auto
frame_meta = (NvDsFrameMeta *) (l_frame->data);
      guint source_id_info = frame_meta->source_id;

```

When I try to print source\_id\_info , it says “(null)”.

---

<div class="post-metadata">

**Author:** ![iyaqoobi](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@iyaqoobi](https://forums.developer.nvidia.com/u/iyaqoobi)\
**Post date:** [December 18, 2019, 1:23am UTC](https://forums.developer.nvidia.com/t/source-id/107393/7 "2019-12-18T01:23:29Z")

</div>

where do you defined l\_frame-\>data ? if it possible share this part of your source code.

---

<div class="post-metadata">

**Author:** ![alan.rocheinternet](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@alan.rocheinternet](https://forums.developer.nvidia.com/u/alan.rocheinternet)\
**Post date:** [January 1, 2020, 1:10pm UTC](https://forums.developer.nvidia.com/t/source-id/107393/8 "2020-01-01T13:10:58Z")

</div>

Hi,

I am also trying the same but instead of getting null I’m getting ‘0’, I’m using the sample-app\deepstream-app … any ideas what it could be ? Happy to paste code if needed.

Thanks

---

<div class="post-metadata">

**Author:** ![cbstryker](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/cbstryker/32/9864_2.png) [@cbstryker](https://forums.developer.nvidia.com/u/cbstryker)\
**Post date:** [February 20, 2020, 5:58pm UTC](https://forums.developer.nvidia.com/t/source-id/107393/9 "2020-02-20T17:58:44Z")

</div>

I’m adding my voice to this issue. This seems to be a recent bug. The source\_id comes up at “0” for all streams regardless of what’s being processed. I’ve even tried manually setting all of the streams to have a non-zero ID. Example:

```auto
[source113]
enable=1
type=3
uri=rtsp://10.0.0.164/stream1
num-sources=1
drop-frame-interval=2
gpu-id=0
cudadec-memtype=0

[sink113]
enable=1
type=2
sync=1
source-id=113
gpu-id=0
nvbuf-memory-type=0

[source108]
enable=1
type=3
uri=rtsp://10.0.0.164/stream2
num-sources=1
drop-frame-interval=2
gpu-id=0
cudadec-memtype=0

[sink108]
enable=1
type=2
sync=1
source-id=108
gpu-id=0
nvbuf-memory-type=0

```

and regardless of the settings only “0” ever comes back for source\_id.

---

<div class="post-metadata">

**Author:** ![cbstryker](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/cbstryker/32/9864_2.png) [@cbstryker](https://forums.developer.nvidia.com/u/cbstryker)\
**Post date:** [February 20, 2020, 8:34pm UTC](https://forums.developer.nvidia.com/t/source-id/107393/10 "2020-02-20T20:34:13Z")

</div>

Another thing to add, in the frame\_meta object “frame\_num” is also 0 all the time. In fact, just about everything is 0 except for “num\_surfaces\_per\_frame”, which is just 1.

I’m currently in the middle of testing, but I believe this was all working just fine with Deepstream 4.0. I have a feeling that there was a change in Deepstream 4.0.2 (or possibly 4.0.1, I jumped over that release) that is now causing these objects to be incorrect.

---

<div class="post-metadata">

**Author:** ![cbstryker](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/cbstryker/32/9864_2.png) [@cbstryker](https://forums.developer.nvidia.com/u/cbstryker)\
**Post date:** [February 21, 2020, 5:13pm UTC](https://forums.developer.nvidia.com/t/source-id/107393/11 "2020-02-21T17:13:24Z")

</div>

A quick update on this issue. My issue was that the source/sink ID was not being added in order (ie. 0,1,2,etc) and instead I was adding each source ID based on the database camera ID (in my case IDs 113 and 108 were being used in the example). Without setting the source IDs in sequence the config parser doesn’t seem to match up the source IDs properly. I would need to look more deeply to see the specifics, but ultimately the issue was solved on my end by simply added each stream in sequence starting from 0.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:18pm UTC](https://forums.developer.nvidia.com/t/source-id/107393/12 "2021-10-12T16:18:23Z")

</div>

Closed on October 12, 2021, 4:18pm UTC


