I'm recording some sports footage, and write down some notes, while the recording is going on.
I would like to be able to, as fast as possible, to link my comment to the passage on the video. I record it with a GoPro, so the 1,5 hour longs video gets chopped up to small pieces.
I thought it would be an idea, if VLC could display the actual time of when the footage was take, on screen. In the same manner of this (opening VLC from a command-line with that comment):
vlc.exe --sub-filter=marq{marquee=$T/$D" Volume:"$V,size=-2,color=16776960}:marq{marquee=Time:%H:%M:%S" Date:"%d/%m/%Y,color=16776960,size=-2,position=6}
That line just shows the current time. I wanted it for example to show something like this:
If the recording was started at 19:39:21
, - then three minutes and 7 seconds into the video, the counter should say 19:42:28
. Is that achievable somehow?
I assumed that VLC was the best/easiest way to achieve it - but if someone else has another or a better idea, then I'm all ears.
1 Answers
Answers 1
Here's a LUA extension that should do what you need. It'll show the time in the top-right based on a given "start" time. The only thing you'll need to do is set what that start time is. You can adjust the start time at any point and the text should update accordingly:
- Put the file custom_time.lua in
[VLC DIR]\VLC\lua\extensions
- Put the file looper_custom_time.lua in
[VLC DIR]\VLC\lua\intf
- run VLC using the command line arguments:
vlc.exe --extraintf=luaintf{intf="looper_custom_time"}
- You should see the time in the top-right starting at
12:00:00
and incrementing based on the video playing - You can go to
View -> Custom Time
and set what the starting time should be, and the text should update
Let me know if it works!
custom_time.lua :
function descriptor() return { title = "Custom Time", capabilities = { } } end function activate() window = vlc.dialog("Enter Time") textbox = window:add_text_input("HH:MM:SS", 1, 1, 1, 1) label = window:add_label("Enter Start Time (24h)", 2, 1, 1, 1) button = window:add_button("Set", setStartTime, 1, 2, 2, 1) end function deactivate() end function meta_changed() end function setStartTime() vlc.config.set("bookmark10", textbox:get_text()) vlc.msg.info("[ext_Custom_Time] " .. "Set Start Time to: ".. os.date("%H:%M:%S", globalTimeFinal)) end
looper_custom_time.lua :
-- "looper_custom_time" >> copy the script file into VLC\lua\intf\ folder -- activate it: -- vlc.exe --extraintf=luaintf{intf="looper_custom_time"} function Looper() local loops=0 -- counter of loops while true do if vlc.volume.get() == -256 then break end -- inspired by syncplay.lua; kills vlc.exe process in Task Manager if vlc.playlist.status()=="stopped" then -- no input or stopped input loops=loops+1 Log(loops) Sleep(1) else -- playing, paused if vlc.playlist.status()=="playing" then showFinalTime() Sleep(1) elseif vlc.playlist.status()=="paused" then showFinalTime() Sleep(0.3) else -- ? Log("unknown") Sleep(1) end end end end function getStartTime() local pattern = "(%d+):(%d+):(%d+)" local startTimeString = vlc.config.get("bookmark10") if startTimeString == nil then startTimeString = "" end local hh, mm, ss = startTimeString:match(pattern) return os.time({year = 2000, month = 1, day = 1, hour = hh, min = mm, sec = ss}) end function Log(lm) vlc.msg.info("[looper_intf] " .. lm .. os.date(" %H:%M:%S", getStartTime())) end function showFinalTime() local timePassed = getTimePassed() local timeStart = getStartTime() local timeFinal = os.date("%H:%M:%S", timeStart + timePassed) vlc.osd.message( timeFinal, vlc.osd.channel_register(), "top-right", 1200000) end function getTimePassed() return vlc.var.get(vlc.object.input(), "time") end function Sleep(st) -- seconds vlc.misc.mwait(vlc.misc.mdate() + st*1000000) end Looper()
0 comments:
Post a Comment