Introduction to Media Containers

A media file (.mp3, .mp4, .mkv, .webm, .ogg, .opus, .avi) is a container for media.

An .mp3 file has the audio stream and optionally descriptive metadata.

An .mp4 file can hold any number of

  • audio stream
  • video stream
  • subtitles
  • metadata

A Matroska .mkv file can hold any number of

  • audio stream
  • video stream
  • subtitles
  • chapters (referencing sections within the file or in other files)
  • metadata

You can inspect a file with ffmpeg -hide_banner -i <file>. (Or ffprobe -hide_banner <file>.)