To make a downloaded WebM file easier to play on phones, editors, and older devices, encode it as H.264 video with AAC audio in an MP4 container. FFmpeg can sometimes change only the container without re-encoding, but that preserves the original codecs and may not solve a compatibility problem.
Only convert media you are allowed to keep or modify. Make sure the browser has finished saving the original file before using FFmpeg.
Check what is inside the WebM file
A filename alone does not tell you which codecs it contains. WebM commonly uses VP8 or VP9 video and Vorbis or Opus audio under the WebM container guidelines. Inspect the streams before choosing a command:
ffprobe -v error -show_entries stream=codec_type,codec_name -of compact input.webm
Replace input.webm with your filename. The output names the video and audio codecs. If the command reports that the input cannot be read, confirm the browser download finished and that the file is really a WebM rather than an error page saved with the wrong extension.
Make an MP4 for broad playback
This command creates H.264 video and AAC audio. It is the reliable starting point when the destination app does not accept the original WebM codecs:
ffmpeg -i input.webm -map 0:v:0 -map 0:a:0? -c:v libx264 -preset medium -crf 23 -pix_fmt yuv420p -c:a aac -b:a 160k output.mp4
-crf 23 balances size and quality; a lower number generally keeps more detail at a larger file size. -pix_fmt yuv420p improves playback compatibility. The optional audio mapping lets a silent video convert without failing because it lacks an audio track. FFmpeg must have an H.264 encoder such as libx264 available in your installation. Its codec documentation lists available encoders and options.
Encoding takes longer than copying streams and can lose some quality. Keep the original WebM file until you have opened the finished MP4 and checked its picture, sound, and duration.
Try a fast container change only when suitable
If your target app already supports the codecs inside the WebM and only requires an MP4 container, you can try:
ffmpeg -i input.webm -c copy output.mp4
-c copy does not decode or re-encode the streams, so it is fast and does not introduce encoding loss. It can fail when the destination container cannot accept a stream, and a successful copy still leaves the original video and audio codecs unchanged. FFmpeg explains these limits in its stream-copy documentation. If the target player still refuses the MP4, use the H.264/AAC command above.
Check the result and common failures
Open output.mp4 in the app where you plan to use it. If video works but sound is missing, inspect the input with ffprobe to see whether it had an audio stream. If FFmpeg reports Unknown encoder 'libx264', install a build with that encoder or use another supported H.264 encoder and review its options. If it reports an invalid input, get a complete copy of the source file before trying to convert it.
Changing .webm to .mp4 in a file manager does not convert the container or codecs. Similarly, copying streams does not improve resolution or restore detail lost in the original upload. For help choosing a format before downloading, see MP4, WebM, and MP3 compared.