Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. video duration convert from milliseconds to minutes seconds

video duration convert from milliseconds to minutes seconds

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 2.4k Views 2 Watching
  • 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 Offline
    P Offline
    phirestalker
    wrote on last edited by
    #1

    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
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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
      1
      • P Offline
        P Offline
        phirestalker
        wrote on last edited by
        #3

        thanks that should do it

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved