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.
express
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.less
The NALUs come in DTS timestamp order in a repeating pattern likeide
I P B B B P B B B ... post
where the intended playback rendering isthis
I B B B P B B B P ...spa
(This transport strategy ensures that both frames that the B-frame bridges are in the decoder before the B-frame is processed.)code
For FLV, the Timestamp (FLV spec p.69) tells when the frame should be fed to the decoder in milliseconds, which isorm
timestamp = DTS / 90.0element
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便可。
代碼是老衲寫的,說明技術細節所用,不得轉載。 也不許跟老衲索要代碼,會僞裝不在線的。