WebM to MP4 Complete Guide: 4 Methods Compared with FFmpeg Commands
You recorded a video using Chrome's screen recorder and got a WebM file, but your iPhone won't play it. Or you uploaded to a platform that only accepts MP4. WebM is great for the web, but MP4 is still the universal standard. Here are 4 reliable conversion methods with detailed FFmpeg commands.
WebM vs MP4: What's the difference?
| Feature | WebM | MP4 |
|---|---|---|
| Container format | WebM | MPEG-4 Part 14 |
| Video codec | VP8, VP9, AV1 | H.264, H.265, AV1 |
| Audio codec | Vorbis, Opus | AAC, MP3 |
| Origin | Google (2010) | MPEG (2001) |
| Patent licensing | Free | H.264/H.265 require licensing |
| File size (same quality) | Smaller | Larger |
| Browser support | Chrome, Firefox, Edge (limited Safari) | All browsers |
| iOS support | No | Yes |
| Editing software support | Limited | Universal |
Key takeaway: WebM is more efficient but MP4 is more compatible. For maximum compatibility (mobile devices, older browsers, editing software), convert WebM to MP4 with H.264 video and AAC audio.
For a deeper dive into codec differences, see our H.264 vs H.265 vs AV1 Codec Comparison.
Method 1: FFmpeg (Command Line, Recommended)
FFmpeg is the most powerful video processing tool. Install it first:
# macOS
brew install ffmpeg
# Ubuntu/Debian
sudo apt install ffmpeg
# Windows: download from ffmpeg.org and add to PATHBasic conversion
ffmpeg -i input.webm -c:v libx264 -crf 23 -c:a aac output.mp4Parameter explanation:
-i input.webm: Input file-c:v libx264: Video codec (H.264, most compatible)-crf 23: Quality (18=visually lossless, 23=balanced, 28=high compression)-c:a aac: Audio codec (AAC, universal)
High-quality conversion
ffmpeg -i input.webm -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k output.mp4-crf 18: Visually lossless quality-preset slow: Better compression (slower encoding)-b:a 192k: Higher audio bitrate
Small file conversion
ffmpeg -i input.webm -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 96k output.mp4H.265 conversion (smaller file)
ffmpeg -i input.webm -c:v libx265 -crf 28 -c:a aac output.mp4H.265 (HEVC) is about 30-50% smaller than H.264 at same quality, but has limited browser support and patent licensing issues. See our Video Compression Complete Guide for details.
Preserve original resolution and frame rate
ffmpeg -i input.webm -c:v libx264 -crf 23 -c:a aac -movflags +faststart output.mp4-movflags +faststart moves the moov atom to the beginning for progressive web playback.
Method 2: VLC Media Player (GUI)
VLC is a free media player that can also convert videos:
- Open VLC → Media → Convert/Save
- Click "Add" and select your WebM file
- Click "Convert/Save"
- In the Profile dropdown, select "Video - H.264 + MP3 (MP4)"
- Click the wrench icon to customize settings (codec, bitrate, resolution)
- Choose destination file path
- Click "Start"
VLC uses FFmpeg internally, so quality is similar to FFmpeg command line but with less control over parameters.
Method 3: Online Converters
Online converters work in your browser without installing software:
Pros:
- No installation required
- Works on any device with a browser
- Free for small files
Cons:
- File size limits (usually 100-500MB)
- Upload/download takes time
- Privacy concerns (your video goes to a server)
For a privacy-friendly alternative, use our WebM to MP4 online tool — all processing happens in your browser using WebAssembly, files never leave your device.
Method 4: Browser-based FFmpeg.wasm
FFmpeg.wasm is FFmpeg compiled to WebAssembly, running entirely in your browser:
- No installation
- No file uploads to servers
- Privacy-preserving
- 30-50% slower than native FFmpeg
Our site uses FFmpeg.wasm for all video tools. For batch processing or large files, native FFmpeg is more reliable.
Quality Optimization Tips
Choose the right CRF value
CRF (Constant Rate Factor) controls quality:
| CRF Value | Quality | File Size | Use Case |
|---|---|---|---|
| 0 | Lossless | Huge | Master archive |
| 18 | Visually lossless | Large | High quality |
| 23 (default) | Good | Medium | General use |
| 28 | Acceptable | Small | Web, email |
| 32+ | Low | Very small | Streaming at low bitrate |
Choose the right preset
Preset controls encoding speed vs compression efficiency:
| Preset | Speed | Compression | Use Case |
|---|---|---|---|
| ultrafast | Fastest | Worst | Live streaming |
| fast | Fast | Poor | Quick tests |
| medium (default) | Medium | Good | General use |
| slow | Slow | Better | Archival |
| veryslow | Slowest | Best | Final delivery |
Audio settings
-b:a 192k: Standard audio quality (recommended)-b:a 320k: High quality-b:a 96k: Voice-only or low quality
Resolution and frame rate
To change resolution:
# Scale to 720p, maintain aspect ratio
ffmpeg -i input.webm -vf "scale=-1:720" -c:v libx264 -crf 23 -c:a aac output.mp4
# Scale to 1080p
ffmpeg -i input.webm -vf "scale=-1:1080" -c:v libx264 -crf 23 -c:a aac output.mp4To change frame rate:
# 30fps
ffmpeg -i input.webm -r 30 -c:v libx264 -crf 23 -c:a aac output.mp4
# 60fps
ffmpeg -i input.webm -r 60 -c:v libx264 -crf 23 -c:a aac output.mp4Common Issues
| Issue | Cause | Solution |
|---|---|---|
| No audio in MP4 | Audio codec incompatible | Use -c:a aac |
| File is huge | CRF too low | Use CRF 23-28 |
| Conversion slow | Preset too slow | Use -preset medium or fast |
| MP4 won't play on iPhone | H.265 codec used | Use H.264 (-c:v libx264) |
| Black frames | Frame rate mismatch | Use -r 30 |
| Cross-origin playback fails | moov atom at end | Add -movflags +faststart |
Summary
Converting WebM to MP4 is straightforward with FFmpeg. The basic command ffmpeg -i input.webm -c:v libx264 -crf 23 -c:a aac output.mp4 covers 90% of use cases. For maximum compatibility across devices and platforms, always use H.264 video and AAC audio in an MP4 container.
Quick reference:
- Universal compatibility: H.264 + AAC in MP4
- Basic command:
ffmpeg -i input.webm -c:v libx264 -crf 23 -c:a aac output.mp4 - High quality:
-crf 18 -preset slow - Small file:
-crf 28 - No install: Use our browser-based WebM to MP4 tool