Page 1 of 1
Copying timestamp to paste elsewhere
Posted: 18 Oct 2022 11:59
by verilly
Is there a way of copying the current timestamp of a video/music file to paste elsewhere? Preferably with a keyboard shortcut to speed up the process.
Re: Copying timestamp to paste elsewhere
Posted: 18 Oct 2022 14:16
by chubinou
there use to be a lua plugin that did that for VLC 2.0 [1], but I don't think this can be ported to 3.0, the lua API being is more restricted. I don't this you have access (for security reasons) to os.execute which is used for setting the clipboard.
[1]
https://addons.videolan.org/p/1154007
Re: Copying timestamp to paste elsewhere
Posted: 18 Oct 2022 20:15
by verilly
I can always downgrade to a lower version for the time being, is there some kinda tutorial on how to use the plugin, as theres pretty much no description on how to use the plugin on that page...?
Re: Copying timestamp to paste elsewhere
Posted: 19 Oct 2022 09:24
by chubinou
> I can always downgrade to a lower version for the time being
Obviously I advice against this, VLC 2.x is not maintained anymore.
while I don't think you'll be able to access the clipboard from a lua plugin, the might be some acceptable compromise achievable with a plugin (saving the timestamp to a file, displaying the timestamp in a copiable text field, etc....)
> is there some kinda tutorial on how to use the plugin
the above script binds the shortcurt Shift+C to the clipboard
to install a plugin you can follow this guide (first link I found on google)
https://www.vlchelp.com/install-vlc-media-player-addon/
Re: Copying timestamp to paste elsewhere
Posted: 19 Oct 2022 14:10
by verilly
I've downloaded and am using VLC version 2.0.8, because according to the comments on the lua plugin page that version of VLC works with the plugin.
I seem to have it installed after copying it to the right place (at least I have it in VLC plugins and extension dropdown box inside VLC) yet there still is no instructions or documention on how to use it. All it says is "Copies current time to the clipboard.Windows only. VLC 2.0.x".
I've tried to press shift+c to copy the timestamp and paste it elsewhere but it doesn't seem to work, I also cant seem to find anything relating to this extension or shortcut in the VLC menu (besides seeing the plugin listed in the plugins and extentions under the tool taskbar)
NVM about whether or not it VLC is maintained, I just need VLC for copying the timestamp.
Re: Copying timestamp to paste elsewhere
Posted: 19 Oct 2022 17:09
by chubinou
I can't really help you further, this plugin was developped by a third party (not part of VLC), it comes as is, without instructions nor documentation. I never tried it myself, all I can do is read it's source code and guess how it's supposed to work
the code state
Code: Select all
if key==33554531 then -- shift-c
addTimeToClipboard("Person A (","):")
end
if key==33554550 then -- shift-v
addTimeToClipboard("Person B (","):")
end
so I guess both shift-C and shift-V are hooked to copy the timestamp to the clipboard (and it add some text before and after)
Also note that it seems to depend on the executable "clip", but this doesn't seems to be provided by the OS (at least on windows 10).
Again scripts on
https://addons.videolan.org are provided by the community, and comes as-is.
Re: Copying timestamp to paste elsewhere
Posted: 19 Oct 2022 17:11
by chubinou
Re: Copying timestamp to paste elsewhere
Posted: 19 Oct 2022 19:37
by verilly
Dam, thanks for your help, do you happen to know of any other media player that can copy the timestamp, google doesnt seem to help much in searching, at least not for beginners lol,
Re: Copying timestamp to paste elsewhere
Posted: 20 Oct 2022 10:23
by chubinou
you may try this script, clicking "UpdateTimestamp" will fill the input text box that you can copy paste manually then, I'm not the most familiar with lua script maybe not the cleanest stuff.
Code: Select all
local dlg = nil
local txtinput = nil
function descriptor()
return {
title = "copy timestamp 0.1",
version = "0.1",
author = "chub",
url = '',
shortdesc = "GetTimestamp intf";
description = "GetTimestamp intf",
capabilities = {"menu", "input-listener" }
}
end
function getFormattedTime(micros)
local millis = math.floor(micros / 1000)
local seconds = math.floor((millis / 1000) % 60)
local minutes = math.floor((millis / 60000) % 60)
local hours = math.floor((millis / 3600000) % 24)
millis = math.floor(millis % 1000)
return string.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, millis)
end
function update_timestamp()
vlc.msg.dbg("UpdateTimestamp")
local t = vlc.var.get(vlc.object.input(), "time")
txtinput:set_text(getFormattedTime(t))
end
function interface_main()
dlg:add_button("get timestamp", update_timestamp)
txtinput = dlg:add_text_input("")
end
function activate()
trigger_menu(0)
end
function trigger_menu(id)
if dlg then
dlg:delete()
end
dlg = vlc.dialog("my dialog")
interface_main()
end
function deactivate()
vlc.msg.dbg("Bye bye!")
if dlg then
dlg:hide()
end
end
function close()
vlc.deactivate()
end
Re: Copying timestamp to paste elsewhere
Posted: 21 Oct 2022 09:51
by verilly
Wait so what do I do with this script, do I update the plugin with it somehow, Im a complete beginner with this kinda stuff
If you have the opportunity, can you have the script so that say a 1 minute 2 second 75 millisecond audio file becomes [01:02.75], and copy able to the clipboard with a keyboard shortcut eg (for example pressing 8 will copy the timestamp to a clipboard). If not Ill just take what I can get as its kinda annoying transcribing the timestamp by hand hundreds of time lol
Re: Copying timestamp to paste elsewhere
Posted: 21 Oct 2022 15:46
by chubinou
> Wait so what do I do with this script, do I update the plugin with it somehow, Im a complete beginner with this kinda stuff
paste the text in a file named 'something.lua' and install the lua files in VLC plugin directories as explained here (option 1) [1] I assumed you did this for the other plugin
[1]
https://www.vlchelp.com/install-vlc-media-player-addon/
> can you have the script [...] becomes [01:02.75]
change this line
Code: Select all
return string.format("%02d:%02d:%02d.%03d", hours, minutes, seconds, millis)
with this
Code: Select all
return string.format("[%02d:%02d:%02d]", hours, minutes, seconds)
> for example pressing 8 will copy the timestamp to a clipboard
no as I explained, lua plugins won't work with the clipboard. with this plugin you need to click on the button to get the timestamp, then copy it manually from the text input.
Re: Copying timestamp to paste elsewhere
Posted: 22 Oct 2022 14:08
by verilly
There is no update button for the original timestamp plugin, but I checked in the VLC menu under view and it shows a button called "Time2Clipboard" so it seems to have installed
When I check under VLC menu tools, plugins and extensions, this is what it shows
https://postimg.cc/gnpqJCFT
Do I need to remove the other plugin to make the new one work, or do I need to install the new lua file the same way as the old plugin
Also I checked the main page of that plugin, and people are talking about using autohotkey to automate copying the timestamps, dunno how to use it though.
*edit* I tried installing the plugin, and when I click on "get timestamp" no matter where along the audio file is, it comes up with a value of [00:00:00], any ideas on what is wrong? (I am using vlc 2.0.8 the same version that is supposed to be used for the original plugin, if that helps)
Re: Copying timestamp to paste elsewhere
Posted: 24 Oct 2022 09:41
by chubinou
> Do I need to remove the other plugin to make the new one work
no that's a different plugin, you should install it aside
> people are talking about using autohotkey to automate copying the timestamps, dunno how to use it though
me neither
> I am using vlc 2.0.8 the same version that is supposed to be used for the original plugin, if that helps
I wrote this from scratch for VLC 3.0, I don't have a 2.x version installed
Re: Copying timestamp to paste elsewhere
Posted: 25 Oct 2022 15:17
by verilly
Lol i was still trying it on vlx 2.0.8, seems to be working now. Is there anyway of making a keyboard shortcut for opening the plugin/clicking the get timestamp button/returning to VLC (either/all of these options) to speed the process along, as pausing VLC takes the focus away from the plugin, and you need to click VLC to start the audio file back up again