Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

PTS/DTS calculations

Artem
Beginner
792 Views

Hello,

I am using the "simple_6_transcode_opaque - async - ffmpeg" example and would like to fix the PTS / DTS calculations.

The PTS is accessible by pMfxBitstream->TimeStamp which is correct.

Acording to the Source code and the Documentation Media SDK 1.6 introduced automatic computation of DTS which is accessible by

pMfxBitstream->DecodeTimeStamp

However I am getting only garbage for DTS. Here is an example when I try to encode a video:

PTS V:      0, DTS:  -7200
PTS V:      4, DTS: -17996
PTS V:      2, DTS:  -7198
PTS V:      1, DTS:      1
PTS V:      3, DTS:  -3597
PTS V:      7, DTS: -14393
PTS V:      5, DTS:  -3595
PTS V:      6, DTS:  -3594
PTS V:     11, DTS: -17989
PTS V:      9, DTS:  -7191
PTS V:      8, DTS:      8
PTS V:     10, DTS:  -3590
PTS V:     15, DTS: -17985
PTS V:     13, DTS:  -7187
PTS V:     12, DTS:     12
PTS V:     14, DTS:  -3586

Any ideas what is wrong that the DTS is incorrect?

Thanks, Artem

0 Kudos
5 Replies
OTorg
New Contributor III
792 Views

Input and output pts/dts are measured in 1/90000 sec units. Do you set/interpret them correctly?

-7200 is most likely a -80ms (-2 frames at 25p/50i fps)...

0 Kudos
Artem
Beginner
792 Views

Hello,

thanks for the reply, but this does not make any sense for me. If -7200 is -80ms for the first frame then why has Frame 4 a DTS of 1 and Frame 11 a DTS of 8?

0 Kudos
OTorg
New Contributor III
792 Views

If you pass incorrect input pts then you shouldn't expect any correct output pts/dts.

I think output dts 1, 8, 12 are for frames with pts==dts (most likely, B-frames) and are simply copied from input pts.

Other dts values are very similar to be in 1/90kHz units: -17996-4 = -200ms, etc...

0 Kudos
Artem
Beginner
792 Views

Hello,

many thanks. The input PTS was bad / the example source code had badly implemented it. After fixing the input PTS I got a correct output DTS now.

0 Kudos
OTorg
New Contributor III
792 Views

Good luck!

0 Kudos
Reply