Re-containerising VP9 from webm to MP4


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


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

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

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.