How to fix certain H264 MP4s that cannot be imported into DaVinci Resolve

Recently I came across a set of video recordings that DaVinci Resolve would not import. According to its Media Storage viewer, the folder they were in was empty, except for one of the videos which was suspicious to me. These recordings played fine in multiple media players but most suggestions I could find for resolving the issue via Google either blamed the user, suggested they have to upgrade to DaVinci Resolve Studio, or worst of all – transcode the videos to a compatible format. Transcoding is time intensive and lossy, and Studio costs money, so let’s try to avoid either of those.

There are a couple ways to identify whether this is going to work for your video files.

  • If Windows does not display a thumbnail for them then that’s a good sign (I haven’t verified what MacOS or Linux do in this situation).
  • In VLC, if you view the codec information you will see something like this:
VLC codec information showing "(h264)" in brackets

The (h264) part is the hint that our file is in a format that Resolve doesn’t support. This ID means the file contains NAL units in a certain format that differs from other H264 files that may otherwise be identified by (avc1). We can change this by using ffmpeg and we can do it fast and without any transcoding.

ffmpeg -hide_banner -loglevel quiet -stats -i in_video.mp4 -c:v copy -c:a copy out_video.mp4

Where in_video.mp4 is our input and out_video.mp4 is our output. The simple act of copying the original streams into a new output container allows ffmpeg to recalculate the NAL units that Resolve is happy with. This should run very quickly and leave you with a video that has a visible thumbnail on Windows, and can be imported by Resolve. If you check the resulting output video in VLC it will show its codec ID to be (avc1).

There is a chance that the resulting video could lose damaged chunks, so check the difference in duration carefully and review the output for lost data.

If you have a lot of videos with this issue that you need to convert, you can create a simple batch file on Windows that will allow you to drag and drop to convert them:

@echo off
if "%~1"=="" echo only drag and drop files&pause&exit
ffmpeg -hide_banner -loglevel quiet -stats -i "%~1" -c:v copy -c:a copy "%~n1 fixed%~x1"

Save as convert.bat for example, and drag your broken videos to it one by one to fix them. Your new output video will maintain the original filename with “fixed” appended to the end.

Leave a Reply

Your email address will not be published. Required fields are marked *