Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Media
  3. Guides
  4. Media types and formats for image, audio, and video content
  5. Media container formats (file types)

Media container formats (file types)

Amedia container is a file format that encapsulates one or more media streams (such as audio or video) along with metadata, enabling them to be stored and played back together.The format of audio and video media files is defined by multiple components, including the audio and/or video codecs used, the media container format (or file type), and optionally other elements such as subtitle codecs or metadata.In this guide, we'll look at the container formats used most commonly on the web, covering basics about their specifications as well as their benefits, limitations, and ideal use cases.

WebRTC does not use a container at all.Instead, it streams the encoded audio and video tracks directly from one peer to another usingMediaStreamTrack objects to represent each track.SeeCodecs used by WebRTC for information about codecs commonly used for making WebRTC calls, as well as browser compatibility information around codec support in WebRTC.

Common container formats

While there are a vast number of media container formats, the ones listed below are the ones you are most likely to encounter.Some support only audio while others support both audio and video.The MIME types and extensions for each are listed. The most commonly used containers for media on the web are probably MPEG-4 Part-14 (MP4) and Web Media File (WEBM). However, you may also encounter Ogg, WAV, AVI, MOV, and other formats.Not all of these are broadly supported by browsers; some combinations of container and codec are sometimes given their own file extensions and MIME types as a matter of convenience, or because of their ubiquity.For example, an Ogg file with only an Opus audio track is sometimes referred to as an Opus file, and might even have the extension.opus.But it's still actually just an Ogg file.

In some cases, a particular codec becomes so ubiquitous that its usage is treated as a unique format. A prime example is the MP3 audio file, which isn't stored in a conventional container. Instead, an MP3 file is essentially a stream of MPEG-1 Audio Layer III-encoded frames, often accompanied by metadata such as ID3 tags. These files use theaudio/mpeg MIME type and the.mp3 extension.

Index of media container formats (file types)

To learn more about a specific container format, find it in this list and click through to the details, which include information about what the container is typically useful for, what codecs it supports, and which browsers support it, among other specifics.

Codec name (short)Full codec nameBrowser compatibility
3GPThird Generation PartnershipFirefox for Android
ADTSAudio Data Transport Stream

Firefox

Available only if available on the underlying operating system's media framework.

FLACFree Lossless Audio CodecAll browsers.
MPEG / MPEG-2Moving Picture Experts Group (1 and 2)
MPEG-4 (MP4)Moving Picture Experts Group 4All browsers.
OggOggAll browsers.
QuickTime (MOV)Apple QuickTime movieOnly older versions of Safari, plus other browsers that supported Apple's QuickTime plugin
WebMWeb MediaAll browsers.

Unless otherwise specified, both mobile and desktop browser compatibility is implied if a browser is listed here.Support is also implied only for the container itself, not for any specific codecs.

3GP

The3GP or3GPP media container is used to encapsulate audio and/or video that is specifically intended for transmission over cellular networks for consumption on mobile devices.The format was designed for use on 3G mobile phones, but can still be used on more modern phones and networks.However, the improved bandwidth availability and increased data caps on most networks has reduced the need for the 3GP format.However, this format is still used for slower networks and for lower-performance phones.

This media container format is derived from the ISO Base Media File Format and MPEG-4, but is specifically streamlined for lower bandwidth scenarios.

AudioVideo
audio/3gppvideo/3gpp
audio/3gpp2video/3gpp2
audio/3gp2video/3gp2

These MIME types are the fundamental types for the 3GP media container; other types may be used depending on the specific codec or codecs in use.In addition, you canadd thecodecs parameter to the MIME type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics.

Video codecs supported by 3GP
Codec Browser support
ChromeEdgeFirefoxSafari
AVC (H.264)
H.263
MPEG-4 Part 2 (MP4v-es)
VP8
Audio codecs supported by 3GP
Codec Browser support
ChromeEdgeFirefoxSafari
AMR-NB
AMR-WB
AMR-WB+
AAC-LC
HE-AAC v1
HE-AAC v2
MP3

ADTS

Audio Data Transport Stream (ADTS) is a container format specified by MPEG-4 Part 3 for audio data, intended to be used for streamed audio, such as for Internet radio.It is, essentially, an almost bare stream of AAC audio data, comprised of ADTS frames with a minimal header.

Audio
audio/aac
audio/mpeg

