影音格式中Codec,container format的差別

回覆文章
tony
文章: 585
註冊時間: 2012-02-26, 07:04
聯繫:

影音格式中Codec,container format的差別

未閱讀文章 tony »

上次概略介紹了影音編碼(請參照影音編碼概說),這次則針對影音封裝格式做簡介。所謂的封裝格式,簡單的說,就是影音資料的載體,或稱「容器」(container)。與編碼不同的是,編碼負責表示資料,容器則將資料打包,方便傳遞、播放。例如:Windows平台上常見的未壓縮WAV音訊檔案,其實僅是一種封裝格式,其內部包含的資料,是採用PCM(Pulse-Code Modulation)型式表示的音訊。

封裝格式不見得只能存放一種類型的資料,通常可以允許多種不同的型式的資料同時存於其中,這正是它的方便之處。例如:電影DVD上的VOB檔案是一個載體,裡頭包含了用MPEG-2標準壓縮的影像,用Dolby Digital或DTS格式壓縮的5.1聲道音軌,以及多國語言的字幕。所以一個單獨的VOB檔案,就可以同時傳遞多種資料,省去檔案太分散的麻煩,方便DVD播放器與電腦讀取。


在此再次強調:container與codec是截然不同的東西:被編碼資料的是包在container中的。因為封裝格式是藉於播放軟體(或硬體)與影音資料之間的中介層,要讓電腦撥放一個檔案,首先電腦需藉由適當的中介軟體辨識出該檔案的封裝格式為何,並讀取出其中的影音資料,送交個別的解碼器還原後,再行呈現。這當中的中介軟體,或稱「分離器」,通常有parser、splittter或demuxer等多個名字。因此,影音檔案之畫質、音質好壞,不是由封裝格式決定的,而是由其內部封裝的編碼壓制品質而定:AVI影片跟MKV影片的畫質無從比較,只有它們內部包裝的DivX或Xvid等編碼才能決定。


那麼,影音檔案一定得包在封裝格式中,才能播放嗎?答案是否定的。以MP3為例,單獨的MP3檔案本身就包含了可以播放的資訊,MP3檔案就是MP3檔案,裡頭不會再放其他的東西了;FLAC音訊不論是放在MKV(Matroska)或Ogg中,抑或抽出來成為獨立的FLAC檔案,也是可播放的。但MKV可以搭配章節檔案將一首曲子做分段,方便使用者直接選曲,而Ogg則可在網路上藉由串流(streaming)方式播放,十分適用於網路電台。因此,選用容器與否,要看用途而定。
目前可見的封裝格式不下十來種,在下篇中將針對較常見的格式做簡介。

出處:http://cation-av-station.blogspot.com/2 ... st_16.html

What is a codec ?

To fully understand the VideoLAN solution, you must understand the difference between a codec and a container format

A codec is a compression algorithm, used to reduce the size of a stream. There are audio codecs and video codecs. MPEG-1, MPEG-2, MPEG-4, Vorbis, DivX, ... are codecs

What is a container format ?

To start off, think of a container format as a standard shipping box. You get a box in the mail and you think, "Cool! What's inside." You don't really care about the box itself, you care about what's in that box. The problem? You can't see into the box. So what do you do? You get a knife and cut it open.

A container format follows this same basic idea. It contains one or several streams already encoded by codecs. Very often, there is an audio stream and a video one. AVI, Ogg, MOV, ASF, MP4 ... are container formats. The streams contained can be encoded using different codecs. In a perfect world, you could put any codec in any container format. Unfortunately, there are some incompatibilities. You can find a matrix of possible codecs and container formats on the features page

出處:http://www.cnblogs.com/shipfi/archive/2 ... 19923.html
回覆文章

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客