Skip to content

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?

FeatureWebMMP4
Container formatWebMMPEG-4 Part 14
Video codecVP8, VP9, AV1H.264, H.265, AV1
Audio codecVorbis, OpusAAC, MP3
OriginGoogle (2010)MPEG (2001)
Patent licensingFreeH.264/H.265 require licensing
File size (same quality)SmallerLarger
Browser supportChrome, Firefox, Edge (limited Safari)All browsers
iOS supportNoYes
Editing software supportLimitedUniversal

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.

FFmpeg is the most powerful video processing tool. Install it first:

bash
# macOS
brew install ffmpeg

# Ubuntu/Debian
sudo apt install ffmpeg

# Windows: download from ffmpeg.org and add to PATH

Basic conversion

bash
ffmpeg -i input.webm -c:v libx264 -crf 23 -c:a aac output.mp4

Parameter 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

bash
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

bash
ffmpeg -i input.webm -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 96k output.mp4

H.265 conversion (smaller file)

bash
ffmpeg -i input.webm -c:v libx265 -crf 28 -c:a aac output.mp4

H.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

bash
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:

  1. Open VLC → Media → Convert/Save
  2. Click "Add" and select your WebM file
  3. Click "Convert/Save"
  4. In the Profile dropdown, select "Video - H.264 + MP3 (MP4)"
  5. Click the wrench icon to customize settings (codec, bitrate, resolution)
  6. Choose destination file path
  7. 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 ValueQualityFile SizeUse Case
0LosslessHugeMaster archive
18Visually losslessLargeHigh quality
23 (default)GoodMediumGeneral use
28AcceptableSmallWeb, email
32+LowVery smallStreaming at low bitrate

Choose the right preset

Preset controls encoding speed vs compression efficiency:

PresetSpeedCompressionUse Case
ultrafastFastestWorstLive streaming
fastFastPoorQuick tests
medium (default)MediumGoodGeneral use
slowSlowBetterArchival
veryslowSlowestBestFinal 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:

bash
# 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.mp4

To change frame rate:

bash
# 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.mp4

Common Issues

IssueCauseSolution
No audio in MP4Audio codec incompatibleUse -c:a aac
File is hugeCRF too lowUse CRF 23-28
Conversion slowPreset too slowUse -preset medium or fast
MP4 won't play on iPhoneH.265 codec usedUse H.264 (-c:v libx264)
Black framesFrame rate mismatchUse -r 30
Cross-origin playback failsmoov atom at endAdd -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

References

Last updated: