Kagami / mpv_slicing

Cut video fragments with mpv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hour, minute, second round issue

elmancox opened this issue · comments

function timestamp(duration)
local hours = duration / 3600
local minutes = duration % 3600 / 60
local seconds = duration % 60
return string.format("%02d:%02d:%02.03f", hours, minutes, seconds)
end

if you start a cut between 30 and 59 seconds, this will show 00:01:30.xxx instead of 00:00:30.xxx
You have to add math.floor() to hours and minutes i think.
Something like this:

function timestamp(duration)
local hours = math.floor(duration / 3600)
local minutes = math.floor(duration % 3600 / 60)
local seconds = duration % 60
return string.format("%02d:%02d:%02.03f", hours, minutes, seconds)
end