The MIME type used for ADTS depends on what kind of audio frames are contained within.If ADTS frames are used, theaudio/aac MIME type should be used.If the audio frames are in MPEG-1/MPEG-2 Audio Layer I, II, or III format, the MIME type should beaudio/mpeg.

Audio codecs supported by ADTS
Codec Browser support
ChromeEdgeFirefoxSafari
AACYes
MP3Yes

Firefox support for AAC relies upon the operating system's media infrastructure, so it is available as long as the OS supports it.

FLAC

TheFree Lossless Audio Codec (FLAC) is a lossless audio codec; there is also an associated container format, also called FLAC, that can contain this audio.The format is not encumbered by any patents, so its use is safe from interference.FLAC files can only contain FLAC audio data.

Audio
audio/flac
audio/x-flac (non-standard)
Audio codecs supported by FLAC
Codec Browser support
ChromeEdgeFirefoxSafari
FLACYes

MPEG/MPEG-2

TheMPEG-1 andMPEG-2 file formats are essentially identical.Created by the Moving Picture Experts Group (MPEG), these formats are widely used in physical media, including as the format of the video on DVD media.

On the internet, perhaps the most common application of the MPEG standard is forMPEG-1 Audio Layer III, commonly known as MP3, sound data. These MP3 files are wildly popular with digital music devices around the world, even though MPEG-1 and MPEG-2, as a whole, are not widely used in other web content.

The main differences between MPEG-1 and MPEG-2 take place in the media data formats rather than the container format.MPEG-1 was introduced in 1992; MPEG-2 was introduced in 1996.

AudioVideo
audio/mpegvideo/mpeg
Video codecs supported by MPEG-1 and MPEG-2
Codec Browser support
ChromeEdgeFirefoxSafari
MPEG-1 Part 2No
MPEG-2 Part 2No
Audio codecs supported by MPEG-1 and MPEG-2
Codec Browser support
ChromeEdgeFirefoxSafari
MPEG-1 Audio Layer INo
MPEG-1 Audio Layer IINo
MPEG-1 Audio Layer III (MP3)Yes

MPEG-4 (MP4)

MPEG-4 (MP4) is the latest version of the MPEG file format.There are two versions of the format, defined in parts 1 and 14 of the specification.MP4 is a popular container today, as it supports several of the most-used codecs and is broadly supported.

The original MPEG-4 Part 1 file format was introduced in 1999; the version 2 format, defined in Part 14, was added in 2003.The MP4 file format is derived from theISO base media file format, which is directly derived from theQuickTime file format developed byApple.

When specifying the MPEG-4 media type (audio/mp4 orvideo/mp4), you canadd thecodecs parameter to the MIME type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics.

AudioVideo
audio/mp4video/mp4

These MIME types are the fundamental types for the MPEG-4 media container; other MIME types may be used depending on the specific codec or codecs in use within the container.In addition, you canadd thecodecs parameter to the MIME type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics.

Video codecs supported by MPEG-4
Codec Browser support
ChromeEdgeFirefoxSafari
AVC (H.264)

Yes

Firefox support for H.264 relies upon the operating system's media infrastructure, so it is available as long as the OS supports it.

AV1

Yes

Firefox support for AV1 is disabled on Windows on ARM (enable by setting the preferencemedia.av1.enabled totrue).

H.263No
MPEG-4 Part 2 VisualNo
VP9Yes
Audio codecs supported by MPEG-4
Codec Browser support
ChromeEdgeFirefoxSafari
AAC

Yes

Firefox support for H.264 relies upon the operating system's media infrastructure, so it is available as long as the OS supports it.

FLACYes
MPEG-1 Audio Layer III (MP3)Yes
OpusYes

Ogg

TheOgg container format is a free and open format maintained by theXiph.org Foundation.The Ogg framework also defines patent unencumbered media data formats, such as the Theora video codec and the Vorbis and Opus audio codecs.Xiph.org documents about the Ogg format are available on their website.

While Ogg has been around for a long time, it has never gained the wide support needed to make it a good first choice for a media container.You are typically better off using WebM, though there are times when Ogg is useful to offer, such as when you wish to support older versions of Firefox and Chrome which don't yet support WebM.For example, Firefox 3.5 and 3.6 support Ogg, but not WebM.

