This is a quick tutorial on how to convert and remux WebM video to MP4 video.
Ever found yourself in a situation where you can't play a video on a mobile device, or you have to use VLC to play it since your regular player doesn't support the codec? Then you should probably convert those clips from the unsupported container to a supported mainstream container like MP4.
Table of Contents
Convert WebM to MP4
Using FFmpeg to convert
ffmpeg -i clip.webm clip.mp4
This will convert the WebM clip called clip.webm into a MP4 clip called clip.mp4.
Remux WebM to MP4
There isn't always a need to convert the video if all you want to do is to change the container (WebM, MKV, MP4) of your video. If you want the exact same video to be playable on other devices, like iPhones or iPads, you keep the original quality by just remuxing the video into a new container.
Remuxing, or stream copying as it's also called, is done by the ffmpeg binary by writing the following:
ffmpeg -i clip.webm -c copy clip.mp4
Since you don't want to re-encode the video, this process only takes a couple of seconds.
Addition for VP8 and VP9 Codecs
If you want to remux VP8 or VP9 codecs, which are usually used on modern streaming services like YouTube, into MP4 you need to add the -strict experimental flag to your FFmpeg job.
ffmpeg -i clip.webm -c copy -strict experimental clip.mp4
This will allow FFmpeg to remux VP8 and VP9 to an MP4 container.