The difference between video and audio codecs and formats

Codecs handle the compression and decompression of video data, aiming to maintain visual quality while reducing file sizes which can be lossless or lossy.

Examples of video codecs: H.264, H.265, VP9, and AV1.

Examples of audio codecs: MP3, AAC, and FLAC.

Format or container File format (or extension) that packages video streams, audio streams, and metadata together, allowing for playback on various devices and platforms, those metadata include resolution, bitrate, date of creation and modification, subtitles, and more. Audio file formats are usually the same as their codecs.

Examples of video formats: MP4, MKV, AVI, WebM, and MOV.

Examples of audio formats: MP3, AAC, MKA, and FLAC.