You can get more information about Ogg and its codecs in theTheora Cookbook.

AudioVideo
audio/oggvideo/ogg

Theapplication/ogg MIME type can be used when you don't necessarily know whether the media contains audio or video.If at all possible, you should use one of the specific types, but fall back toapplication/ogg if you don't know the content format or formats.

You can alsoadd thecodecs parameter to the MIME type string to indicate which codecs are used for the audio and/or video tracks, and to optionally further describe the track media formats.

Video codecs supported by Ogg
Codec Browser support
ChromeEdgeFirefoxSafari
TheoraYes
VP8Yes
VP9Yes
Audio codecs supported by Ogg
Codec Browser support
ChromeEdgeFirefoxSafari
FLACYes
OpusYesYesYesYes
VorbisYesYes

Warning:Ogg Opus audio files longer than 12h 35m 39s are truncated and exhibit seeking issues when played on Firefox Linux 64 bit (Firefox bug 1810378).

Note:Safari 18.4+ (on macOS 15.4+, iOS 18.4+, iPadOS 18.4+, and visionOS 2.4+) added support for Opus and Vorbis codecs in Ogg containers.

QuickTime

TheQuickTime file format (QTFF,QT, orMOV) was created by Apple for use by its media framework of the same name.The extension for these files,.mov, comes from the fact that the format was initially used for movies and was usually called the "QuickTime movie" format.While QTFF served as the basis for the MPEG-4 file format, there are differences and the two are not quite interchangeable.

QuickTime files support any sort of time-based data, including audio and video media, text tracks, and so forth.QuickTime files are primarily supported by macOS, but for a number of years, QuickTime for Windows was available to access them on Windows.However, QuickTime for Windows is no longer supported by Apple as of early 2016, andshould not be used, as there are known security concerns.However, Windows Media Player now has integrated support for QuickTime version 2.0 and earlier files; support for later versions of QuickTime requires third-party additions.

On Mac OS, the QuickTime framework not only supported QuickTime format movie files and codecs, but supported a vast array of popular and specialty audio and video codecs, as well as still image formats.Through QuickTime, Mac applications (including web browsers, through the QuickTime plugin or direct QuickTime integration) were able to read and write audio formats including AAC, AIFF, MP3, PCM, and Qualcomm PureVoice; and video formats including AVI, DV, Pixlet, ProRes, FLAC, Cinepak, 3GP, H.261 through H.265, MJPEG, MPEG-1 and MPEG-4 Part 2, Sorenson, and many more.

In addition, a number of third-party components are available for QuickTime, some of which add support for additional codecs.

Because QuickTime support is, for all intents and purposes, primarily available on Apple devices, it is no longer widely used on the internet.Apple itself generally now uses MP4 for video.In addition, the QuickTime framework has been deprecated on the Mac for some time, and is no longer available at all starting in macOS 10.15 Catalina.

Video
video/quicktime

Thevideo/quicktime MIME type is the fundamental type for the QuickTime media container.It's worth noting that QuickTime (the media framework on Mac operating systems) supports a wide variety of containers and codecs, so it actually supports many other MIME types.

You canadd thecodecs parameter to the MIME type string to indicate which codecs are used for the audio and/or video tracks, and to optionally provide details about the profile, level, and/or other codec configuration specifics.

Video codecs supported by QuickTime
Codec Browser support
ChromeEdgeFirefoxSafari
AVC (H.264)No
CinepakNo
Component VideoNo
DVNo
H.261No
H.263No
MPEG-2No
MPEG-4 Part 2 VisualNo
Motion JPEGNo
Sorenson Video 2No
Sorenson Video 3No
Audio codecs supported by QuickTime
Codec Browser support
ChromeEdgeFirefoxSafari
AACNo
ALaw 2:1No
Apple Lossless (ALAC)No
HE-AACNo
MPEG-1 Audio Layer III (MP3)No
Microsoft ADPCMNo
µ-Law 2:1 (u-Law)No

WAVE (WAV)

TheWaveform Audio File Format (WAVE), usually referred to as WAV due to its filename extension being.wav, is a format developed by Microsoft and IBM to store audio bitstream data.

It is derived from the Resource Interchange File Format (RIFF), and as such is similar to other formats such as Apple's AIFF.The WAV codec registry can be found atRFC 2361; however, because nearly all WAV files use linear PCM, support for the other codecs is sparse.

