Showing results for 
Search instead for 
Did you mean: 

H.264 frame timestamps with MP4 file pts

When using the UMC classes for H.264 decoding, there does not seem to be a way to correlate the timestamps of the input data (coming from a parsed MP4 file in this case) with the timestamps of the frames produced by calls to theGetFrame method. It seems as if the decoder has a built-in rate of 1/30 seconds for each frame, and just adds that duration for every decoded frame.
This does not work for several reasons:
a) The framerate is not always 30fps, oviously
b) Even if the framerate is constant (which for an MP4 file is never known, since each frame, in theory, can have its own duration), this would not work in the case where some frames are skipped (like when setting the decoding speed, where some frames may be skipped for faster decoding)
c) The timestamps of the compressed frames may change arbitrarily.
What would be needed is the ability to call UMC::MediaData::SetTime for the compressed buffers (the PTS of the compressed frame read from the MP4 file) that are passed to the decoder, and then UMC::MediaData::GetTime on the frames produced by GetFrame() would return the timestamp of the data from which the frame was decoded.
Is there any way to do that?
0 Kudos
0 Replies