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.
3075 Discussions

How to get transcode calc DecodingTimeStamp, TimeStamp?

parksh
New Contributor I
1,009 Views

Hello!

 

sample_multi_transcode(https://github.com/oneapi-src/oneVPL/blob/master/tools/legacy/sample_multi_transcode)

Debugging the sample code above PutBS() function call -> sts = m_pmfxSession->SyncOperation(pBitstreamEx->Syncp, GetSyncOpTimeout());
pBitstreamEx->Bitstream.Decode TimeStamp, pBitstreamEx->Bitstream.TimeStamp values ​​are returned

However, in software applications based on sample_multi_transcode, DecodingTimeStamp and TimeStamp values ​​are always returned as 0.


sts = m_pmfxDEC->Init(&m_mfxDecParams);
sts = m_pmfxVPP->Init(&m_mfxVppParams);
sts = m_pmfxENC->Init(&m_mfxEncParams);

&m_mfxDecParams, m_mfxVppParams, and m_mfxEncParams parameter values ​​all match

What processing should I do additionally to get DecodingTimeStamp and TimeStamp?

 

https://github.com/oneapi-src/oneVPL/blob/master/tools/legacy/sample_multi_transcode/src/pipeline_transcode.cpp
mfxStatus CTranscodingPipeline::PutBS() {
mfxStatus sts = MFX_ERR_NONE;
ExtendedBS* pBitstreamEx = m_BSPool.front();
MSDK_CHECK_POINTER(pBitstreamEx, MFX_ERR_NULL_PTR);

// get result coded stream, synchronize only if we still have sync point
if (pBitstreamEx->Syncp) {
m_ScalerConfig.Tracer->BeginEvent(SMTTracer::ThreadType::ENC,
TargetID,
SMTTracer::EventName::SYNC,
pBitstreamEx->Syncp,
nullptr);
sts = m_pmfxSession->SyncOperation(pBitstreamEx->Syncp, GetSyncOpTimeout());

m_ScalerConfig.Tracer->EndEvent(SMTTracer::ThreadType::ENC,
TargetID,
SMTTracer::EventName::SYNC,
pBitstreamEx->Syncp,
nullptr);
m_ScalerConfig.Tracer->AfterEncodeSync();
HandlePossibleGpuHang(sts);
MSDK_CHECK_ERR_NONE_STATUS(sts, MFX_ERR_ABORTED, "Encode: SyncOperation failed");
if (m_pSurfaceUtilizationSynchronizer && m_MemoryModel != GENERAL_ALLOC) {
m_pSurfaceUtilizationSynchronizer->NotifyFreeCome();
}
}

m_nOutputFramesNum++;

msdk_stringstream ss;
ss << MSDK_STRING("[framenum: ") << m_nOutputFramesNum << MSDK_STRING(", ")
<< MSDK_STRING("frametype: ") << pBitstreamEx->Bitstream.FrameType << MSDK_STRING("] ")
<< MSDK_STRING("DTS: ") << pBitstreamEx->Bitstream.DecodeTimeStamp << MSDK_STRING(", ")
<< MSDK_STRING("PTS: ") << pBitstreamEx->Bitstream.TimeStamp
<< std::endl;

msdk_printf(MSDK_STRING("%s"), ss.str().c_str());

//--- Time measurements
if (statisticsWindowSize) {
outputStatistics.StopTimeMeasurementWithCheck();
outputStatistics.StartTimeMeasurement();
}

m_ScalerConfig.Tracer->BeginEvent(SMTTracer::ThreadType::ENC,
TargetID,
SMTTracer::EventName::WRITE_BS,
nullptr,
nullptr);
if (!m_ScalerConfig.ParallelEncodingRequired) {
sts = m_pBSProcessor->ProcessOutputBitstream(&pBitstreamEx->Bitstream);
}
else {
sts = m_pBSProcessor->ProcessOutputBitstream(&pBitstreamEx->Bitstream,
TargetID,
m_nOutputFramesNum);
}
m_ScalerConfig.Tracer->EndEvent(SMTTracer::ThreadType::ENC,
TargetID,
SMTTracer::EventName::WRITE_BS,
nullptr,
nullptr);
MSDK_CHECK_STATUS(sts, "m_pBSProcessor->ProcessOutputBitstream failed");

UnPreEncAuxBuffer(pBitstreamEx->pCtrl);

pBitstreamEx->Bitstream.DataLength = 0;
pBitstreamEx->Bitstream.DataOffset = 0;

if (m_BSPool.size())
m_BSPool.pop_front();
m_pBSStore->Release(pBitstreamEx);

mfxU16 FrameTYpe = pBitstreamEx->Bitstream.FrameType;

return sts;
} //mfxStatus CTranscodingPipeline::PutBS()

 

 

CPU : i7-11700
OS : Windows 10 Pro for Workstations
API version : 2.3
oneVPL version : master version(2023.2.1)
libmfx64-gen.dll
- File Version : 11.21.6.24
- Product Version : 11.0.0.004

 

 

Thanks in advance for your reply.

 

 

0 Kudos
3 Replies
AthiraM_Intel
Moderator
959 Views

Hi,


Thank you for posting in Intel Communities.


Could you please share the sample reproducer code which has your modifications and the exact steps you followed?


Thanks


0 Kudos
parksh
New Contributor I
920 Views

I'm sorry

 

The timestamp initalization part was missing in the code I modified.

 

By adding the code below, I was able to get the TimeStamp value returned.

 

FileBitstreamProcessor::FileBitstreamProcessor() {
    MSDK_ZERO_MEMORY(m_Bitstream);
    ===> m_Bitstream.TimeStamp = (mfxU64)-1;
} // FileBitstreamProcessor::FileBitstreamProcessor()

 

Thanks

0 Kudos
AthiraM_Intel
Moderator
905 Views

Hi,


Glad to know that your issue is resolved. Thanks for sharing the solution with us. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.



Thanks


0 Kudos
Reply