auto-save video as MKV or MP4 instead of DAV ?

cam235

Pulling my weight
Joined
Oct 5, 2016
Messages
323
Reaction score
164
I was happy to find that I can set my Dahua IPC-HF5421E camera to save motion-triggered video clips at full resolution to a FTP site, without using a separate DVR. These files are in the DAV format, which I was not familiar with. Now, it turns out that "mkvmerge" from the MKVToolNix package works OK to convert it (on a Linux box), for example:
Code:
mkvmerge -o outfile.mkv ch3_14.00.00-14.20.00.dav

It's no big deal to convert (takes < 1 second per file, I guess it is just rearranging headers) but is there a way to just have the camera save video directly into a standard format like MKV or MP4 instead of DAV ?

EDIT: I see Amcrest cameras do this as well (I guess OEM'd by Dahua ?) and people complain about it also.
https://amcrest.com/forum/technical-discussion-f3/ftp-format-other-than-dav-t471.html
 
Last edited by a moderator:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,329
Reaction score
5,325
Location
Denver, CO
nope, thats the format it records in.. think it has watermarks and other integrity features implemented that normal mkv or mp4 containers do not permit.

as you can see the conversion is light; i ran an inode watching script that converted the files as soon as they were done being written to my ftp server.. back before I got a Dahua NVR.
 

cam235

Pulling my weight
Joined
Oct 5, 2016
Messages
323
Reaction score
164
I get the feeling you're way ahead of me here. Not having a NVR as yet, on my FTP server I'm just doing

Code:
#!/bin/bash
# convert any .dav file into .mkv 
# runs as soon as temp "file.dav_" is renamed

watchdir=/home/pi/CAM3/MyCameraNumber

inotifywait -m -r -e MOVED_TO "$watchdir" |
  while read path action file; do
    ext="${file##*.}"
    base="${file%.*}"
    if [ "$ext" = "dav" ]; then
      echo $path$file >> flist.txt
      mkvmerge -o $path$base.mkv $path$file
      rm $path$file   # remove the original .dav file
    fi
  done
 
Top