Dahua + Synology Surveillance Station : Missing options

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
Hi folks, I'm still new at this and i'm using Synology Surveillance Station (SS) because I happen to have a bunch of licenses I got gifted for it. It's overall great, but i'm running into some serious frustration with their "support" for Dahua cameras.

Specifically, i've got an DAHUA/EmpireTech*IPC-Color4K-T180 i'm using with it, and the configuration options I get using Generic , ONVIF, or the officially supported profile for the camera ALL don't let me use AAC audio nor do they let me configure the bitrate for VBR, even though the camera supports both of these things through the web UX.

An aside: Synology support is, of course, utterly clueless, replying with a red-herring response about how AAC transcoding was depreciated (which is totally irrelevant and is a red herring, especially because I have other cameras [Reolinks] on SS running just fine w/ AAC). So, it seems i'm stuck on my own figuring this stuff out .
I have managed to "solve" the lack of the AAC dropdown problem by creating a custom camera profile via the integration tool and then manually going into ssh and "hacking" the profile to add AAC support for the camera, and this works just fine. However I'm running into an issue with the VBR bitrate. By default Synology tells the camera to run at a target rate of 1024 Kb/s in VBR mode.. and there's no option to set a bitrate when you flip on VBR mode in SS. You just get this in the add camera wizard:

Screenshot 2024-07-20 at 4.25.51 PM.png

When using CBR, by contrast, you CAN set the bitrate. Unfortunately, SS's config files are not meant to be messed around with manually (I'm sure they'll be unhappy when I tell them how I figured out how to enable AAC by adding it that way :) ), so I can't figure out how to tell the config file to use a different VBR bitrate other than 1024. Any ideas?

I can change the VBR target bitrate after setting up the camera in SS by going into the web UX for the camera and changing it as shown below, but the problem with this is as soon as surveillance station reapplies the configuration (it does this on reboots and losing/re-establishing the connection, and software upgrades), it blows away any manual adjustments to bitrate I make via web interface.. which is very annoying.

Ideas on how to fix this welcome!

Screenshot 2024-07-20 at 4.30.22 PM.png
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
P.S. I just figured out that I can do an end run around surveillance station with an API call.. but I'd still need a way to figure out how to automate this:

For example, if I wanted to clobber Surveillance Station's dumb video config once a day just to be sure it hasn't re-applied it's bad settings.. I could run a script that applies a bitrate of 3096 to the main stream once every so often as a dirty hack:
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
I usedTask Scheduler to send an HTTP command to Blue Iris every hour to restart a camera.
I'm thinking about using NodeRed in a docker container, so then I can query the camera, find out if it's on the wrong bitrate and change it if and only if it's on the wrong setting.. thereby not disrupting the stream.

But now i have to learn how to use nodered ... :)
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
I figured out how to do this.. it's actually quite neat and tidy with NodeRed and looks like this:

Screenshot 2024-07-20 at 8.54.01 PM.png

If anyone is curious the function looks like this:

JavaScript:
/ Parse the response and extract the bitrate value
const response = msg.payload; / assuming the response is stored in msg.payload
const regex = /BitRate=(\d+)/;
const matches = response.match(regex);
const actualBitrate = matches ? Number(matches[1]) : null;

/ Prepare a debug message
let debugMsg;

/ Check if the bitrate does not match the expected value
if (actualBitrate !== 3096) {
    / Prepare a message for the debug node
    debugMsg = { payload: "Bitrate does not match the expected value. Triggering new HTTP request." };

    / Set msg.url and other properties for the new HTTP request
    msg.url = "https://192.168.2.212/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Video.BitRate=3096";
    / You can set other properties like headers if needed
    msg.headers = {
        / headers here
    };
    / Set the payload if needed for the new request
    msg.payload = {
        / Your payload here
    };
    / Return both the HTTP request message and the debug message
    return [msg, debugMsg];
} else {
    / Prepare a message for the debug node
    debugMsg = { payload: "Bitrate matches the expected value of 3096. No new HTTP request triggered." };
    / Return null for the first output to prevent HTTP request and debug message for the second output
    return [null, debugMsg];
}
 

quiet.tea

Getting the hang of it
Joined
Dec 28, 2023
Messages
38
Reaction score
42
Location
Tennessee
On my Synology Surveillance Station, I have the model set to IPC-PFW8802-A180. If I set the camera to VBR, and chose the Image Quality on the left column below, I get the corresponding Quality and Max Bit Rate on the camera. My preference is to use constant bit rate.

Synology Image QualityCorresponding Camera QualityCorresponding Max Bit Rate
12Custom 2304
23Custom 4864
34Custom 7454
45Custom 9984
5 (Best)6 (Best)Custom 12544
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
On my Synology Surveillance Station, I have the model set to IPC-PFW8802-A180. If I set the camera to VBR, and chose the Image Quality on the left column below, I get the corresponding Quality and Max Bit Rate on the camera. My preference is to use constant bit rate.

Synology Image QualityCorresponding Camera QualityCorresponding Max Bit Rate
12Custom 2304
23Custom 4864
34Custom 7454
45Custom 9984
5 (Best)6 (Best)Custom 12544


Yea on my camera it just always sets to 1024 no matter what I do .. there’s no sane mapping at all. What’s a little bit confusing is that I think the quality and bitrate are completely separate parameters as far as the encoder is concerned. I believe quality is something to do with the flexibility of the variable bit rate encoder to tend toward a higher bitrate I think ?
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
On my Synology Surveillance Station, I have the model set to IPC-PFW8802-A180. If I set the camera to VBR, and chose the Image Quality on the left column below, I get the corresponding Quality and Max Bit Rate on the camera. My preference is to use constant bit rate.

Synology Image QualityCorresponding Camera QualityCorresponding Max Bit Rate
12Custom 2304
23Custom 4864
34Custom 7454
45Custom 9984
5 (Best)6 (Best)Custom 12544

I forgot to ask.. are you using the "official" SS profile for your camera? If so.. I'll go dig in the Dahua config file to see what's different about yours.. Also why do you prefer CBR ? VBR generally offers a better filesize balance ?
 
Last edited:

quiet.tea

Getting the hang of it
Joined
Dec 28, 2023
Messages
38
Reaction score
42
Location
Tennessee
Yes, I am using the official profiles that came with Device Pack version 6.2.1-6477. CBR looks better to me when they are more movements. I agree that VBR offer better file size but the difference was not much.
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
It looks like the profiles are coded differently in synology's internal configs. Do you happen to have a screenshot where it shows that you can select both VBR AND a bitrate in the IP Cam setup tool ?
 

quiet.tea

Getting the hang of it
Joined
Dec 28, 2023
Messages
38
Reaction score
42
Location
Tennessee
It does not let me choose the bitrate in VBR, only the Image Quality. The bitrate that it selects corresponds to the table I posted previously.

1721613020297.png
 

Paiberfunk

Getting the hang of it
Joined
Jul 14, 2024
Messages
76
Reaction score
42
Location
Boston
Anyone try to get a hold of synology tech support ?
I did, and as I mentioned, they are completely worthless in this regard. If you get Geoffrey on support .. run away . I’ve been down ridiculous red herring excuses about AAC license support for transcoding that has been deprecated that’s completely unrelated.
 
Top