How can I get the correct video duration out of the video stream for sure?

How can I get the correct video duration out of the video stream for sure?

Hello,

I use the following call to get the duration of one video to be decoded. The debug version of my MS VS 2008 compiler does not have any problems to get the correct duration of the loaded video. The release version has some problems to get from every video the correct duration. Sometimes the duration is 0 instead of 3-5s or seems to be shorter than the given value of 30-60s from the video. I wonder why there is a difference between the debug and release one. I use the IPP 7-0-2 in my software.

Can I use other stream parameters to check the duration or to calculate the correct one? Do I have to wait for a certain state so that I know that the duration parameter is correct now?

virtualDOUBLE GetDuration()

{

if(m_videostreaminfo.duration > 0)

{

// UMC::VideoStreamInfo CVideoItem::m_videostreaminfo

// Ipp64f UMC::sVideoStreamInfo::duration

returnm_videostreaminfo.duration;

}

elseif(m_pSplInfo != 0L)

{

// UMC::SplitterInfo *CVideoItem::m_pSplInfo

// Ipp64f UMC::SplitterInfo::m_dDuration

returnm_pSplInfo->m_dDuration;

}

return0.0;

}

 

Best regards,

Detlev

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I must refresh my question. Maybe there are different ways to get the duration of one video out of its file. The method above seems to deliver a buggy value. Maybe  there is another and second way to get and/or to validate the duration of one video. Amount of bytes within the video file and the bitrate can be an idea to get this validation. Is there anyone who has an idea how I can get the right duration even in release versions of the IPP in my use case?

Best regards,

Detlev

 

Hi Detlev,

there are some modifcation to IPP UMC sample in latest release,  Could you please to try the sample and see if the release version can get right value?

Best Regards

Ying 

Hi Detlev,

For different streams and containers duration is extracted differently. What container and codec do you have problem with? Do you compile x64 or Win32 configuration? It is also would be helpful if you could send example of the stream with such problem.

Can I use other stream parameters to check the duration or to calculate the correct one?

You can calculate duration if you know amount of frames and frame rate of the video.

Have a nice day.

Leave a Comment

Please sign in to add a comment. Not a member? Join today