Running Agent DVR on a slow computer

If you are running Agent DVR on a slow computer and keep getting errors like OPEN_INPUT: file not found

You can look in the logs and see things like:

And the cameras sometimes appear and sometimes don’t, the logs actually give a good hint of what’s going on.

OPEN_INPUT is looking for a pipe, which is only being created later on where it says creating pipe

I tried all kinds of things like using CPU, GPU, using a different version of ffmpeg, lowering the bitrate of the streams, but the problem is a race condition that happens before all that can have any effect. When it finally starts working, it works fine for any quality setting.

OK, how do we fix this? Easy. Before you start make sure the service isn’t running. Run services.msc, look for a service called Agent, which should be one of the first ones, and press stop.

Also look for the file Program files\Agent\CoreLogic.dll and make a backup copy of it.

Now get your favorite .NET decompiler (I used dnSpy which wasn’t great but worked) and open CoreLogic.dll.

Look for the class CoreLogic.Sources.Combined.NamedPipe and look for the public void Start() method. Right click and choose Edit Method (C#). Add the following lines so it looks like this:

Now press File > Save module, and save it as CoreLogic.dll. This will update the file in-place. Now go back to services.msc and restart the service. It should work after a couple seconds. Your log should look like this now:

(The first time it tries I still get an error, but the next time I see this:)

Notice how the pipe is created right after the wait starts, so 500ms is pretty safe. Enjoy!

Map react items with separator

I just wanted to share a little snippet that took me a few minutes to write but that is really useful. Let’s say you want to display a list of items separated by a string, or a line break. There are lots of options here: but they are not very elegant.

How about if you could write something like:

and get a list of links, separated by line breaks?

Well you can. Here is the code:

There are simpler ways of writing this but I wanted to understand how iterators work.