Background processing creates (uncompressed?) avi files


#1

Hi,

after I switched to the service, and at the same time turned on background processing, I notice, on 1 of the 2 instances, that in the library are no both .avi and .mp4 files:

Because of this, The folders are now +/- 100gb a day, while it was only 20gb a day.
The moment I disable background processing, only mp4 files are generated:

I only see this behaviour on 1 of the 2 systems I’m managing…

PS: maybe this could also be the reason why the issue in my other topic occurs: NetcamStudio.Service doesn't respect library limit and kills itself

Mitch


#2

Hi Mitch!
When enable Background processing the files are first stored in the avi format. When the workload of the CPU is lower the ffmpeg process starts to convert avi to mp4 format. When that is done the avi file is deleted.

The idea for the Background processing was to reduce a high cpu load and let the avi to mp4 conversion take place when the CPU load is lower. However, what happens is that the cpu load is still high, but the background processing introduces a delay. Since NCS displays only the mp4 format the background process introduces a delay from the time the motion is detected and the file is stored in avi to when the file is converted to mp4 and can be displayed. I have a system with a cpu load of 90%. Enabling background processing introduced a delay of 10 minutes.

When you have a low CPU load and enabled background processing it sometimes increased the cpu load instead of lowering it and also introduced this delay. The simultaneous process of encoding from avi to mp4 is so efficient so the idea was not a hit ;). We have discussed to remove this option and we will do so. So my recommendation is to not use the Background processing since as you point out it increase the use of space on the HD and yes, that extra space used for avi files are not included in the Maximum Library size! (Thanks for pointing that out).

To reduce the cpu load with the same hardware is always of interest since one can increase the quality of the videos or connect more cameras or have cameras with a higher resolution or … There are two other possibilities using hardware acceleration available in many processors. One is the DXVA2 which can be enabled in Settings and the tab Decoding/Encoding. That is not as efficient as we hoped for so the other type Quick Synch is in the process to be ready as soon as possible. These HW accelerations are not available in all processors, but in a lot of them.

Thanks,
Henrik


#3

Hi Henrik,

Ok. In my case I have AVI files of more than 24h old. When I look at the cpu, it’s always almost 90-100%, so probably it never has the chance to start processing the files. I’ll switch the other one to normal as wel.

The hardware acceleration, you mean this option:

Is this only applicable on the decoding (so displaying) streams in the client? Or also on encoding on the server?


#4

Yes, that option. Instead of using the software/cpu for avi to mp4 it uses the graphics hardware if available to do the transcoding from avi to mp4. You can download a small program that checks the system if it supports dxva2. You can also check the processor/graphics if it supports this. Or just just turn it on and see what happens. At the same time check for quick synch. Todays cpu are so powerful and efficient that these things don’t do that much, I think.
-Henrik


#5

Please don’t remove the background processing option! If I don’t use background processing, then my mp4’s will have a strange issue… If the file is (for example) 20 seconds long, it will contain <20 seconds of actual video and then the image will freeze, even though VLC (Windows Media Player, etc.) show that the video is still playing to the end. So the time clock overlay from the camera will be counting along, and then everything will freeze while the video apparently plays on. This has caused a lot of frustration as the motion event hasn’t stopped but the video did!


#6

Hi,
OK, I will recommend to keep that option a little bit longer. However, what you describe is a problem that must be solved.

  • What version of NCS to you use?
  • The file is first saved in avi format. If you play that file is it fine?
  • Do the computer have a very high CPU load all the time?

-Henrik


#7

I am using the latest NCS with several cameras, although even having just one seems to be sufficient to see the issue. The cams are all set to 720P with 5 FPS. The PC is a 3.5GHz i7 with 12 GB RAM and a slow 5400 RPM HDD. I’m thinking the HDD could be the culprit. Looking at perf mon, the CPU is never above 25% and RAM utilization is very low (2 GB). NCS is basically the only thing running on the machine. If I turn off Background encoding, and set the recording setting that controls Compression Level vs. CPU usage to something like “VeryFast”, then the issue doesn’t happen. As soon as I turn up the compression level (e.g. “Medium”), I see the issue. If I understand correctly, if Background encoding is off, then no AVIs are created, correct? The MP4s will have the issue where the video freezes mid-video, while VLC or WMP will show the video is still “playing” to the end. I’d like to have smaller video file sizes because I upload them to the cloud for storage. To be fair, I previously used iSpy, which had the same issue. It had a bunch of other issues though, so I stopped using it. NCS has so far been much better than iSpy!


#8

