>FFmpegLab Sign In
FFmpeg Guide

The complete FFmpeg formats guide

Containers explained: MP4, MKV, WebM, MOV, AVI, MPEG‑TS, FLV, GIF, and audio-only containers like M4A and FLAC. Learn how to remux without re-encoding, use `faststart` for web streaming, and pick the perfect format for your project.

A container format (or muxer) is the "box" that holds your video, audio, and subtitle streams together. It does not determine quality — the codec does. Choosing the right container is about compatibility, features, and metadata.

Before we dive in, here's the most important command you'll use: remuxing. This changes the container without re‑encoding (instant, lossless).

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mkv -c copy output.mp4

Key takeaways

List & probe available formats

FFmpeg supports dozens of containers. List them all with:

To inspect what's inside a file, use ffprobe:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffprobe -hide_banner video.mp4

Video containers

MP4 (MPEG‑4 Part 14) – the universal standard

MP4 is the most compatible container in the world. It plays everywhere: browsers, phones, TVs, and video platforms. It works best with H.264/H.265 video and AAC audio. For web delivery, always enable faststart to move the metadata ('moov atom') to the front — this allows the video to start playing before it's fully downloaded.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# Standard MP4
ffmpeg -i input.mov -c:v libx264 -crf 23 -c:a aac -b:a 128k output.mp4

# Web‑optimised (faststart)
ffmpeg -i input.mov -c:v libx264 -crf 23 -c:a aac -movflags +faststart output.mp4

# Fragmented MP4 for DASH / HLS
ffmpeg -i input.mov -c copy -movflags +frag_keyframe+empty_moov output.mp4

MP4 variants


MOV – QuickTime (Apple ecosystem)

MOV is Apple's container. It's identical to MP4 under the hood, but it supports more codecs (like ProRes, DNxHD, uncompressed PCM) and is the standard for editing and post‑production. Use MOV when you're working in Final Cut, Premiere, or DaVinci Resolve.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# ProRes in MOV (editing master)
ffmpeg -i input.mp4 -c:v prores -profile:v 3 -c:a pcm_s16le output.mov

Note: MOV files often have large file sizes. They're meant for editing, not distribution.


MKV (Matroska) – the open, flexible powerhouse

MKV is an open‑source container that supports virtually any codec. It handles unlimited video/audio/subtitle tracks, chapters, attachments (fonts), and complex metadata. It's the top choice for archiving, anime, and home media servers (Plex, Jellyfin).

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# Create MKV with multiple audio tracks and subtitles
ffmpeg -i video.mp4 -i audio_eng.flac -i audio_fre.flac -i subs.srt \
  -map 0:v -map 1:a -map 2:a -map 3:s \
  -c:v copy -c:a flac -c:s copy -metadata title="My Movie" output.mkv

MKV options


WebM – royalty‑free web video

WebM is the open, royalty‑free container designed specifically for the web. It only supports VP8/VP9/AV1 video and Vorbis/Opus audio. It's the standard for YouTube, Wikipedia, and modern browsers. Use WebM when you want the best web performance without patent worries.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# VP9 + Opus WebM
ffmpeg -i input.mov -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 96k output.webm

AVI – the legacy veteran

AVI (Audio Video Interleave) was introduced by Microsoft in 1992. It's old, has a 2GB/4GB file size limit (unless using OpenDML), and doesn't support modern features well. That said, it's still used in some legacy systems and industrial equipment. Use it only when you have to.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# AVI with MJPEG video and PCM audio (widely compatible)
ffmpeg -i input.mov -c:v mjpeg -q:v 5 -c:a pcm_s16le output.avi

MPEG‑TS (Transport Stream) – broadcast & streaming

MPEG‑TS (.ts) is the container used for broadcast television, Blu‑ray, and live streaming (RTP, HLS). It's designed to be resilient to packet loss — if a piece of data is corrupted, the stream can recover. Use it for live events, satellite/cable distribution, and when you need to stream to legacy set‑top boxes.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mov -c copy -f mpegts output.ts

FLV – Flash Video (legacy)

FLV was the backbone of web video in the Flash era. It's still used in some legacy streaming servers and devices. Unless you're maintaining a very old system, you can skip FLV in favour of MP4 or WebM.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mp4 -c copy -f flv output.flv

GIF – animated images

GIF is a palette‑based image format that supports animation. FFmpeg can create GIFs, but they are large and limited to 256 colours. For modern web animations, use WebP or MP4. If you must create a GIF, use a high‑quality palette.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# High‑quality GIF with custom palette
ffmpeg -i input.mp4 -vf "fps=10,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif

Audio‑only containers

MP3

The most compatible audio format. Use it for podcasts, music distribution, and legacy devices.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mov -c:a libmp3lame -b:a 192k output.mp3

M4A (AAC / ALAC)

The audio‑only version of MP4. Use AAC for compressed, high‑quality audio, or ALAC for lossless.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# AAC in M4A
ffmpeg -i input.mov -c:a aac -b:a 128k output.m4a

# ALAC lossless in M4A
ffmpeg -i input.mov -c:a alac output.m4a

OGG (Vorbis / Opus)

OGG is the open container for Vorbis and Opus audio. It's free, efficient, and widely used in open‑source projects and games.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mov -c:a libopus -b:a 96k output.ogg

FLAC

Free Lossless Audio Codec. Perfect for archiving music and high‑fidelity audio. File sizes are large but quality is perfect.

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mov -c:a flac -compression_level 8 output.flac

Container comparison table

ContainerExtensionBest video codecsBest audio codecsSubtitle supportBest for
MP4.mp4, .m4v, .m4aH.264, H.265AAC, MP3, ALACLimited (TTXT, VobSub)Universal compatibility, web
MOV.movProRes, DNxHD, H.264PCM, AACLimitedEditing, post‑production
MKV.mkvAny (H.264, H.265, VP9, AV1)Any (AAC, MP3, FLAC, Opus)Excellent (ASS, SRT, PGS)Archiving, media servers, fansubbing
WebM.webmVP8, VP9, AV1Vorbis, OpusNative (WebVTT)Royalty‑free web video
AVI.aviMJPEG, MPEG‑4PCM, MP3PoorLegacy / industrial systems
MPEG‑TS.tsH.264, H.265AAC, MP2LimitedBroadcast, live streaming, HLS
FLV.flvH.264, VP6MP3, AACNoLegacy Flash applications

Container‑specific quirks & best practices

1. The "moov atom" in MP4

The moov atom is the metadata index in an MP4 file. If it's at the end, the player must download the entire file before starting playback. Use -movflags +faststart to move it to the front.

2. Fragmented MP4 for adaptive streaming

For HLS and DASH, you need fragmented MP4 (-movflags +frag_keyframe+empty_moov). This allows the file to be split into small chunks.

3. MKV and audio gap handling

MKV is very tolerant of bad audio sync. Use -async 1 if you encounter sync issues when remuxing.

4. AVI file size limits

Standard AVI has a 2GB limit. Use -fs to set a file size limit, or use the OpenDML extension (-f avi -flags +bitexact).

5. WebM mandates VP9/AV1 and Opus/Vorbis

You cannot put H.264 or AAC into a WebM file. FFmpeg will error if you try. Use VP9/AV1 + Opus for WebM.


How to choose the right container

Want to see how formats interact with codec choices? Check out our Complete Codecs Guide. For practical compression, see the compression guide.

Ready to remux and convert on a visual timeline? FFmpegLab lets you switch containers, apply faststart, and generate the exact command — all offline in your browser.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.

Remux and convert on a real timeline — offline.

Free in your browser — nothing to install, nothing uploaded.