video duration convert from milliseconds to minutes seconds
Solved
General and Desktop
-
I am writing a progrm that deals with video using qt and opencv. I get the current frames position as milliseconds and I want to convert it to minutes and seconds. I know the math and could do it manually, I was just wondering if there is a built in qt way to do it. Thanks
-
Hi! As long as your video is unter 24 hours long you can use QTime for this:
const int milliseconds = 12345; QTime vTime(0,0,0,0); vTime = vTime.addMSecs(milliseconds); qDebug() << vTime.hour(); qDebug() << vTime.minute(); qDebug() << vTime.mSec();
-
thanks that should do it