The WAVE format was first released in 1991.

Audio
audio/wave
audio/wav
audio/x-wav
audio/x-pn-wav

Theaudio/wave MIME type is the standard type, and is preferred; however, the others have been used by various products over the years and may be used as well in some environments.

Audio codecs supported by WAVE
Codec Browser support
ChromeEdgeFirefoxSafari
ADPCM (Adaptive Differential Pulse Code Modulation)No
GSM 06.10No
LPCM (Linear Pulse Code Modulation)Yes
MPEG-1 Audio Layer III (MP3)No
µ-Law (u-Law)No

WebM

WebM (Web Media) is a format based onMatroska which is designed specifically for use in modern web environments.It's based entirely on free and open technologies and primarily uses codecs that are in turn free and open, although some products support other codecs in WebM containers as well.

WebM was first introduced in 2010 and is now widely supported.Compliant implementations of WebM are required to support the VP8 and VP9 video codecs and the Vorbis and Opus audio codecs.The WebM container format and its required codecs are all available under open licenses.Any other codecs may require a license to use.

AudioVideo
audio/webmvideo/webm
Video codecs supported by WebM
Codec Browser support
ChromeEdgeFirefoxSafari
AV1YesYes

Yes

Firefox support for AV1 was added to macOS in Firefox 66; for Windows in Firefox 67; and Firefox 68 on Linux. Firefox for Android does not yet support AV1; the implementation in Firefox is designed to use a secure process, which is not supported yet in Android.

Yes
VP8YesYesYesYes
VP9YesYesYesYes
Audio codecs supported by WebM
Codec Browser support
ChromeEdgeFirefoxSafari
OpusYesYesYesYes
VorbisYesYesYesYes

Choosing the right container

There are a few factors to consider when selecting the best container or containers to use for your media.The relative importance of each will depend on your needs, your license requirements, and the compatibility requirements of your target audience.

Guidelines

When selecting the appropriate media format, your decision should depend on your intended usage. Playing back media is different from recording or editing it. For manipulation, uncompressed formats can improve performance, while lossless compression prevents the accumulation of noise from repeated recompression.

  • If your target audience is likely to include users on mobile, especially on lower-end devices or on slow networks, consider providing a version of your media in a 3GP container with appropriate compression.
  • If you have any specific encoding requirements, make sure the container you choose supports the appropriate codecs.
  • If you want your media to be in a non-proprietary, open format, consider using one of the open container formats such as FLAC (for audio) or WebM (for video).
  • If for any reason you are only able to provide media in a single format, choose a format that's available on the broadest selection of devices and browsers, such as MP3 (for audio) or MP4 (for video and/or audio).
  • If your media is audio-only, choosing an audio-only format likely makes sense. See below for a comparison of the various audio-only formats.

Container selection advice

The tables below offer suggested containers to use in various scenarios.These are just suggestions.Be sure to consider the needs of your application and your organization before selecting a container format.

Audio-only files

NeedFormatDescription
Compressed files for general-purpose playbackMP3 (MPEG-1 Audio Layer III)Widely compatible and recognized; uses lossy compression to provide a good balance between file size and audio quality.
Lossless compressionFLAC (Free Lossless Audio Codec)Offers lossless compression, ensuring that the original audio remains intact while reducing file size.
ALAC (Apple Lossless Audio Codec)Similar to FLAC but designed for Apple devices; it's a great fallback when working within the Apple ecosystem.
Uncompressed filesWAV (Waveform Audio File Format)Contains uncompressed PCM audio, delivering the highest fidelity at the cost of larger file sizes.
AIFF (Audio Interchange File Format)Comparable to WAV in terms of quality and file size, though it's often favored on Apple platforms.

Now that MP3's patents have all expired, the choice of audio file format has become much easier to make.It's no longer necessary to choose between MP3's broad compatibility and the need to pay royalties when using it.

Unfortunately, neither of the relatively major lossless compression formats (FLAC and ALAC) are universally supported.FLAC is the more broadly supported of the two, but is not supported by macOS without additional software installed, and is not supported at all on iOS.If you need to offer lossless audio, you may need to provide both FLAC and ALAC to get close to universal compatibility.

Video files