Hi!
Of cause, Netcam Studio is the champion! Ha ha, many thanks for the positive words. We try to do our best!
Thanks for the excellent information. Very interesting to see that you have the issue even with only one camera. That makes it more easy.
-It´s not a hardware problem. Is it Windows 10? The HDD is not the problem. I am using a HD with the same rpm with a much higher load, assuming the HD is ok.
-When Background encoding is off the transcoding from avi to mp4 is done directly in the software so the avi is never stored. The mp4 is stored.
-I would really like to know if the avi file plays correct?

  • If you can do the following tests with one camera it is appreciated. First use the default settings as

  • Problems?
  • Enable Background Encoding. Problems?
  • Change FPS to 5 FPS. Alter between Background Enc. on and off. Problems?
  • Change to
  • Problems when you use 5 FPS and Background Enc. OFF?
  • When you turn up the compression level (video quality?) to “medium” what happens with the CPU load? “Medium” will compress the video more and therefore use more CPU power.
  • Since you mention that you have the same issue with another software and we probably use the same codec, ffmpeg, I would like to change to VLC and see if ffmpeg is the problem at low FPS.

Maybe a lot of tests, but I am trying to figure out where the problem is ;).

Thanks,
Henrik


#9

Henrik, thanks for the detailed responses. I did almost all of the permutations that you suggested last weekend. I left Video Quality at 20, but lowered “Images per second” to 5 FPS, played with the “Preset” slider, checked/unchecked Background Encoding, and changed the Decoding Library to Hardware. I did not try the Software_VLC setting though-- instead I changed it to Hardware while trying to fix the issue. I can play with that one tonight.

With Background Encoding checked, neither the AVI or MP4 have the issue, regardless of the other settings. The videos always play as expected.

With Background Encoding unchecked, the only setting that would alter whether the MP4’s video would freeze is the “Preset” slider. “UltraFast”, “VeryFast”, and (I think) “Fast” worked ok-- no freeze issues. As soon as I went to “Medium”, I experienced the issue on 100% of the MP4s.

I forgot to mention in my previous post, but I am using Win 10, and unfortunately haven’t used NCS or iSpy on anything but Win 10, so I can’t compare there. With “Medium” compression, the CPU definitely spikes up for each MP4. I will watch it tonight and see if it hits 100%.


#10

Hi. I had to look into this ;).
Yes, you are correct and very interesting!
This are my settings

The recorded file can be played in many different ways:

  1. Background Enc= off
  • go to folder and play the file with
    -VLC and Windows Medial Player: the video freeze.
  • SMPlayer Media Player or Movies & TV: no problem

-Background enc=on
-go to folder and play the file with
-VLC and Windows Medial Player: no problem
-SMPlayer Media Player: no problem

2.Background enc= off or on
-go to NCS and Library and play file with VLC is no problem
-play file using web client is no problem.

3.Increase FPS to 10
no problems playing the file in folder with any player.

Summary:
It seems to be a problem with low FPS and playing the file from the folder using VLC or Windows Media Player. It works with SMPlayer Media Player and Movies&TV. Changing to Software_VLC gives the same result.

It seems that when VLC and WMP get to little information in the stream they do not play well.

If you must copy files to the Cloud and use that low FPS I recommend to use SMPlayer or the default player Movies and TV in Windows 10 which also worked.

I am not sure if or when we will look into this since it is outside of NCS the problem is. However, it will work for you using one of the other players.

-Henrik


#11

I think we are seeing a couple different issues. I have seen the issue you noted where a video will play with one app but not another. But I tried all of the players that you mentioned and the videos that are created on the “Medium” setting still hang part way through playback (although the audio track continues on-- weird!).

The good news is that I did find a configuration that would work well for me: I set the Quality slider to the mid-point (30) and the Preset slider to UltraFast. This actually produces good quality videos with minimal CPU usage and smaller file size that actually play all the way through with my setup. I realized that the only camera that the video hanging issue would happen with is my MicroSeven, which I connect via RTSP-TCP. The others are Foscams, which I just choose from the predefined list. I’m not sure how their connection methods differ, but they definitely seem to be different.

BTW, when I connect the Foscam cameras by choosing from the drop down (FI9821W V2), NCS doesn’t show that they have audio, but it does know they are PTZ. How can I use the audio from those cams with NCS? The audio is coming through with my MicroSeven connected via RTSP-TCP, but not the Foscams.


#12

Hi,
OK, good news then. I assume you do not need to use the Background encoding any more?

When you connect the MicroSeven camera with rtsp the format h.264 is used. That format includes video and audio.
To connect the Foscam to get audio and video you must use RTSP in the settings.

When you add the Foscam set the Video Preset to RTSP Main. Foscam usually use port 80 or 88 for the RTSP. Where it says port 554 you must change that to 80 or 88. Test which one it is. Fill in IP number and Save. Hopefully you should have video and audio.

-Henrik


#13

Awesome, I’ll try out RTSP with the Foscams. And correct, I am not using Background Encoding anymore. I also set up the FTP to the cloud, which is working perfectly.