---
name: "dhav2mkv"
section: "1"
platform: "linux"
package: "dhav2mkv"
version: "1.4.1-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/dhav2mkv"
---

# dhav2mkv(1)

DHAV video to MKV format converter

## NAME

**dhav2mkv** - DHAV video to MKV format converter

## SYNOPSIS

```
dhav2mkv [OPTION]
```

## DESCRIPTION

**dhav2mkv is a standalone tool which converts DHAV(H.264) video to MKV(H.264)** **video.**

**dhav2mkv only operates at media container level, thus the H.264 data is exactly** **as provided by the DVR (with all its bugs).**

**dhav2mkv does not support specifying a channel number. It assumes the stream** **holds a single channel, instead of a theoretically possible 'n' multiplexed** **channel stream. The reason that option support was dropped is that some DVRs** **generate DHAV streams with incorrect channel number such way that two or more** **channels collide with the same channel number, what makes impossible to** **differentiate one from another. Also there's the fact that DHAV multi-channel** **multiplexing is not used in practice.**

**This tool is part of the TaniDVR project.**

## OPTIONS

- **-i, --in-file**

  **\<input DHAV file\> (default: empty -- uses stdin).**

- **-o, --out-file**

  **\<output MKV file\> (default: empty -- uses stdout).**

- **-x, --sixty-hertz-ntsc**

  **(default: not enabled).** **If defined, assumes NTSC field frequency to be 60Hz,** **instead of the typical 59.94Hz.** **Some cameras do generate exact 60Hz video.** **This switch does NOT affect PAL video.**

- **-r, --ts-proc**

  **0 - No correction will be performed to** **the buggy DHAV stream timestamps.** **1 - Perform timestamp correction (default).**

- **-h, --help**

  **Prints help message and exit.**

## USE CASES

- •

  **To convert already-existing DHAV files to MKV.** **Those files may be tanidvr-generated or generated by the software included** **with the DVR itself (due to legacy, or by choice).**

  **DHAV files are only (currently) playable with the software included with** **the DVR, while MKV is a modern, open and commonly supported container format.** **Using a standard container also allows the video to be recompressed for** **better storage usage.**

- •

  **To create a video hub (a video repeater), propagating DHAV media which,** **at the end-point, is converted to MKV.**

  **The DVR itself supports a very limited number of simultaneous connections** **(usually slighty more than hardware channels). Also, near the maximum** **active connections the DVR tends to be even more unstable. Direct** **connections to the DVR should be kept to essencial minimum.**

  **dhav2mkv allows the conversion of ongoing DHAV video (doing that with** **MKV is not viable for technical reasons). Any stream starting point** **(down to byte granularity) is acceptable. Also, temporary source** **interruption with lost/corrupted data suffers automatic resync** **(what is also done by 'tanidvr', when outputting MKV data).**

  **A simple media hub may be implemented with existing complementary** **software such as ncat (from nmap project) with its '--broker' option.**

- •

  **For Digital Forensics. Some police forces already use dhav2mkv** **for last-step recovering of video evidence from apprehended DVRs.**

## EXAMPLES

- •

  **Convert an existing DHAV file to MKV.**

```
              dhav2mkv -i MyVideo.dhav -o MyVideo.mkv
```

- •

  **Using dhav2mkv instead of tanidvr's internal routines.** **NOTE: NOT NECESSARY in practice since tanidvr can output MKV directly.** **It is shown only for didactic purposes.**

```
              tanidvr -n 0 -m 1 -t 192.168.0.12 -u admin -w secret1234 -c 2 | dhav2mkv > channel_2_video.mkv
```

- •

  **Simple media server and some clients.** **NOTE: INSECURE. NOT to be implemented as-is.** **It is shown only for didactic purposes.**

```
              (server at 192.168.20.1)
              tanidvr -n 0 -m 1 -t 192.168.0.12 -u admin -w secret1234 -c 5 | ncat --broker -l 192.168.20.1 2000
              (clients ; same/other host)
              ncat --recv-only 192.168.20.1 2000 | dhav2mkv | mplayer -cache 32 -
              ncat --recv-only 192.168.20.1 2000 | dhav2mkv > channel_5_realtime_backup.mkv
              ncat --recv-only 192.168.20.1 2000 > channel_5_realtime_backup.dhav
```

## AUTHOR

**dhav2mkv was written by Daniel Mealha Cabrita \<dancab@gmx.net\>.**

**This manual page was written by Marcos Talau \<marcos@talau.info\>** **for the Debian project (but may be used by others).**
