Playing and Converting Dahua NVR’s .dav H264 Videos…

Well, as if fighting the NVR in attempting to export video clips ain’t enough. There’s a need to convert stuff just to play ’em back…

I tried a solution using VideoLAN’s VLC Media Player, but that was a hit-or-miss affair (i.e. sometimes it worked, other times, not).

Enter FFMPEG

Continue reading

Exporting Clips Off A Dahua NVR…

I recently had an unfortunate episode requiring the exporting of a clip off a Dahua NVR, but I needed someone else to do it… (and no, I was not in jail, trying to instruct someone else to pull exonerating evidence off some CCTV, if that was what you were thinking)…

My original method of using the in-built web UI off the NVR, manual streaming conversion via VLC Player (after fiddling with it for a temporal configuration change to “enable” playback of .dav files) was just not going to “cut it”…

So, once I had the time, I waded into the battle of the forever-changing, forever-beta nature of Dahua firmware, software and hodge-podge end-user solutions…

SmartPSS

There happened to be a “new” version of the SmartPSS software (v2.002.0000008.0.T.190801); which was supposedly released a month ago (2019/08/01, as of writing this). This software was “supposed” to have had some (old) “enforced 1 hour video export” bug fixed. However, I was pulling my hair out as to why I could not seem to limit the video clip I chose to export. I finally found my clue and therefore am posting this here for posterity (actually, to enable other people to follow the same instructions to do this).

Continue reading

A Weasel for WSL…

So I have been using Windows Subsystem for Linux (WSL) for a while now (specifically, the “Microsoft’ed” version of Ubuntu 18.04).

Recently, I have had to use my local desktop to handle some git stuff, and I decided to do so within WSL. First up, I ran headlong into access problems – I run PuTTY Pageant and did not want to explicitly run ssh-agent inside WSL, not to mention maintaining a duplicate of my private keys in the WSL environment(s).

Well, agent forwarding was made for a reason, so I immediately set off to find a solution.

Continue reading

GNU getopt Needs A Helper

So, recently at work, I found myself knee deep in… scripts…

Most of my scripts had ugly positional parameters/arguments (you know, $1 was the value for this, $2 was the input for that)… So, I dug up getopt… But then I quickly spiralled down the time-sucking rabbit hole of trying to automate some other bits, like being able to print the “usage” by “simply” plucking out all the options given to getopt in the first place…

Continue reading

sed Shennanigans…

Escaping…

For anyone familiar with regular expressions, the need to escape characters, that might otherwise be construed as some “special command”, is a regular affair…

sed posed a particular challenge for me when attempting to escape variables that are used as a replacement string. So, to cut the long story short, after 8 hours of trying, testing and re-testing, I finally got the solution…

In a bash shell, try the following:

TESTSTRING='\/12345678\90!@#$%^&*()-_=+{}[];:",.<>? `~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
sed "s#\([^[:alnum:]]\)#\\\\\1#g"<<<$TEST

Otherwise, in a script, try the following:

TESTSTRING='\/12345678\90!@#$%^&*()-_=+{}[];:",.<>? `~abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
TESTSTRING=`echo $TESTSTRING|sed 's#\([^[:alnum:]]\)#\\\\\1#g'

WARNING: This does not work with intended backreferences (e.g. \1, \2, … \9, etc.) as the leading backslash will also be escaped (see the \9 in the tests above).

NOTE: The single-quote character was not part of the tests as I could not find a way to escape that as part of the variable assignment.

Adding 4G/LTE Back Up Internet Link to pfSense VM…

Updates Fartdates…

So, my Ubuntu LTS 18.04 decided to have a brain fart during a “routine” system update just past midnight on Saturday morning… Rebooted the modem, switches, VM, VM host… nada

Wither Thou Internet…

With the ‘net down, I could not seem to see the list of update details, nor try and roll anything back… Worst yet, I was actually doing work (which needs a ‘net connection)… So the troubleshooting ensued…

Troubleshooting using my work laptop via my handphone hotspot was no fun… So, four-and-a-half hours later, I retired, disgruntled at not solving the issue (and also having to do three rounds of laundry, get woken up a mere 15 minutes later by my young daughter who wet her bed, and get awakened again 30 minutes after that due to one inconsiderate neighbour’s noisy pet birds – but that’s a totally different story and I digress)…

Saving Grace…

Just a few days ago, I had applied for a free 12-month trial from TPG (Singapore’s fourth telco), so at 10AM in the morning, I dragged myself out of bed, went to church, and then picked up the TPG SIM card… All this to use in a Huawei E3372-607 USB LTE/4G modem (together with a high-gain indoor antenna) purchased nearly two years ago that was meant to fix this exact situation (i.e. be a back-up Internet link).

Continue reading

Unifi Controller vs. MongoDB Debacle

Ubiquiti’s Motto: If It Ain’t Broke, Don’t Won’t Fix It

After my upgrade of my Ubuntu LTS 16.04 to 18.04, I discovered some things had broken, including the Unifi Controller used for my UAP-HD. Apparently, the entire /usr/lib/unifi directory disappeared (alongside with MongoDB)!

Rooting around the Internet turned this thread up… And accordingly, there is a work-around, with some “clean-up” work.

The “official” fix is relatively useless, but that is another shouting match argument with another idiot person for a different time…

Anyway, on to the fix!

NOTE

The “fix” offerred below is not really one – it does not restore your data, although you could conceivably do so if you got creative in restoring some data files before re-installing MongoDB version 3.4 as per below…
Continue reading

Upgrading Ubuntu Server LTS 16.04 to 18.04 (aka GDM and x11vnc)

So, the time has come to upgrade my Ubuntu Server LTS 16.04 to the latest LTS 18.04…

It’s a straight-forwards upgrade, easy-peasy, right?

The Triumph Defeat of Hope Over Reality

Compared to what Linux used to be in the recent past, the upgrade via the stock 16.04 UI went fairly smooth…

I already knew that I had to do the standard ZFS pool upgrade:

sudo zpool upgrade <poolname>

But after the whole upgrade was done, I tried to VNC into the machine again after it rebooted… and failed.

2018/12/25 Update:

I suddenly noted that my Unifi Controller was no longer working… I later discovered that it was due to the Ubuntu LTS upgrade… Another day, another battle

Continue reading

My PC Is Suffering From Insomnia…

Quite a while back, my Windows 10 PC installed malware updates mandated by Microsoft, and it subsequently failed to resume from S3 sleep, for reasons which I did not have the time to investigate. I skirted the issue by disabling S3 sleep in BIOS, leaving only S1 sleep states available, which still worked…

About a week or two back, I started realising that my computer would not go to sleep at all

I needed to find the root cause and cure its insomnia; something was preventing Windows from going to sleep…

Continue reading

Microsoft: All You Beta Testers Belong To Us… (or “The Case of The Useless Drive”)…

With the shift to a more “app-like”, “force an update down your throat whether you like it or not” attitude from Microsoft, they have also seemingly shifted their testing stance and shafting their customers, taking from Xiaomi’s playbook: You are now our beta tester.

You Have a New (largely useless) Drive!

One of my family members have been complaining that an “E” drive suddenly appeared out of the blue. Navigating to it using Windows Explorer or via the command prompt shows it as empty, but, Windows Explorer shows the drive as “nearly full” (red bar), and Windows 10 continuously complains that the “E” drive is “full”…

Nothing in the Disk Management Microsoft Management Console “applet” could allow me to remove the drive letter, showing the partition type as an “OEM Parititon” – one of two that Microsoft littered on the already-small SSD like so many rabbit droppings (two other partitions are by the laptop manufacturer).

Continue reading