NeedFormatDescription
General purpose video (preferably open format)WebM Designed for modern web usage, WebM is an open, royalty-free container that offers efficient compression and native support in most browsers.
General purpose videoMP4 MP4 is the industry standard for video content, widely supported across devices and browsers.
High compression for slow connections3GP Optimized for mobile devices and low-bandwidth environments, 3GP delivers acceptable video quality under constrained conditions.
Compatibility with older devices/browsersQuickTime QuickTime is a legacy container originally popular on Apple platforms. It is still commonly produced by macOS video recording software.

These suggestions make a number of assumptions.You should carefully consider the options before making a final decision, especially if you have a lot of media that will need to be encoded.Very often, you would want to provide multiple fallback options for these formats—for example, MP4 fallback for WebM or 3GP, or AVI for QuickTime.

Maximizing compatibility with multiple containers

To optimize compatibility, it's worth considering providing more than one version of media files, using the<source> element to specify each source within the<audio> or<video> element.For example, you can offer an Ogg or WebM video as the first choice, with a fallback in MP4 format.You could even choose to offer a retro-like QuickTime or AVI fallback for good measure.

To do this, you create a<video> (or<audio>) element with nosrc attribute.Then add child<source> elements within the<video> element, one for each version of the video you offer.This can be used to offer various versions of a video that can be selected depending on bandwidth availability, but in our case, we'll use it to offer format options.

In the example shown here, a video is offered to the browser in two formats: WebM and MP4.

Try it

<video controls width="250" height="200" muted>  <source src="/shared-assets/videos/flower.webm" type="video/webm" />  <source src="/shared-assets/videos/flower.mp4" type="video/mp4" />  Download the  <a href="/shared-assets/videos/flower.webm">WEBM</a>  or  <a href="/shared-assets/videos/flower.mp4">MP4</a>  video.</video>

The video is offered first in WebM format (with thetype attribute set tovideo/webm).If theuser agent can't play that, it moves on to the next option, whosetype is specified asvideo/mp4.If neither of those can be played, the text "This browser does not support the HTML video element." is presented.

Specifications

SpecificationComment
ETSI 3GPPDefines the 3GP container format
ISO/IEC 14496-3 (MPEG-4 Part 3 Audio)Defines MP4 audio including ADTS
FLAC FormatThe FLAC format specification
ISO/IEC 11172-1 (MPEG-1 Part 1 Systems)Defines the MPEG-1 container format
ISO/IEC 13818-1 (MPEG-2 Part 1 Systems)Defines the MPEG-2 container format
ISO/IEC 14496-14 (MPEG-4 Part 14: MP4 file format)Defines the MPEG-4 (MP4) version 2 container format
ISO/IEC 14496-1 (MPEG-4 Part 1 Systems)Defines the original MPEG-4 (MP4) container format
RFC 3533Defines the Ogg container format
RFC 5334Defines the Ogg media types and file extensions
QuickTime File Format SpecificationDefines the QuickTime movie (MOV) format
Multimedia Programming Interface and Data Specifications 1.0The closest thing to an official WAVE specification
Resource Interchange File Format (used by WAV)Defines the RIFF format; WAVE files are a form of RIFF
WebM Container GuidelinesGuide for adapting Matroska for WebM
Matroska SpecificationsThe specification for the Matroska container format upon which WebM is based
WebM Byte Stream FormatWebM byte stream format for use withMedia Source Extensions

Browser compatibility

Container format name AudioVideo
MIME typeExtension(s) Browser supportMIME typeExtension(s) Browser support
3GPaudio/3gpp.3gp Firefoxvideo/3gpp.3gpFirefox
ADTS (Audio Data Transport Stream)audio/aac.aac Firefox
FLACaudio/flac.flac Firefox
MPEG-1 / MPEG-2 (MPG or MPEG)audio/mpeg.mpg
.mpeg
Firefoxvideo/mpeg.mpg
.mpeg
Firefox
audio/mp3.mp3 Firefox
MPEG-4 (MP4)audio/mp4.mp4
.m4a
Firefoxvideo/mp4.mp4
.m4v
.m4p
Firefox
Oggaudio/ogg.oga
.ogg
Firefox, Safarivideo/ogg.ogv
.ogg
Firefox
QuickTime Movie (MOV)video/quicktime.movSafari
WAV (Waveform Audio File)audio/wav.wav Firefox
WebMaudio/webm.webm Firefoxvideo/webm.webmFirefox

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp