From 218934fa2ed1c702a6d3923d2aa2cc6b43c48684 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:43:23 -0500 Subject: initial commit --- .../zh-tw/web/media/formats/containers/index.html | 1325 ++++++++++++++++++++ files/zh-tw/web/media/formats/index.html | 88 ++ files/zh-tw/web/media/index.html | 64 + 3 files changed, 1477 insertions(+) create mode 100644 files/zh-tw/web/media/formats/containers/index.html create mode 100644 files/zh-tw/web/media/formats/index.html create mode 100644 files/zh-tw/web/media/index.html (limited to 'files/zh-tw/web/media') diff --git a/files/zh-tw/web/media/formats/containers/index.html b/files/zh-tw/web/media/formats/containers/index.html new file mode 100644 index 0000000000..f77ec0ab42 --- /dev/null +++ b/files/zh-tw/web/media/formats/containers/index.html @@ -0,0 +1,1325 @@ +--- +title: Media container formats (file types) +slug: Web/Media/Formats/Containers +translation_of: Web/Media/Formats/Containers +--- +
{{QuickLinksWithSubpages("/en-US/docs/Web/Media")}}
+ +

視訊與音訊的檔案格式被定義成兩個部分(當然如果一個檔案同時擁有影、音的話,那就有三個):一個是音訊或/和視訊的編解碼器(codecs,由 compress 和 decompress 所組成的詞語),另一個是媒體封裝的格式(media container format,即檔案類型)。在本次導覽中,我們將會看到網路上最常見的封裝格式,並介紹它們的基本規格、優點、限制,以及理想的使用情形。

+ +

網頁即時通訊(WebRTC)並不採用容器(container),而是以 {{domxref("MediaStreamTrack")}} 物件來表示編碼過的影軌和音軌(一個物件表示一種媒體軌),直接從一端串流到另一端。你可以參閱 WebRTC 使用的編解碼器來了解進行 WebRTC 時常用的編解碼器,以及瀏覽器對它們的相容性。

+ +

常見的封裝格式

+ +

世上的媒體封裝格式多如牛毛,所以我們在這裡僅列出你最有機會遇到的幾種,其中有的只支援音訊,有的影音都支援。我們也會列出它們各自的媒體類型(MIME type)和副檔名(extension)。網路上最常見的封裝容器有 MPEG-4 (MP4)、QuickTime Movie (MOV),以及 Wavefile Audio File Format (WAV)。當然你也可能會遇到如 MP3、Ogg、WebM、AVI 等其他格式,但不是所有瀏覽器都支援它們就是了。為了方便起見,同時也是因為它們實在太常見了,有些封裝容器與編解碼器的組合會有專屬它們的副檔名跟媒體類型。好比說,只有一個 Opus 音軌的 Ogg 檔通常會被稱為 Opus 檔,它有自己的副檔名 .opus,但它其實還是一個 Ogg 檔。

+ +

由於特定的編解碼器通常會放在特定的封裝容器裡,所以這樣的組合會被特別看待,比方說 MP3 音訊檔就是一個很好的例子,它是由 MPEG-1 封裝容器與一個以 MPEG-1 Audio Layer III encoding 編碼過的音軌所組成,這種檔案使用 audio/mp3 作為媒體類型;.mp3 作為副檔名,即便它的封裝容器不過就是 MPEG 罷了。

+ +

索引

+ +

點擊列表中你想知道的封裝格式,即會將你傳送到該項目的細節內容,其中包含它的用途、它支援的編解碼器、支援它的瀏覽器等等。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
編解碼器名(縮寫)完整編解碼器名瀏覽器相容性1
{{anch("3GP")}}Third Generation PartnershipFirefox for Android
{{anch("ADTS")}}Audio Data Transport StreamFirefox2
{{anch("FLAC")}}Free Lossless Audio CodecChrome 56, Edge 16, Firefox 51, Safari 11
{{anch("MPEG", "MPEG / MPEG-2")}}Moving Picture Experts Group (1 and 2)
{{anch("MP4", "MPEG-4 (MP4)")}}Moving Picture Experts Group 4Chrome 3, Edge 12, Firefox, Internet Explorer 9, Opera 24, Safari 3.1
{{anch("Ogg")}}OggChrome 3, Firefox 3.5, Edge 173 (desktop only), Internet Explorer 9, Opera 10.50
{{anch("QuickTime", "QuickTime (MOV)")}}Apple QuickTime movie只有舊版的 Safari 和其他支援 Apple 的 QuickTime plugin 的瀏覽器
{{anch("WebM")}}Web MediaChrome 6, Edge 173 (desktop only), Firefox 4, Opera 10.6, Safari (WebRTC only)
+ +

[1] 除非特別說明,否則表中提及的瀏覽器包含其行動版與桌面版。此外「支援」指的是針對封裝容器本身,而非特定的編解碼器。

+ +

[2] 只在作業系統底層的媒體框架(media framework)有支援時才有。

+ +

[3] 需要安裝網路媒體延伸模組

+ +

3GP

+ +

3GP3GPP 是用來封裝音訊和/或視訊的媒體容器,它服務的對象是透過行動網路(cellular network)進行傳輸的行動裝置。雖然這個格式是為了 3G 行動電話設計的,但現代的手機與網路還是可以使用它。話雖如此,由於現今的網路有更大的頻寬和更為寬鬆的公平使用原則(data caps),所以現在 3GP 格式也不是那麼需要了,只有較慢的網路和較差的手機才會使用這種格式。

+ +

這個媒體封裝格式衍生自 ISO Base Media File Format 和 MPEG-4,特別針對低頻寬的情形做了最佳化。

+ + + + + + + + + + + + + + + + + + + + + + + +
基本的 3GP 媒體型態
音訊視訊
audio/3gppvideo/3gpp
audio/3gpp2video/3gpp2
audio/3gp2video/3gp2
+ +

上表是基本的 3GP 媒體型態,依照使用的編解碼器的不同,可能還會有其他型態。此外,你可以在媒體型態字串中添加 codecs 參數來指明你的音軌和/或影軌所採用的編解碼器,也可以提供 組態(profile)、層級(level)等其他編解碼器的配置細節。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
3GP 支援的視訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
AVC (H.264)Yes1,2
H.263Yes1
MPEG-4 Part 2 (MP4v-es)Yes1
VP8Yes1
+ +

[1] Firefox 只在基於 OpenMAX 的裝置上支援 3GP,以目前的情況來看就是 Boot to Gecko (B2G) 平台.

+ +

[2] Firefox 支援 H.264 與否取決於作業系統的媒體建設如何,也就是說得要系統支援才行。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
3GP 支援的音訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
AMR-NBYes1
AMR-WBYes1
AMR-WB+Yes1
AAC-LCYes1,2
HE-AAC v1Yes1,2
HE-AAC v2Yes1,2
MP3Yes1
+ +

[1] Firefox 只在基於 OpenMAX 的裝置上支援 3GP,以目前的情況來看就是 Boot to Gecko (B2G) 平台.

+ +

[2] Firefox 支援 AAC 與否取決於作業系統的媒體建設如何,也就是說得要系統支援才行。

+ +

ADTS

+ +

Audio Data Transport Stream (ADTS) 是 MPEG-4 Part 3 為音訊資料所訂定的封裝格式,著眼於音訊串流,如網路電台。它基本上是一個空的 AAC 音訊資料串流,由 ADTS 幀(frame)和一個很小的 header 組成。

+ + + + + + + + + + + + + + + + +
ADTS 媒體型態
音訊
audio/aac[1]
audio/mpeg[1]
+ +

[1] ADTS 使用哪個媒體型態依它使用的音訊幀(audio frame)而定。如果它使用 ADTS 幀,其媒體型態為 audio/aac;如果它使用 MPEG-1/MPEG-2 Audio Layer I, II, or III 格式的音訊幀,它的媒體型態為 audio/mpeg

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ADTS 支援的音訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
AACYes1
MP3Yes
+ +

[1] Firefox 支援 AAC 與否取決於作業系統的媒體建設如何,也就是說得要系統支援才行。

+ +

FLAC

+ +

Free Lossless Audio Codec (FLAC) 是一個無損的音訊編解碼器,它有一個相關的精簡音訊封裝格式,也叫做 FLAC,這個格式不受任何專利約束,因此你可以安心地使用它。FLAC 檔只能用來封裝 FLAC 音訊資料。

+ + + + + + + + + + + + + + + + +
FLAC 媒體型態
音訊
audio/flac
audio/x-flac (非標準)
+ + + + + + + + + + + + + + + + + + + + + + + + +
FLAC 支援的音訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
FLACYes
+ +

MPEG/MPEG-2

+ +

{{interwiki("wikipedia", "MPEG-1")}}{{interwiki("wikipedia", "MPEG-2")}} 基本上是相同的。這兩個格式由 Moving Picture Experts Group (MPEG) 創造,廣泛用於實體媒體上,如 DVD 媒體所用的視訊格式。

+ +

在網路上最常用來封裝音訊資料的 MPEG 檔案格式可能是 {{interwiki("wikipedia", "MPEG-1", "Layer_III/MP3", "MPEG-1 Audio Layer 3")}}。也正是因為 MP3 檔被世界各地的數位音樂裝置使用,MPEG-1 和 MPEG-2 才能如此廣泛地應用於網路內容中。

+ +

MPEG-1 和 MPEG-2 最主要的差別在於媒體資料格式而非封裝格式。MPEG-1 首見於西元 1992 年;而 MPEG-2 則出現在西元 1996 年。

+ + + + + + + + + + + + + + + +
MPEG-1 與 MPEG-2 的媒體型態
音訊視訊
audio/mpegvideo/mpeg
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MPEG-1 與 MPEG-2 支援的視訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
MPEG-1 Part 2No
MPEG-2 Part 2No
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MPEG-1 與 MPEG-2 支援的音訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
MPEG-1 Audio Layer INo
MPEG-1 Audio Layer IINo
MPEG-1 Audio Layer III (MP3)Yes
+ +

MPEG-4 (MP4)

+ +

{{interwiki("wikipedia", "MPEG-4")}} (MP4) 是最新版 MPEG 檔案格式。這個格式有兩種版本,分別定義於規範中的 part 1 和 part 14。MP4 是現今流行的封裝容器,它支援了大部份常用的編解碼器,同時它也廣泛地被支援。

+ +

初版的 MPEG-4 Part 1 檔案格式首見於西元1999 年;第二版定義於 Part 14 在西元 2003 年時加入。MP4 檔案格式衍生於 {{interwiki("wikipedia", "ISO base media file format")}},而該格式則是衍生於 Apple 開發的 {{interwiki("wikipedia", "QuickTime file format")}}。

+ + + + + + + + + + + + + + + +
基本的 MPEG-4 媒體型態
音訊視訊
audio/mp4video/mp4
+ +

上表是基本的 MPEG-4 媒體型態,依照使用的編解碼器的不同,可能還會有其他型態。此外,當指出 MPEG-4 媒體型態時 (audio/mp4video/mp4),你可以在媒體型態字串中加上 codecs 參數來指明你的音軌和/或影軌所採用的編解碼器,也可以提供組態(profile)、層級(level)等其他編解碼器的配置細節。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 MPEG-4 支援的視訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
AVC (H.264)Yes1
AV1Yes1
H.263No
MPEG-4 Part 2 VisualNo
VP9Yes
+ +

[1] Firefox 支援 H.264 與否取決於作業系統的媒體建設如何,也就是說得要系統支援才行。

+ +

[2] Firefox 目前對 AV1 的支援預設是關閉的,它可以透過在偏好設定中將 media.av1.enabled 設定為 true 來開啟。

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MPEG-4 支援的音訊編解碼器
編解碼器支援的瀏覽器
ChromeEdgeFirefoxSafari
AACYes1
FLACYes
MPEG-1 Audio Layer III (MP3)Yes
OpusYes
+ +

[1] Firefox 支援 H.264 與否取決於作業系統的媒體建設如何,也就是說得要系統支援才行。

+ +

Ogg

+ +

The {{interwiki("wikipedia", "Ogg")}} container format is a free and open format maintained by the Xiph.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 web site.

+ +

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 the Theora Cookbook.

+ + + + + + + + + + + + + + + +
Base Ogg media MIME types
AudioVideo
audio/oggvideo/ogg
+ +

The application/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 to application/ogg if you don't know the content format or formats.

+ +

You can also add the codecs 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
CodecBrowser support
ChromeEdgeFirefoxSafari
TheoraYes
VP8Yes
VP9Yes
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Audio codecs supported by Ogg
CodecBrowser support
ChromeEdgeFirefoxSafari
FLACYes
OpusYes
VorbisYes
+ +

QuickTime

+ +

The QuickTime file format (QTFF, QT, or MOV) 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, and should 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.

+ + + + + + + + + + + + + +
Base QuickTime media MIME type
Video
video/quicktime
+ +

The video/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 can add the codecs 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
CodecBrowser 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
CodecBrowser 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)

+ +

The Waveform Audio File Format (WAVE), usually referred to simply 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 at {{RFC(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.

+ + + + + + + + + + + + + + + + + + + + + + +
WAVE media MIME types
Audio
audio/wave1
audio/wav
audio/x-wav
audio/x-pn-wav
+ +

[1] The audio/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
CodecBrowser 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

+ +

{{interwiki("wikipedia", "WebM")}} (Web Media) is a format based on {{interwiki("wikipedia", "Matroska")}} 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 VP8 video codecs and the Theora 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.

+ + + + + + + + + + + + + + + +
WebM media MIME types
AudioVideo
audio/webmvideo/webm
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Video codecs supported by WebM
CodecBrowser support
ChromeEdgeFirefoxSafari
AV1YesYesYes1Yes
VP8YesYesYesYes
VP9YesYesYesYes
+ +

[1] 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.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Audio codecs supported by WebM
CodecBrowser 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

+ +

The best choice also depends on what you'll be doing with the media. Playing back media is a different thing than recording and/or editing it. If you're going to be manipulating the media data, using an uncompressed format can improve performance, while using a lossless compressed format at least prevent the accumulation of noise as compression artifacts are multiplied with each re-compression that occurs.

+ + + +

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.

+ +

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

+ + + + + + + + + + + + + + + + + + + + + + +
If you need...Consider using this container format
Compressed files for general-purpose playbackMP3 (MPEG-1 Audio Layer III)
Losslessly compressed filesFLAC with ALAC fallback
Uncompressed filesWAV
+ +

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.

+ +

Video files

+ + + + + + + + + + + + + + + + + + + + + + + + +
If you need...Consider using this container format
General purpose video, preferably in an open formatWebM (ideally with MP4 fallback)
General purpose videoMP4 (ideally with WebM or Ogg fallback)
High compression optimized for slow connections3GP (ideally with MP4 fallback)
Compatibility with older devices/browsersQuickTime (ideally with AVI and/or MPEG-2 fallback)
+ +

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.

+ +

Maximizing compatibility with multiple containers

+ +

To optimize compatibility, it's worth considering providing more than one version of media files, using the {{HTMLElement("source")}} element to specify each source within the {{HTMLElement("audio")}} or {{HTMLElement("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 no {{htmlattrxref("src", "video")}} attribute. Then add child {{HTMLElement("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.

+ +
{{EmbedInteractiveExample("pages/tabbed/source.html", "tabbed-standard")}}
+ + + +

The video is offered first in WebM format (with the {{htmlattrxref("type", "video")}} attribute set to video/webm). If the {{Glossary("user agent")}} can't play that, it moves on to the next option, whose type is specified as video/mp4. If neither of those can be played, the text "This browser does not support the HTML5 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(3533)}}Defines the Ogg container format
{{RFC(5334)}}Defines 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 with Media Source Extensions
+ +

Browser compatibility

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Container format nameAudioVideo
MIME typeExtension(s)Browser supportMIME typeExtension(s)Browser support
3GPaudio/3gpp.3gpFirefoxvideo/3gpp.3gpFirefox
ADTS (Audio Data Transport Stream)audio/aac.aacFirefox
FLACaudio/flac.flacFirefox
MPEG-1 / MPEG-2 (MPG or MPEG)audio/mpeg.mpg
+ .mpeg
Firefoxvideo/mpeg.mpg
+ .mpeg
Firefox
audio/mp3.mp3Firefox
MPEG-4 (MP4)audio/mp4.mp4
+ .m4a
Firefoxvideo/mp4.mp4
+ .m4v
+ .m4p
Firefox
Oggaudio/ogg.oga
+ .ogg
Firefoxvideo/ogg.ogv
+ .ogg
Firefox
QuickTime Movie (MOV)video/quicktime.movSafari
WAV (Waveform Audiofile)audio/wav.wavFirefox
WebMaudio/webm.webmFirefoxvideo/webm.webmFirefox
+ +

 See also

+ + diff --git a/files/zh-tw/web/media/formats/index.html b/files/zh-tw/web/media/formats/index.html new file mode 100644 index 0000000000..9d4f181ae7 --- /dev/null +++ b/files/zh-tw/web/media/formats/index.html @@ -0,0 +1,88 @@ +--- +title: 'Media type and format guide: image, audio, and video content' +slug: Web/Media/Formats +tags: + - API + - Audio + - Codecs + - Containers + - File Types + - Files + - Filetypes + - Landing + - Media + - NeedsTranslation + - TopicStub + - Types + - Video + - Web + - formats +translation_of: Web/Media/Formats +--- +

{{QuickLinksWithSubpages("/en-US/docs/Web/Media")}}

+ +

Since nearly its beginning, the web has included support for some form of visual media presentation. Originally, these capabilities were limited, and were expanded organically, with different browsers finding their own solutions to the problems around including still and video imagery on the web. The modern web has powerful features to support the presentation and manipulation of media, with several media-related APIs supporting various types of content. Generally, the media formats supported by a browser are entirely up to the browser's creators, which can complicate the work of a web developer.

+ +

This guide provides an overview of the media file types, {{Glossary("codec", "codecs")}}, and algorithms that may comprise media used on the web. It also provides browser support information for various combinations of these, and suggestions for prioritization of formats, as well as which formats excel at specific types of content.

+ +
+
+

References

+ +

Images

+ +
+
 Image file type and format guide
+
Covers support of image file types and content formats across the major web browsers, as well as providing basic information about each type: benefits, limitations, and use cases of interest to web designers and developers.
+
Image file types for web designers
+
Fundamental information about the various image file types that may be useful for web designers, including best practices and use cases for each type, and guidelines for choosing the right image file format for specific types of content.
+
+ +

Media file types and codecs

+ +
+
Media containers (file types)
+
A guide to the file types that contain media data. Some are audio-specific, while others may be used for either audio or combined audiovisual content such as movies. Includes overviews of each of the file types supported by the major web browsers, along with browser support information and supported features.
+
+ +
+
Web audio codec guide
+
A guide to the audio codecs allowed for by the common media containers, as well as by the major browsers. Includes benefits, limitations, key specifications and capabilities, and use cases. It also covers each browser's support for using the codec in given containers.
+
Web video codec guide
+
This article provides basic information about the video codecs supported by the major browsers, as well as some that are not commonly supported but that you might still run into. It also covers codec capabilities, benefits, limitations, and browser support levels and restrictions.
+
The "codecs" parameter in common media types
+
When specifying the MIME type describing a media format, you can provide details using the codecs parameter as part of the type string. This guide describes the format and possible values of the codecs parameter for the common media types.
+
Codecs used by WebRTC
+
WebRTC doesn't use a container, but instead streams the encoded media itself from peer to peer using {{domxref("MediaStreamTrack")}} objects to represent each audio or video track. This guide discusses the codecs commonly used with WebRTC.
+
+
+ +
+

Guides

+ +

Concepts

+ +
+
Digital audio concepts
+
An introduction to how audio is converted into digital form and stored for use by computers. It explains basic concepts about how audio is sampled, as well as concepts such as sample rate, audio frames, and audio compression.
+
Digital video concepts
+
A guide to fundamental concepts involved with digital video as used on the web, including basics about color formats, chroma subsampling, how human perception influences video coding, and so forth.
+
+ +

Tutorials and how-tos

+ +
+
Learning: Video and audio content
+
This tutorial introduces and details the use of media on the web.
+
Handling media support issues in web content
+
In this guide, we look at how to build web content that maximizes quality or performance while providing the broadest possible compatibility, by choosing media formats wisely, and offering fallbacks and alternate formats where it would be helpful.
+
+ +

Other topics

+ +
+
Media Capabilities API
+
The Media Capabilities API lets you discover the encoding and decoding capabilities of the device your app or site is running on. This lets you make real-time decisions about what formats to use and when.
+
+
+
diff --git a/files/zh-tw/web/media/index.html b/files/zh-tw/web/media/index.html new file mode 100644 index 0000000000..1dd29d413f --- /dev/null +++ b/files/zh-tw/web/media/index.html @@ -0,0 +1,64 @@ +--- +title: Web media technologies +slug: Web/Media +tags: + - 媒體技術 + - 網頁 + - 視訊 + - 音效 +translation_of: Web/Media +--- +
{{draft}}
+ +

這些年來,網頁來表達,創作及運用視訊及音訊以至其他媒介的能力不斷上升。今時今日存在了 大量可供運用的API及HTML元件,DOM介面,及其他不止於 發揮傳統效果,還能與其他網頁層面的技術產生協同效應和真實地令人深刻銘記 的特效。本文列出不同的APIs和連結其詳細資料的超連結,希望你能認為這些資訊能幫你盡快純熟這些技術。

+ +
+
+

References

+ +

HTML

+ +

這些文章包括HTML特效,供HTML媒體開發者參考。

+ +
+
{{HTMLElement("audio")}}
+
<audio> 元件,這是用來在網頁裡播放音效。此元件能 不被看見地運用來 作為一個 供更多其他繁雜的媒介放置的 位置。當然,也能放置一些可看見的控制器予用家來控制是否重播這些音訊。
+
{{HTMLElement("video")}}
+
<video> 元件,這是一個為了視訊內容在網頁裡播放的端點(endpoint).它能被簡單地只用作表現視訊,或者用作一個位置來放置即時視訊內容(streamed video).<video>也能被用作一個途徑來連結媒介APIs和其他HTML及DOM技術,當中包括 {{HTMLElement("canvas")}} (這是作 frame grabbing(?) 和其管控).
+
+ +

APIs

+ +
+
Media Capture and Streams API
+
這是一個參考資料,關於串流,記錄,管控媒體資料,無論是本地的,透過網路的。這些包括本地的攝錄機及來捕流視訊,音效或圖像的麥克風。
+
Web Audio API
+
你可以藉由此API產出、篩選及操作即時的聲音或是預先錄製好的材料,然後將音效送至<audio>元件、影音串流或是儲存起來。
+
WebRTC
+
WebRTC (網頁即時通訊)能夠即時地串流影音,也能夠透過網際網路將兩個人的訊息資料互相傳遞,而不需要任何媒介。
+
+
+ +
+

指南

+ +
+
網頁傳播媒體的概述
+
支援影音撥放,操作與紀錄的網頁科技與API的概論。如果你不知道該使用哪一個API,請從這裡開始。
+
+ +
+
+ +

Other topics

+ +

Related topics which may be of interest, since they can be used in tandem with media APIs in interesting ways.

+ +
+
The Canvas API
+
The Canvas API lets you draw into an {{HTMLElement("canvas")}}, manipulating and changing the contents of an image. This can be used with media in many ways, including by setting a <canvas> element as the destination for video playback or camera capture so that you can capture and manipulate video frames.
+
WebGL
+
WebGL provides an OpenGL ES compatible API on top of the existing Canvas API, making it possible to do powerful 3D graphics on the Web. Through a canvas, this can be used to add 3D imagery to media content.
+
+
+
-- cgit v1.2.3-54-g00ecf