fileformer
search⌘KtranslateENexpand_moreupload_fileConvert
Converters8 file families · 44 direct conversions
What changes in a conversionarrow_forward

What is Codec?

What is a codec?

A codec is a matched pair of programs. The coder turns pictures or sound into a compact bitstream, and the decoder turns that bitstream back into pictures or sound. A codec is a method, not a file type. The file type (MP4, WebM, MKV) is the container that holds the bitstream.

This page doesn't just describe codecs. It runs your browser's own encoders on a clip it generates, measures every frame they write, opens up the 8×8 block maths that JPEG and most video codecs share, and asks your device which codec and container combinations it can actually play.

this device, asked just now
…codecs a video or audio element says it can play
…decodable through WebCodecs
…encodable through WebCodecs
Asking the browser…See the full tablearrow_downward
01 · store the change, not the frame

90 frames through a real encoder

The page draws a 3-second, 320×180 clip at 30 fps and gives it to your browser's video encoder (WebCodecs). Each bar is one frame the encoder actually wrote: tall purple bars are key frames, which contain the whole picture; short lilac bars are delta frames, which only describe what changed. Every frame is then decoded again and compared with the original.

checking encoders…
scene
Still + clockSlow panAction + grainScene cut
codec
H.264VP8VP9AV1
key frame requested
Every frameEvery 30Only first
target bitrate
150k500k2M
bytes per frame (tallest = …)click a bar to inspect that frame
key framedelta framequality (PSNR, 20-50 dB)frame 0 → 89
Frame 45 · …
drawn (what went in)
decoded (what came out)
To show this frame, a player that jumps here must first decode the key frame at 30 and then 15 delta frames in order. That is 27.5 KB of data for one picture.
…
…
…
…
…
…
…
…
insightschecking encoders…
content_cutTry: Scene cut, key frame only at the startWatch frame 45. The encoder has to describe a completely new picture as "changes", so it either spends a key frame’s worth of bytes there or lets quality collapse.
burst_modeTry: Every frameThe clip becomes a string of JPEG-like stills, several times bigger for the same quality. Editing formats (ProRes, DNxHR, MJPEG) work this way so that any frame can be cut on its own.
fast_forwardWhy seeking jumpsA player can only start decoding at a key frame. Streaming encoders space them 2-10 s apart, so a seek lands on the nearest one and then decodes forward to the frame you asked for.
02 · where the loss happens

One 8×8 block, transformed and quantised

JPEG, MPEG-2, H.264, HEVC, VP9 and AV1 all do the same core step. They turn a block of pixels into frequencies (a discrete cosine transform), divide each frequency by a step size, and round. Rounding is the only lossy part. Large step sizes for high frequencies erase fine texture; the encoder then stores the few numbers that aren't zero. This lab runs the real JPEG maths (ITU-T T.81 Annex K luminance table, IJG quality scaling) on a 64×64 patch. Click a block to open it.

original64 × 64 px
JPEG quality50
step sizes = 100% of the Annex K table
Click either picture to choose the 8×8 block opened below.
after quantisingdecoded
south_eastZig-zag, then entropy codingThe coefficients are read in zig-zag order from the top-left (average brightness) to the bottom-right (finest detail). An entropy coder writes the non-zero values and the runs of zeros between them: Huffman codes in JPEG, adaptive arithmetic coding in H.264 CABAC, HEVC, VP9 and AV1.
compareVideo predicts firstVideo codecs add a step before the transform: they predict each block from pixels already decoded, in the same frame or a previous one, and transform only the difference. A good prediction leaves almost nothing to code, which is why the delta frames in section 01 are so small.
03 · codec vs container

Same box, different answer

A container decides how tracks are packed, timed and labelled. The codec decides how the pictures and sound inside are compressed. Each container specification lists which codecs it may carry, and each device decides which of those it can decode. This table puts both questions to your browser at once: grey cells are combinations the container's spec doesn't allow, the rest are your browser's real answers.

