ffmpeg: Convert HikVision H.265+ videos to MKV

The following command will find all mp4 files that are in the current directory and in all sub-folders and convert them to mkv.

Recently we needed to share some footage from a HikVision NVR which was recording to H.265+ which was a proprietary format of the company. To do so, we converted them in another format that more players could recognize the videos.

for FILE in *.mp4; do
  echo -e "Processing video '\e[32m$FILE\e[0m'";
  ffmpeg -i "${FILE}" -analyzeduration 2147483647 -probesize 2147483647 -c:v libx265 -an -x265-params crf=0 "${FILE%.mp4}.mkv";

The filename of the mkv file will be the same as the mp4 video with the correct extension. The mp4 extension will be removed and replaced by the mkv extension e.g hi.mp4 will become hi.mkv

A few notes, the compression they use seems really good, the size of the original video is very small in comparison to the generated result.

Hikvision DVR sending email over GMail

Recently, we were trying to setup the email configuration of a Hikvision DVR which even though it was updated to the latest firmware we would get the message Testing Failed when trying to send an email over GMail.

In the GUI of the DVR there was an option to Enable SSL but no option to enable TLS/STARTTLS. So after consulting the GMail official documentation on how to configure an email client for GMail, we set the SMTP Port to 465 and enabled the SSL option. Then we created an application password for the DVR and tried to test the settings. To our disappointment we got the Testing Failed message.

After reading the latest user manual of the DVR, it mentioned an option to Enable SSL/TLS but not Enable SSL which got us curious. It raised the following question to us: “What if they enabled the TLS functionality but they forgot to update the GUI to match it?”. So we changed the port to 587 and hit Test again.

Guess what ?

It worked!!

It appears that Hikvision enabled the TLS/STARTTLS functionality but forgot to make their GUI reflect the change!

Using the settings depicted in this photo, we were able to send test messages from our Hikvision DVR over GMail using TLS/STARTTLS on port 587 of smpt.gmail.com!
The confirmation of the successful email sending operation.