Problem getting stream ("Video stream 01" instead of "Video stream 1")

Hello,

The Verint cameras return “Stream 01” instead of “Stream 1” for their StreamUsageItem, which prevents me from finding the correct stream to get the FPS / Resolution from.

For example the following code:

private StreamChildItem GetCameraStreamRaw()
{
    using (var file = new System.IO.StreamWriter("MilestoneConfigureCamerasDebug.log", true))
    {
        var stream = Camera.StreamFolder.Streams.First();
        var su = stream.StreamUsageChildItems.First();
        file.WriteLine($"------------- {Camera.Name} {Hardware.Model} -------------");
        file.WriteLine($"SU - {su.Name} - {su.DisplayName} - {su.GetProperty("Name")}");
        foreach (var deviceSetting in Camera.DeviceDriverSettingsFolder.DeviceDriverSettings)
        {
            foreach(var ci in deviceSetting.StreamChildItems)
                file.WriteLine($"CI - {ci.Name} - {ci.DisplayName} - {ci.Description}");
    
            var tmp = deviceSetting.StreamChildItems.Where(c => c.DisplayName == su.DisplayName).FirstOrDefault();
            if (tmp != null)
                file.WriteLine($"TMP - {tmp.Name} - {tmp.DisplayName}");
            else
                file.WriteLine($"TMP NULL");
 
            if (tmp != null)
                return tmp;
        }
    }
    return null;
}

Outputs this:

------------- cam1 Axis221 -------------
SU - MPEG - MPEG - MPEG
CI -  - JPEG - streamed - 
CI -  - MPEG - 
CI -  - JPEG 2 - streamed - 
CI -  - JPEG 3 - streamed - 
TMP -  - MPEG
 
------------- cam2 AXIS P3364-L Fixed Dome Network Camera -------------
SU - Video stream 1 - Video stream 1 - Video stream 1
CI -  - Video stream 1 - 
CI -  - Video stream 2 - 
CI -  - Video stream 3 - 
CI -  - Video stream 4 - 
CI -  - Video stream 5 - 
CI -  - Video stream 6 - 
CI -  - Video stream 7 - 
CI -  - Video stream 8 - 
TMP -  - Video stream 1
 
------------- cam3 VERINT S5120FD-DN -------------
SU - Video stream 1 - Video stream 1 - Video stream 1
CI -  - Video stream 01 - 
CI -  - Video stream 02 - 
CI -  - Video stream 03 - 
CI -  - Video stream 04 - 
TMP NULL

The funny thing is that the client displays “Video stream 1”, I don’t understand from where it pulls this value.

So my question is how am I supposed to get the correct device settings for the configured stream in the streams tab? I know I could simply get the first one and be right in 99% of the cases but I want it to be more robust for example with cam1 (Axis221) we see that it’s the 2nd stream (MJPEG) that is used.

@Bo Ellegård Andersen (Milestone Systems)​ sorry to bother you but I’m not sure how to ask my question a better way.

How are we supposed to get the current stream used for a camera?

On this picture we see that the stream selected is “Video stream 1” (but that could be something else).

Then in settings we know the stream to configure is “Video stream 1”:

When doing this in code, Verint cameras return “Video stream 01” instead if “Video stream 1” for the settings sections (but the StreamUsage says “Video stream 1” so the name does not match).

Is there an example that shows how to do this (instead of blindly selecting the first stream)? It can use the Item API instead of the ConfigurationItems API.

I believe every driver will potentially have different names on the settings, the assumption that a driver for a camera from one vendor will use the same settings names as a driver for a camera from another vendor is not true.

I know that we are requesting advise from the driver development team but I suspect they will confirm my belief.

Thanks for the answer, but I think you misunderstood:

On Verint camera S5120FD-DN “camera.StreamFolder.Streams.First().StreamUsageChildItems.First().Name” is “Video stream 1”, but camera.DeviceDriverSettingsFolder.DeviceDriverSettings.First().StreamChildItems.First().Name" is “Video stream 01”.

It is on the same camera. The StreamUsageChildItem tells me the stream used for recording has a certain name, but no StreamChildItem has this name.

I don’t understand how you guys are able match the StreamUsageChildItem to a StreamChildItem if you don’t use the name. Maybe you convert to int and then use the index?

This problem does not happen on Axis cameras where the StreamUsageChildItem and the StreamChildItem have the same name.

Maybe a simpler question would be: “how to get the correct StreamChildItem that is currently being recorded under the “Streams” tab?”

In 99% of the case you can simply select the first one, but sometimes it’s not correct. For example if someone configured it to “Video stream 2” or something else.

Ok, here is what I was looking for:

You need to use the StreamUsage StreamReferenceIdValues key based on the StreamUsage StreamReferenceId in order to get the correct string to compare to.

Now this correct code yields the correct result:

private StreamChildItem GetCameraStreamRaw()
{
    using (var file = new System.IO.StreamWriter("Debug.log", true))
    {
        var stream = Camera.StreamFolder.Streams.First();
        var su = stream.StreamUsageChildItems.First();
        var realStreamName = su.StreamReferenceIdValues.Where(p => p.Value == su.StreamReferenceId).First().Key;
 
        file.WriteLine($"------------- {Camera.Name} {Hardware.Model} -------------");
        file.WriteLine($"SU - {su.DisplayName} - {realStreamName}");
        foreach (var deviceSetting in Camera.DeviceDriverSettingsFolder.DeviceDriverSettings)
        {
            foreach(var ci in deviceSetting.StreamChildItems)
                file.WriteLine($"CI - {ci.DisplayName}");
 
            var tmp = deviceSetting.StreamChildItems.Where(c => c.DisplayName == realStreamName).FirstOrDefault();
            if (tmp != null)
                file.WriteLine($"TMP - {tmp.DisplayName}");
            else
                file.WriteLine($"TMP NULL");
 
            if (tmp != null)
                return tmp;
        }
    }
 
    return null;
}

Output:

------------- cam1 VERINT S5120FD-DN -------------
SU - Video stream 1 - Video stream 01
CI - Video stream 01
CI - Video stream 02
CI - Video stream 03
CI - Video stream 04
TMP - Video stream 01
 
------------- cam2 AXIS P3225-LV Mk II Network Camera -------------
SU - Video stream 1 - Video stream 1
CI - Video stream 1
CI - Video stream 2
CI - Video stream 3
CI - Video stream 4
CI - Video stream 5
CI - Video stream 6
CI - Video stream 7
CI - Video stream 8
TMP - Video stream 1

Here are the other topics where people had the same problem:

https://developer.milestonesys.com/s/question/0D50O00004uZ5dnSAC/configurationapi-resolution-is-not-correct

https://developer.milestonesys.com/s/question/0D50O00005GVEU8SAP/configurationapi-changed-in-2018-r3-sdk

You might consider making this a FAQ.