probablythe browser expects it to playmaybecan't tell without tryingnowon't play here
codec · stringMP4WebMOggWebCodecs decodeWebCodecs encode
H.264 / AVCavc1.42001f……………
H.265 / HEVChvc1.1.6.L93.B0……………
VP8vp8……………
VP9vp09.00.10.08……………
AV1av01.0.04M.08……………
Theoratheora……………
AAC-LCmp4a.40.2……………
MP3mp4a.6B · mp3……………
Opusopus……………
Vorbisvorbis……………
FLACflac……………
help"This MP4 won’t play"The MP4 part is rarely the problem. Usually the video inside is HEVC on a device with no HEVC decoder, or the audio uses a codec the player lacks. The video tools hub opens your file and lists exactly which codecs are inside.
boltRemux: seconds, losslessMoving the same streams into another container rewrites only the packaging. It is fast and loses nothing, but it only works if the destination container allows those codecs. The grey cells above are where it can’t.
hourglass_topRe-encode: slow, lossyDecoding and compressing again with a different codec works for any combination. It takes real processing time and always costs a little quality, so keep the original as your master.
04 · reference

The codecs you'll meet, and where they came from

codecyearstandardID in a filewhere you meet itlicensing
JPEG1992ITU-T T.81 · ISO/IEC 10918-1FF D8 FFPhotos everywhere; Motion JPEG in webcamsBaseline free
MP31993ISO/IEC 11172-3 (MPEG-1 Layer III)FF FB · mp4a.6BMusic libraries, podcastsPatents expired 2017
AAC1997ISO/IEC 13818-7, 14496-3mp4a.40.2Apple, YouTube, broadcastPatent pool (Via LA)
H.264 / AVC2003ITU-T H.264 · ISO/IEC 14496-10avc1 · avc3Almost all video; Blu-ray, video callsPatent pool; free for free web video
FLAC2001RFC 9639 (2024)fLaCLossless music archivesRoyalty-free
VP82010RFC 6386vp8 · V_VP8WebRTC baseline, WebP lossyRoyalty-free
Opus2012RFC 6716Opus · OpusHeadVideo calls, WebRTC, YouTube audioRoyalty-free
H.265 / HEVC2013ITU-T H.265 · ISO/IEC 23008-2hvc1 · hev1iPhone video, 4K TV, HEIC photosSeveral competing pools
VP92013Google bitstream specvp09 · V_VP9YouTube, Netflix on many devicesRoyalty-free
AV12018AOMedia AV1 spec 1.0av01 · V_AV1YouTube, Netflix, AVIF photosRoyalty-free (AOM licence)
H.266 / VVC2020ITU-T H.266 · ISO/IEC 23090-3vvc1 · vvi1Broadcast trials; little playback yetPatent pools
ProRes2007Apple; SMPTE RDD 36 (2015)apch · apcn · ap4hEditing and delivery mastersApple licence for encoders
timeline
1988H.261 (ITU-T): the first practical block-DCT video codec, for video calls over ISDN.
1992JPEG standard (T.81) published, built on the same 8×8 DCT used in section 02.
1993MPEG-1 published, including Layer III audio, later known as MP3.
1995MPEG-2 / H.262 published; it went on to carry DVD and digital TV.
1997AAC published as part of MPEG-2.
2003H.264 / AVC approved (May). It is still the codec almost every device can decode.
2010Google open-sources VP8 (May) and launches WebM.
2012Opus published as RFC 6716 (Sep).
2013HEVC approved (April) and VP9 finalised (June).
2018AV1 1.0 released by the Alliance for Open Media (March).
2020H.266 / VVC approved (July).
2021WebCodecs ships in Chrome 94 (Sep), giving web pages direct access to the encoders used above.
put it to workarrow_backAll concepts

Frequently Asked Questions

What is the difference between a codec and a format?

A format (like MP4) is the container that holds the data. A codec (like H.264) is how the video/audio data inside is compressed.

What codec does YouTube use?

YouTube primarily uses H.264 for HD video and is transitioning to AV1 for better compression. Audio is usually AAC.

How do I know what codec my video uses?

Use VLC media player: right-click the playing video > Tools > Media Information > Codec tab.

Can I play a video without the right codec?

Without the correct codec, your device cannot decode the video and it will not play. VLC media player includes most codecs built-in.

What is the best video codec?

H.264 for compatibility. H.265 for efficiency on modern devices. AV1 for the best compression on web platforms.