mov tref box——TrackReferenceBox

來源:互聯網
上載者:User

tref box可以描述兩track之間關係。

比如:一個MP4檔案中有三條video track,ID分別是2、3、4,以及三條audio track,ID分別是6、7、8。

在播放track 2視頻時到底應該採用6、7、8哪條音頻與其配套播放。這時候就需要在track 2與6的tref box中指定一下,將2與6兩條track綁定起來。

在我們常見的MP4檔案中幾乎看不到這種情況的存在,實際應用情境在哪呢。

我們知道,ISO-14496-12是一種基礎檔案格式,從這種檔案格式衍生出的不僅mp4檔案,還有很多用於線上即時交付的流媒體視頻格式,比如微軟的Smooth Streaming的解決方案中的ismv檔案。

假設我們是一家電視台,我們採用了微軟的Smooth Streaming技術進行節目發布,我們推出了13套節目,分別是CCAV 1-13。這時候我們伺服器推出的媒體流可能只有一個。這個流中包含了全部的13套節目,至少有13條視頻軌與13條音頻軌。使用者在收看節目時使用了某公司生產的類似機頂盒似的硬體裝置,可以解碼與播放,但是必須要找到每套節目對應的視頻與音頻(不能播放CCAV 5籃球賽畫面的同時配上了CCAV 13的共同關注聲音)。這時候就需要通過tref box將視頻與音頻之間的關係一一對應起來。

這就是tref box的實際應用情境之一,有些類似ts格式中的PAT,PMT。在官方協議中描述了另一種應用,即,參考時鐘track,簡單理解就是音視頻在此處都引用了同一個time code track,以使音視頻同步播放,類似ts格式中PCR與各track的PTS關係。

下面看具體欄位:

[cpp]   view plain  copy aligned(8) class TrackReferenceBox extends Box(‘tref’)    {      }    aligned(8) class TrackReferenceTypeBox (unsigned int(32) reference_type) extends Box(reference_type)    {     unsigned int(32) track_IDs[];    }   

顧名思意,tref box用於列出本track解析時所參考的track有哪些。

每個trak box中只能包含[0-1]個tref box;(通常情況下,我們所見的MP4檔案是沒有tref box的)

每個tref box下面可以包含1個以上的tref type box;

引用Apple官方給出的結構圖如下:


在Apple協議中,atom是box的另一種名稱;圖中可知tref box中包含多個子box,每個子box需要填寫type和track ID。

Type的填寫參照下表(Apple定義):

Track reference types

Reference type

Description

'tmcd'

Time code. Usually references a time code track.

'chap'

Chapter or scene list. Usually references a text track.

'sync'

Synchronization. Usually between a video and sound track. Indicates that the two tracks are synchronized. The reference can be from either track to the other, or there may be two references.

'scpt'

Transcript. Usually references a text track.

'ssrc'

Non-primary source. Indicates that the referenced track should send its data to this track, rather than presenting it. The referencing track will use the data to modify how it presents its data. See “Track Input Map Atoms” for more information.

'hint'

The referenced tracks contain the original media for this hint track.

ISO-14496-12又重新整理了這些type欄位為以下三種:

•  ‘hint’  the referenced track(s) contain the original media for this hint track 
•  ‘cdsc‘  this track describes the referenced track. 
•  ‘hind‘  this track depends on the referenced hint track, i.e., it should only be used if the referenced 
hint track is used. 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.