"Smart Codec" Yes or No?

Discussion in 'Dahua' started by Dramus, Jun 10, 2019.

Share This Page

  1. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    I searched. I got hits on "Smart Codec," but was unable to find any pros/cons discussions other than you can't use SC and IVS simultaneously. So if you're just using plain old vanilla motion detection in the cameras, as I am, are there any downsides to using Smart Codec? The firmware automatically adjusting iframe rate to "intelligently" optimize performance seems like a good idea.

    So far the only ill effects I've seen is it turns the video into green and purple on Chrome and disables sub-stream #2. Switch to Firefox and all's well with the video. I can't use sub-stream #2 anyway. My NVR (Synology Surveillance Station) seems to be happy with it enabled.

    Here are stream settings on my 4131 with SC enabled:

    [​IMG]
     
  2. aristobrat

    aristobrat IPCT Contributor

    Joined:
    Dec 5, 2016
    Messages:
    2,049
    Likes Received:
    1,752
    I'm curious about this too. I never messed with it because IVS was soooooo much more reliable than motion detection (at least for my scenes), ... it wasn't an option to lose it.
     
    Last edited: Jun 10, 2019
    Insecurities likes this.
  3. Insecurities

    Insecurities n3wb

    Joined:
    May 23, 2019
    Messages:
    12
    Likes Received:
    9
    Location:
    USA
    In my limited testing, Smart Codec uses WAY less data with little to no loss in quality in low-motion scenes. When there is no motion, the bitrate goes down to the double-digits. This is the expected behavior, so in that sense, it at least looks like a very effective implementation. What I haven't tested thoroughly, and really what will make or break it, is how it behaves in high-motion scenes. The big question in my mind is, if we use Smart Codec and maximize the bitrate, is the resulting quality in high-motion scenes comparable to something like VBR-Best with a similar bitrate and iframes every second? It really all comes down to how quickly/effectively Smart Codec ramps up the bitrate and iframes in those situations. Has anyone done a thorough test of this, or does everyone mostly ignore Smart Codec because IVS is too important to them?

    Also, FWIW, Chrome (with no extensions/plugins) plays the live stream perfectly for me no matter which settings, codec, and/or Smart Codec setting I've used.
     
    Dramus and aristobrat like this.
  4. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    In my use case that's probably not an issue. My only fast movers are birds, insects, and the cars way out on the street--which are too far away for useful imagery, anyway.

    But it would be interesting to know. If I had a spare camera I might be inclined to run an Ethernet cable all the way out to the road to test it. Alas: I do not.
     
  5. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    Figured out I could test the question w/o another camera out on by the street. Wind's blowing pretty good today, and the patio camera has a lot of trees and bushes in its view. At some point, when the wind got to gusting pretty well, the image pixelated very seriously in multiple areas. Even in the grass, which is a couple dozen feet from the lens and not long enough to be moving much, if at all. (I just cut the lawn to 3" day-before-yesterday.)

    Turned Smart Codec back off. Pixelation gone.

    N.B.: I was not looking at the camera directly with a browser, but at what the Surveillance Station was sending for Live View.
     
  6. Insecurities

    Insecurities n3wb

    Joined:
    May 23, 2019
    Messages:
    12
    Likes Received:
    9
    Location:
    USA
    Interesting. Can you post a clip?
     
  7. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    Only if I turn it back on and do a screen video capture. The recorded video from motion events is from sub-stream ##1. I'll give it a go.

    ETA: Hmmm... Seems disinclined to repeat the performance... I'll keep checking.

    ETA2: Gave up and disabled Smart Codec on the two cameras upon which I was testing it. Besides the possibility of a repetition of the pixelation: When I brought up Live View on the Synology SS the two cameras set for Smart Codec would take 2-3 seconds before video would appear. Without Smart Codec enabled they're instantaneous. Bandwidth-savings-wise, Smart Codec wasn't really doing anything for me, anyway. I've got the network bandwidth, processing and disk to handle the five camera streams I have, with plenty left over. And, since, due to a limitation in Surveillance Station, I'm using sub-stream 1 for recording: No help for mobile device performance, either.
     
    Last edited: Jun 10, 2019
  8. Insecurities

    Insecurities n3wb

    Joined:
    May 23, 2019
    Messages:
    12
    Likes Received:
    9
    Location:
    USA
    I just did a test with some fast motion in front of one of my 5231 cams (all with VBR Best, bitrate maxed out, and 15fps):
    1. Smart Codec Off, IFrame 15 (1 keyframe every second)
    2. Smart Codec Off, IFrame 150 (1 keyframe every 10 seconds)
    3. Smart Codec On

    I walked along the same path at the same approximate speed while holding a box that had a bunch of text on it, to test the normal sort of motion the cam will encounter. I then walked while holding the box in front of the cam but much closer so that the box would take up a large amount of the frame, to see if forcing the encoder to replace a large amount of the frame it would suffer from any sort of issues that having more frequent keyframes would help.

    After reviewing the footage, there doesn't appear to be any discernible difference between any of them whatsoever. No difference in clarity, no artifacts in any case. It appears the encoder had plenty of data to accurately represent the frames it was being fed in each of these cases. Note that this was during twilight and this deserves some additional testing at night to see if there's any difference. I am new around here but have a lot of experience in the video encoding space, and this is actually what I expected, assuming the encoders were properly implemented.

    So I think your pixelation issue was a disturbance in the stream rather than a limitation of the encoder. Also, your observation of it taking more time for the live view to appear makes sense. I'm sure it waits until the next keyframe to initiate the display. That may be a reason for someone to prefer more frequent keyframes.

    Otherwise, Smart Codec or longer iframe intervals would seem to make sense for someone who doesn't care if it takes a few seconds to load a live stream and would see benefit to the stream/storage needing less bandwidth/space. While Smart Codec doesn't apply to the sub-stream, a longer iframe interval does, so it's an option to tweak mobile device performance.

    Another thought I've had related to this is on the question of framerate. While I know the conventional wisdom around here is that 15fps is plenty, in the extreme cases of trying to ID someone moving, a lower framerate could miss the perfect angle that would allow an ID, that a higher framerate would capture. Considering that, I think it would be reasonable for someone to potentially choose a higher framerate with a longer iframe time, essentially using the data that would be a relative waste if it were used on a keyframe to instead capture more frames. In this example I'm thinking of a case where the bitrate is essentially equal in both cases.
     
    Dramus and bigredfish like this.
  9. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    Thanks for that in-depth testing, @Insecurities. I'm really kind of surprised nobody has done these kinds of tests/experiments before now. I suppose it helps that you appear to understand, in depth, how all this works... or is supposed to work.
     
  10. Insecurities

    Insecurities n3wb

    Joined:
    May 23, 2019
    Messages:
    12
    Likes Received:
    9
    Location:
    USA
    No problem. Maybe similar testing has already been done. I'm not claiming to be doing anything revolutionary, I just figured I'd do a quick test for myself since I didn't see any conclusive info/testing on this stuff.
     
    ThePeacockRanch likes this.
  11. fixxxer0

    fixxxer0 Young grasshopper

    Joined:
    Dec 21, 2018
    Messages:
    32
    Likes Received:
    12
    Location:
    USA
    I can't playback any recorded footage with H265 Smart Codec in Blue Iris, so i have to keep it off.

    Is this a known issue/limitation?
     
  12. fenderman

    fenderman Staff Member

    Joined:
    Mar 9, 2014
    Messages:
    30,233
    Likes Received:
    9,351
    Yes
     
  13. mark_whocares

    mark_whocares Getting comfortable

    Joined:
    Apr 20, 2017
    Messages:
    66
    Likes Received:
    18

    Surveillance station live view is probably to blame here in my experience - the live view is often bad with h.265 ; but will be fine in say other live stream apps like iDMSS Plus or SmartPSS.


    if you run playback on timeline i'm curious if you see it there as well ; I never had w/my 916+.
     
  14. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    Except I was using H.264+, as you'll see in the screen capture of my config in my OP.

    Recording is done with Sub Stream 1, as I noted in post #7. So, even if it was recording, there'd be nothing to see.
     
  15. mark_whocares

    mark_whocares Getting comfortable

    Joined:
    Apr 20, 2017
    Messages:
    66
    Likes Received:
    18
    sorry, I should have said that it doesn't matter if it's h.264 or h.265. granted I used h.265 on everything. however I tested it with synology support on various h.264 flavors for a long time just to demonstrate to them the problem.

    Syno live streams are, in my experience, always showing dithering, grayed out frames, and other encoding problems when viewing live streams.

    when comparing side by side, syno live stream apps on either the laptop or the mobile devices to SmartPSS and iDMSS I always see the non-syno stream images to appear correct. Syno stuff (Surveillance Station client) or DS Cam app always have long periods of gray screen, torn images, encoding issues (green and purple chunks) ..etc. not just at startup, but also after steaming for some time. unable to reproduce with non-syno stuff.

    The problem for me has always been limited to the syno live stream stuff. Again, I've never been able to replicate using any other client to view the stream. I also never see the sub-par frames in the timeline view.

    I am also only recording the main stream, I use the sub stream from each camera to feed mobile views in DS Cam and the live view when not focused on a single camera in Surveillance Station - which will flip to the main stream when a single camera is focused on it.

    having the smart codec on will save a lot of disk space, if you can deal without the IVS features of your camera and use just simple motion detection you should be able to have smart codec on and save a lot of space in many cases if you have relatively static captures. that said the ultra starlight i have saves no disk space smart codec on vs off with the syno stuff. of course syno also has the wrong sub stream resoltions for that camera too, despite being on the support list. they said they won't fix it....
     
    Last edited: Jun 12, 2019
  16. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    I haven't experienced any problems with dithering, grayed out frames, and other encoding problems when viewing live streams. Nor torn images or green/purple chunks. Either via web browser or DS Cam.

    I'm recording Sub Stream 1 because I want to be able to view them on DS Cam, and the Syno SS doesn't have the smarts to transcode Live or recorded streams into less bandwidth-intensive resolutions and bit rates.
     
  17. mark_whocares

    mark_whocares Getting comfortable

    Joined:
    Apr 20, 2017
    Messages:
    66
    Likes Received:
    18
    then you are having a better experience with DS Cam (iOS) and SS client (OSX) then I am.

    here are the models of cams i'm using.

    IPC-HFW8232E-Z
    IPC-HFW5231E-Z5
    IPC-HDW5231R-Z
    IPC-HDW5231R-ZE


    i only stream from sub stream(s) to mobile, I don't record it.

    on the syno side what does your config look like ?
     
  18. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    I'm using DS Cam on iOS (iPhone 6S and iPad) and either Firefox or Chrome on a Linux box.

    I'm using IPC-HDW5231R-ZE, IPC-HDBW4231F-AS and a Reolink C1.

    I'm recording Sub Stream 1 because I want to be able to view recordings on my mobile devices on wireless connections.

    Not certain what you mean. Hardware-wise? DS218+, stock RAM, a pair of WD Red 4TB drives.
     
  19. mark_whocares

    mark_whocares Getting comfortable

    Joined:
    Apr 20, 2017
    Messages:
    66
    Likes Received:
    18
    I mean the config of the camera in the Synology SS side. are you running it with generic dahau or the cam specific selection ? after that what other options to do you have configured ..etc
     
  20. Dramus

    Dramus Getting the hang of it

    Joined:
    May 7, 2019
    Messages:
    95
    Likes Received:
    52
    Location:
    New Jersey
    I'm using the manufacturer- and model-specific selection in SS. The camera settings can be seen in my OP. I don't have any other tweaks done on the SS side.