FLV rtmp 里存在B帧的情况下,time stamp 应该怎么玩 ?

先来引用stackoverflow的一篇文章:
CompositionTime Composition time offset
See ISO 14496-12, 8.15.3 for an explanation of composition times. The offset in an FLV file is always in milliseconds

provides the offset between decoding time and composition time. Since decoding time must be less than the composition time, the offsets are expressed as unsigned numbers such that CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for sample n.

For MPEG-4 H.246 transcoders that deliver I-frame, P-frame, and B-frame NALUs inside an MPEG-2 transport, the resulting packetized elementary streams (PES) are timestamped with presentation time stamps (PTS) and decoder timestamps (DTS) in time units of 1/90000 of a second.

The NALUs come in DTS timestamp order in a repeating pattern like

I P B B B P B B B …

where the intended playback rendering is

I B B B P B B B P …

(This transport strategy ensures that both frames that the B-frame bridges are in the decoder before the B-frame is processed.)

For FLV, the Timestamp (FLV spec p.69) tells when the frame should be fed to the decoder in milliseconds, which is

timestamp = DTS / 90.0

The CompositionTime (FLV spec p.72) tells the renderer when to perform (“compose”) the video frame on the display device in milliseconds after it enters the decoder; thus it is

compositionTime = (PTS – DTS) / 90.0

(Because the PTS >= DTS, this delta is never negative.)

大概知道什么意思了没?再来帖 一张图,从flv的标准文档里扣的:

就是给它赋值 compostionTime即可。

代码是老衲写的,说明技术细节所用,不得转载。 也不准跟老衲索要代码,会假装不在线的。

转自 http://hi.baidu.com/mingyuejingque/item/558dcc16aa29e4623f87cef0

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值