Re-containerising VP9 from webm to MP4

Software

Recently I learned that VP9 video can be re-containerised to something other than webm, without re-encoding the original video and/or audio. This is useful for importing into tools that support the VP9 codec, but not the webm container.

Recent versions of ffmpeg(1) have a -c copy shorthand for instructing the audio and video encoders to just copy the source:

$ ffmpeg -i example.webm -c copy example.mp4

Note that you’ll get an error if you try to output to a mov container, as I’ve seen plenty of bloggers and forum posts erroneously suggest:

[mov @ 0xHEX] vp9 only supported in MP4

ffmpeg can also re-containerise into my preferred Matroska, which I’ve also since learned is the format on which webm is based:

$ ffmpeg -i example.webm -c copy example.mkv  

Tools like DaVinci Resolve can now import your VP9 video, albeit with variable results. You may need to re-encode entirely if the output is garbled.

$ ffmpeg -i example.webm example.h264.mp4

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!