00:00:00/Guide

How to convert CCTV footage to MP4 (.dav, .264 and friends)

You convert CCTV footage to MP4 by rewrapping it with ffmpeg (ffmpeg -i input.dav -c copy output.mp4) or by re-exporting it from the recorder with MP4 chosen as the format. Most exports, .dav files from Dahua-family recorders and raw .264 dumps included, already hold ordinary H.264 video, so converting usually means changing the wrapper, not touching the video itself.


The file came off the recorder fine, and now nothing will open it. Security recorders mostly store video in their own container formats: Dahua-family kit (which includes a lot of unbranded boxes) exports .dav, Hikvision recorders often copy their own player onto the USB stick alongside the clips, and plenty of DVRs dump the raw compressed stream as a .264, .h264 or .h265 file with no container at all. The video inside is nearly always standard H.264 or H.265; it's the wrapper that's obscure. That's also why the fix is cheap: you rarely need to re-encode anything, only repackage it.

The safe routes, in order

  1. 01

    Re-export from the recorder, choosing MP4

    If you still have access to the recorder, go back into its backup or export menu and look for a format option. Many recorders offer MP4 or AVI alongside their proprietary default, and picking it at export skips the conversion problem entirely.

  2. 02

    Try the vendor's own player

    Dahua and Hikvision both publish free desktop players, and recorders often copy one onto the USB stick with the export. The player will handle the native files, and most versions can save or convert a clip to MP4 or AVI from inside it.

  3. 03

    Use ffmpeg

    ffmpeg is the free tool the video world runs on, and for CCTV exports it usually rewraps the stream in seconds without touching the picture. The exact commands are below.

  4. 04

    Fall back to VLC to watch it

    If you only need to see the footage rather than share it, VLC can often play .dav and raw .264 files directly. Media > Open File, and it'll have a go even when everything else refuses.

Route one deserves its own page: the export guide covers getting footage off a recorder in the first place, format choice included.

The ffmpeg commands that do it

Install ffmpeg from ffmpeg.org (on a Mac, brew install ffmpeg does it), open a terminal in the folder holding the export, and pick the line that matches your file.

  • .dav to MP4: ffmpeg -i input.dav -c copy output.mp4. The -c copy moves the video into the new container untouched, so it takes seconds and loses nothing. Any ffmpeg from the last few years reads .dav natively.
  • Raw .264 or .h264 to MP4: ffmpeg -f h264 -i input.264 -c copy output.mp4. The -f h264 tells ffmpeg it's a bare video stream with no container. If the result plays too fast or too slow, add -framerate 12 (or whatever the camera actually records at) before the -i.
  • Raw .h265 to MP4: the same idea with -f hevc, so ffmpeg -f hevc -i input.h265 -c copy output.mp4. Add -tag:v hvc1 before the output name if the file won't play on an iPhone or a Mac.
  • If the copy route errors, re-encode instead: ffmpeg -i input.dav -c:v libx264 output.mp4. Slower and slightly lossy, but it accepts almost anything ffmpeg can read.

One quirk worth knowing: recorder audio is often G.711, which the MP4 container refuses, so a stream copy can fail on the audio track even though the video is fine. Add -c:a aac to convert only the audio, or -an to drop it, and the copy goes through.

Once it's an MP4, make it searchable

An MP4 plays anywhere, and it also opens the door to actually finding things in it. Upload it to Svid and a vision model describes the sampled frames in plain English, so you can search “person in a red jacket near the till” instead of scrubbing. An uploaded file is a first-class input, read the same way as a live camera feed. Svid doesn't read .dav or raw .264 files directly, so the order is exactly this page: convert first, then upload. There's a fuller guide to making footage searchable for when the conversion is done.

What is a .dav file and how do I open it?
It's the export format used by Dahua-family recorders, including many unbranded ones: ordinary H.264 or H.265 video in Dahua's own container. VLC can often play it directly, the vendor's own player handles it, and ffmpeg converts it to MP4 with a one-line stream copy.
Can VLC convert CCTV files to MP4?
It can often play them, which is sometimes all you need. VLC does have a convert feature (Media > Convert/Save) and it sometimes works on these files, but it re-encodes by default and is less predictable than ffmpeg's stream copy. Treat VLC as the player and ffmpeg as the converter.
Why does my converted file play at the wrong speed?
Raw .264 dumps carry no framerate, so ffmpeg assumes 25 frames a second. CCTV is often recorded at 8, 12 or 15, which makes the output look sped up. Tell ffmpeg the real rate with -framerate before the -i and the timing comes right.
Will converting to MP4 lose quality?
Not on the stream-copy route: -c copy moves the video into the MP4 container bit for bit, so the picture is identical. Only the re-encoding fallback (-c:v libx264) is lossy, and mildly so at default settings.

Search the footage you just converted

Create an account at app.svid.ai and upload the MP4. Every sampled frame gets described in plain English, and finding the moment becomes a text search.

Get started

Related footage