locked
PTS values in Mpeg2 Transport Streams RRS feed

  • Question

  • I have written a demuxer for Mpeg2 transport stream which is extracting the following values as PTS:

    45176788.877777778

    45176788.877777778

    45176828.877777778

    45176828.877777778

    45176828.877777778

    45176908.877777778

    This seems too huge to be PTS and I'm consequently not able to achieve AV sync. Am I doing anything wrong in the calculations?

    Also, why are they repeating?

    Thanks!

    Thursday, August 12, 2010 11:32 PM

Answers

  • One thing that looks wrong is that you're using the wrong operator (&&). You want to do a bitwise AND &.

     


    http://sourceforge.net/projects/videoprocessing
    Friday, August 20, 2010 5:32 AM
  • I think there were also a couple of errors :
    int index = 0;
    
    uint16 part1 = buffer[index] & 0x0E>>1; // MUST ALSO BE SHIFTED RIGHT
    
    index++;
    
    uint16 part2 = (buffer[index] & 0xFFFE)>>1;
    
    Index ++; // WAS AN ERROR (if buffer is uint16 array) 
    
    uint16 part3 = (buffer[index] & 0xFFFE)>>1;
    
    double pts = ((part1 << 30)+(part2 << 15)+ part3)/90;
    
    

    Michel Roujansky, http://www.roujansky.com
    Friday, August 20, 2010 5:10 PM

All replies

  • PTS extraction is a complex byte and bits manipulation. It is impossible to give you an answer without any information. Can you post your code to extract and compute the PTS?
    Michel Roujansky, http://www.roujansky.com
    Friday, August 13, 2010 4:58 PM
  • So this is how I’m calculating PTS:

     

    int index = 0;

    uint16 part1 = buffer[index] && 0x0E;

    index++;

     

    uint16 part2 = (buffer[index] && 0xFFFE)>>1;

    Index += 2;

     

    uint16 part3 = (buffer[index] && 0xFFFE)>>1;

     

    double pts = ((part1 << 30)+(part2 << 15)+ part3)/90;

     

    Is something wrong here? Thank you for your help.

    Wednesday, August 18, 2010 10:32 PM
  • One thing that looks wrong is that you're using the wrong operator (&&). You want to do a bitwise AND &.

     


    http://sourceforge.net/projects/videoprocessing
    Friday, August 20, 2010 5:32 AM
  • I think there were also a couple of errors :
    int index = 0;
    
    uint16 part1 = buffer[index] & 0x0E>>1; // MUST ALSO BE SHIFTED RIGHT
    
    index++;
    
    uint16 part2 = (buffer[index] & 0xFFFE)>>1;
    
    Index ++; // WAS AN ERROR (if buffer is uint16 array) 
    
    uint16 part3 = (buffer[index] & 0xFFFE)>>1;
    
    double pts = ((part1 << 30)+(part2 << 15)+ part3)/90;
    
    

    Michel Roujansky, http://www.roujansky.com
    Friday, August 20, 2010 5:10 PM