Transcoding MP4's for use with DaVinci Resolve on Linux

DaVinci Resolve is very picky when it comes to container formats, video and audio codecs - especially in the Linux version. The first step after reviewing my FPV footage (and deleting what I will definitely not use) is converting it into a format that resolve can handle.

My main cameras are a GoPro Session 5 on my five inch rigs and a Caddx Turtle V2 on all smaller rigs and my brushless HD whoops. But this guide will basically work with any source material you have problems opening in DaVinci Resolve.

In case of the GoPro Session 5 we get a MP4 container with H.264 encoded video and Mpeg-4 AAC encoded audio. In case of the Caddx Turtle we get also a MP4 container with H.264 encoded image but this time Raw 16-bit PCM audio (I don’t care for the audio of the turtle at all - in fact I even de-soldered the mic of mine, because I simply can not stand it).

Resolve does not like this at all - neither the container nor the video codec. In case of the GoPro footage not even the audio codec. Therefore I am transcoding it with FFmpeg (a multi-media converter and more) to something more “Resolve friendly”:

ffmpeg -i GOPROxxx.MP4 -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov OUTxxx.mov

This converts the source footage into a mov container with mjpeg encoded video and PCM encoded audio.

The -q:v n parameter is responsible for quality where n can be anything from 2 - 32. 2 being lossless and resulting in the biggest file size. I use 2 here in order to keep the highest quality possible. When setting the q:v option to 3, the resulting file is only have the size of the one encoded with 2 and I can not see the difference, still I do not want to risk it and keep the highest quality possible.

I prefer to let YouTube or Instagram ruin the quality, until then I want to provide the best quality possible - maybe one day they will re-encode my source footage with better quality and I want to provide them with a source file with which their conversion might improve.

I chose mjpeg as codec since it is the easiest format for editing software to handel - every frame is encoded as separate jpeg, no keyframes needed. It does not result in the smallest file size - but conversion is rather fast, with around 200fps of full HD footage. Keep in mind that your mileage here might vary depending on the specs of your computer.

Advertising
Advertising

Batch processing

Usually I do not do this for a single file, but rather for multiple files, all in the same directory. Therefore I use the following one line bash command:

mkdir transcoded; for i in *.MP4; do ffmpeg -i "$i" -vcodec mjpeg -q:v 2 -acodec pcm_s16be -q:a 0 -f mov "transcoded/${i%.*}.mov"; done

This will transcode all MP4 files in the directory you are invoking this command from into mov files in a new directory called transcoded.

Source:

Chris is a Vienna based software developer. In his spare time he enjoys reviewing tech gear, ripping quads of all sizes and making stuff.

Learn more about Chris, the gear he uses and follow him on social media:

Show more comments