作者xsoameix (xsoameix)
看板AVEncode
标题[请问] MP4时间计算公式的单位问题
时间Thu Apr 5 23:20:08 2012
我在查询MP4的时间计算公式时
找到这张网页
:
http://wiki.multimedia.cx/index.php?title=QuickTime_container#stts
这个wiki在介绍stts这个box的下面写下了这条公式:
duration =
(sample_count1*sample_time_delta1+...+sample_countN*sample_time_deltaN)/timescale
我马上翻译成自己较能理解的形式:
该trak的实际时间长度=(第一个群组的sample数量*第一个群组里一个sample所占的时间
单位+...+第N个群组的sample数量*第N个群组里一个sample所占的时间单位)/采样率
接下来问题来了,我标上它们的单位後觉得不合理:
seconds=(samples*(seconds/sample)+...+samples*(seconds/sample))/(samples/sec)
简化变成
seconds=seconds^2/sample
左右两边的单位不符
我苦思许久,在网路上找到了两个文献:
http://developer.longtailvideo.com/trac/export/1522/branches/adaptive/doc/f4v.pdf
里面解释SampleDelta这个词是「Sample duration in TimeScale units defined in
the mdhd box」
http://jaadec.sourceforge.net/specs/ISO_14496-12_ISOBMFF.pdf
这里则是解释成「sample_delta - is an integer that gives the delta of these
samples in the time-scale of the media.」
以下是我自己推论的:
所以说sample_time_delta的单位不是seconds/sample
而是特别创造出来的TimeScale单位/sample;
timescale的单位不是我们熟知的采样率单位:samples/sec
而是TimeScales/sec
这两个地方修改後就合理了
小弟刚接触这些,不确定自己猜测的是否正确,还请高手赐教,谢谢!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.168.233.204