Dahua + Synology Surveillance Station : Missing options

Paiberfunk

Getting the hang of it
Jul 14, 2024
77
47
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
 
  • Like
Reactions: mat200
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:
 
  • Like
Reactions: mat200
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:
I usedTask Scheduler to send an HTTP command to Blue Iris every hour to restart a camera.
 
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 ... :)
 
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];
}
 
  • Love
Reactions: mat200
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
 
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 ?
 
  • Like
Reactions: mat200
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:
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.
 
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 ?
 
Anyone try to get a hold of synology tech support ?
 
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.
 
  • Like
Reactions: mat200
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.

Where is the custom profile stored? I know the default device profiles are in /var/packages/SurveillanceStation/target/device_pack/camera_support but the integration tool doesn't appear to append custom profiles to the conf files there.
 
Where is the custom profile stored? I know the default device profiles are in /var/packages/SurveillanceStation/target/device_pack/camera_support but the integration tool doesn't appear to append custom profiles to the conf files there.
...and I found it in /var/packages/SurveillanceStation/target/@Surveillance/@SSCapInfo/IntegrationSupported
 
  • Like
Reactions: quiet.tea
My solution to this problem is to use the Onvif profile instead and do not give the Onvif any admin rights to make changes. Synology will shutdown the camera if using a Dahua profile with a non admin user when it attempts to update settings and fails but with Onvif it is expected to not be able to do that and it works just fine. With Onvif Synology will use the camera as is including AAC audio etc, the only downside is it only supports standard onvif motion detection events so you will only get events in Synology for normal motion or SMD, IVS events will be ignored, not a big deal for me I prefer SMD as IVS was problematic.

Frustrating situation overall with both Synology and Dahua making dumb choices in how they handle various things, Synology should not fail if it can't update camera settings due to security and in fact should have a setting to not attempt to do so at all, it should also support more extended Onvif events to include AI profiles. Dahua should have sane AI / motion detection settings and allow for IVS to trigger standard onvif motion alerts for NVR that only supports that profile like Synology, Scrypted etc.