locked
How to get DTS of a frame RRS feed

  • Question

  • Hi,

    I'm using H.264 MFT to do encoding and mux encoded frames myself into a MP4 file.

    I could get the timestamp (presentation time) using IMFSample->GetSampleTime(&iSampleTime),

    But to mux frames correctly I need to know DTS of the frames (it could be different from PTS).

    Could anyone tell me how can I get DTS from a IMFSample? 

    Thanks

    Friday, June 19, 2015 1:25 AM

All replies

  • IMFSample::GetSampleTime returns QPC/DTS, unless you are getting it after it's been passed to the sink. Then it contains the presentation time that is calculated based on the first sample's GetSampleTime:

    [source] -> IMFSample with QPC/DTS -> <MTFs> -> IMFSample with QPC/DTS -> [Sink] -> IMFSample with PTS.

    Edited:

    You can also try and use MFSampleExtension_DeviceTimestamp attribute.


    Tuesday, June 23, 2015 10:02 PM
  • Hi Aleksey,

    Thanks for your reply and sorry for my late response.

    I'm using MFT directly without using any source or sink. I get the IMFSamples from H.264 Encoder FMT, so they are encoded frames.

                

     --- Uncompressed frames ------> [H.264 encoder MFT] ------ Encoded frames -------> [ my own muxer]

    From the documentation here https://msdn.microsoft.com/en-us/library/windows/desktop/ms705645(v=vs.85).aspx  GetSampleTime returns PTS.

    I just want to know, if there's any way to get the DTS of the frames before muxing them (or before writing to the sink)? Thanks

    Thursday, July 2, 2015 6:08 AM
  • IMFSample::GetSampleTime returns QPC/DTS, unless you are getting it after it's been passed to the sink. Then it contains the presentation time that is calculated based on the first sample's GetSampleTime:

    [source] -> IMFSample with QPC/DTS -> <MTFs> -> IMFSample with QPC/DTS -> [Sink] -> IMFSample with PTS.

    The MFSampleExtension_DeviceTimestamp attribute is not available for encoded samples. At the moment I get only the DTS timestamp from the sourceReader::ReadSample() API - its the same as from the IMFSample::GetSampleTime().

    It seems that there`s no way to get the PTS timestamp without decoding the sample. Usually every encoded video sample has a PTS and a DTS timestamp. Why is it not possible to get both timestamps without decoding the sample?

    Wednesday, July 29, 2015 9:16 AM