Quantcast
Channel: Intel® Software - Media
Viewing all articles
Browse latest Browse all 2185

Does SDK provide method to calc PTS and DTS for every encoded frame?

$
0
0

I'm using the SDK for h.264 encoding and muxing. when i read the example of "msdk_ffmpeg_integration", i found that the sdk handles PTS as follow:

mfxStatus FFMPEGWriter::WriteNextFrame(mfxBitstream *pMfxBitstream, bool isPrint) 

{

++m_nProcessedFramesNum;

AVPacket pkt;
av_init_packet(&pkt);

AVCodecContext *c = m_pVideoStream->codec;

m_pVideoStream->pts.val = m_nProcessedFramesNum;

pkt.pts = av_rescale_q(m_pVideoStream->pts.val, c->time_base, m_pVideoStream->time_base);

....

}

It just simply use the ProcessedFramesNum to calc PTS,but i think it's not the best(or correct) method.

As I know, h.264 has I、P、B frame, and the PTS will not be continuous,so how can I get the correct PTS and DTS?


Viewing all articles
Browse latest Browse all 2185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>