Generate PCR from PTS

前端 未结 3 556
孤街浪徒
孤街浪徒 2020-12-14 04:32

I am trying to create PCR from PTS as follows.

        S64 nPcr = nPts * 9 / 100;  
        pTsBuf[4] = 7 + nStuffyingBytes;  
        pTsBuf[5] = 0x10;   /*         


        
3条回答
  •  -上瘾入骨i
    2020-12-14 05:30

    The answer of @schieferstapel is correct. I am only adding one more note here which refers to an exception.

    There are times when B frames arrives after (who's PTS is less than) P frames. so PTS can be non-linear if every picture is stamped with PTS value. Whereas, PCR must be incrementally linear.

    So in the above situation, you must try to either omit B frames or make relevant calculation when putting PCR values. Also, if this is hardware playouts, it is advisable that PCR should be slightly ahead (lesser by 400 ms or so) than PTS of corresponding I frames.

提交回复
热议问题