Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved video duration convert from milliseconds to minutes seconds

    General and Desktop
    2
    3
    1927
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      phirestalker last edited by

      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

      1 Reply Last reply Reply Quote 0
      • ?
        A Former User last edited by

        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();
        
        1 Reply Last reply Reply Quote 1
        • P
          phirestalker last edited by

          thanks that should do it

          1 Reply Last reply Reply Quote 0
          • First post
            Last post