Page 1 of 1

[Extension] Fine adjust playback speed

Posted: 18 Feb 2017 18:38
by mederi
The idea: https://forum.videolan.org/viewtopic.ph ... 21#p453521

Code: Select all

function descriptor() return { title = "Fine adjust playback speed", capabilities = {"meta-listener"} } end function activate() Create_dialog() click_Rate(0) end function deactivate() end function meta_changed() click_Rate(0) end --- Dialog box --- function close() vlc.deactivate() end function Create_dialog() d = vlc.dialog(descriptor().title) ti_step = d:add_text_input("0.01",1,1,2,1) d:add_button("<<", function() click_Rate(-1) end, 1,2,1,1) d:add_button(">>", function() click_Rate(1) end, 2,2,1,1) end rate=1 function click_Rate(dir) local input=vlc.object.input() if input then rate=rate+dir*tonumber(ti_step:get_text()) vlc.var.set(input, "rate", rate) -- crate=vlc.var.get(input,"rate") d:set_title(rate .. " (" .. crate .. ")") end end

Re: [Extension] Fine adjust playback speed

Posted: 19 Feb 2017 15:51
by verdigris
Very kind. What do I have to do to use it?

Re: [Extension] Fine adjust playback speed

Posted: 19 Feb 2017 17:32
by mederi
Copy/paste the code, save the file as "faps.lua" into "\lua\extensions\" folder, restart VLC. Then activate the extension in VLC menu: View > Fine adjust playback speed. More extensions and installation instructions at https://addons.videolan.org

Re: [Extension] Fine adjust playback speed

Posted: 19 Feb 2017 17:35
by verdigris
:D

I can't find a way to "like" posts on this forum, but take that as one.

Re: [Extension] Fine adjust playback speed

Posted: 19 Feb 2017 19:53
by verdigris
This is great, thank you very much (which is not to say I wouldn't still like the features requested here: https://forum.videolan.org/viewtopic.php?f=7&t=137509 ).

I can't pretend to understand all the details, and never even heard of Lua before, but working on what you've given me I have made a few tweaks:

1. There is now a normal speed button between the slower and faster buttons, and the labelling is more explicit;

2. The tool title bar now shows "Speed = 1.00" when the rate is normal speed, rather than the cryptic "1(1)";

3. I have renamed it "Pop-Out Playback Speed Control" (and the file is ppsc.lua).

There is one thing that eludes me: I tried to make it reset the playback speed to 1.00 if the tool is closed (as you will see - by putting "vlc.var.set(input, "rate", 1)" in the deactivate function), but it doesn't work (neither does it work if the line is put in the close function). Any ideas?

Code: Select all

function descriptor() return { title = "Pop-Out Playback Speed Control", capabilities = {"meta-listener"} } end function activate() Create_dialog() click_Rate(0) end function deactivate() vlc.var.set(input, "rate", 1) end function meta_changed() click_Rate(0) end --- Dialog box --- function close() vlc.deactivate() end function Create_dialog() d = vlc.dialog(descriptor().title) d:add_label("+/- Step Size:",1,1,1,1) ti_step = d:add_text_input("0.01",2,1,2,1) d:add_button("<< Slower", function() click_Rate(-1) end, 1,2,1,1) d:add_button("Normal (1.00)", function() click_Rate(0) end, 2,2,1,1) d:add_button("Faster >>", function() click_Rate(1) end, 3,2,1,1) end rate=1 function click_Rate(dir) local input=vlc.object.input() if input then if dir==0 then rate=1 else rate=rate+dir*tonumber(ti_step:get_text()) end vlc.var.set(input, "rate", rate) -- crate=vlc.var.get(input,"rate") if rate==1 then d:set_title("Speed = 1.00") else d:set_title("Speed = " .. rate .. " (" .. crate .. ")") end end end

Re: [Extension] Fine adjust playback speed

Posted: 20 Feb 2017 17:10
by mederi
I have used click_Rate(0) within meta_changed() callback function to set the current speed also for next item in playlist. Now it always resets the rate to normal speed (1).

Code: Select all

-- local variable: local input=vlc.object.input() -- global variable: input=vlc.object.input() -- or simply: vlc.var.set(vlc.object.input(), "rate", 1)

Re: [Extension] Fine adjust playback speed

Posted: 19 Mar 2017 09:28
by verdigris
Just a comment, but I wonder whether anybody can shed light:

1. With the extension running, the standard playback speed control is no longer functional;

2. Double-clicking the standard playback speed indicator crashes VLC.

Re: [Extension] Fine adjust playback speed

Posted: 23 Apr 2017 01:44
by drold
Why did VLC get rid of the previous method of speed control????

It worked. I could use the keyboard to increase the speed.

That's one of the main reasons I use VLC so I can use to SPEED videos.

This video speed controler is SLOW to adjust.

There are no keys on the key board that work to speed it up.

Seriously???? Why do programs get worse and worse NOT better!

I mean EVERY PROGRAM GETS WORSE AND WORSE!!!!!

Microsoft word I still can't control a TABLE!

Excel could be a million times easier.

Get it together programmers!!!!! SERIOUSLY!!!!!

Make thing intuitive but STOP getting rid of BASIC FUNCTIONS!!!!!!

Re: [Extension] Fine adjust playback speed

Posted: 03 May 2017 09:09
by verdigris
There are better places to post that kind of rant. This topic is about developing a fine speed control extension, not complaining about the standard function.

Re: [Extension] Fine adjust playback speed

Posted: 30 Jun 2017 18:40
by DanceCatDave
Hey folks,

Rank noob here, and not sure where to post.

I'm an amateur DJ and use software for my music (Traktor, specifically). I also have a number of videos of light effects, animals "dancing", etc. I would like to combine the two, using VLC.

My thought is this: Computer 1 will output the music to the mixer, as well as to Computer 2. Computer 2 will read the BPM of the current song (based on MIDI information, for example), and automatically adjust the VLC playback speed to match.

For example, I have a video of a bird bopping its head at 100 BPM. When I play a song that is 108 BPM, I'd like the information to automatically adjust the playback speed up to 1.08 (assuming that "1.08" represents a 100-point graduation speed increase, as opposed to some other standard). I would also like it to "beat-match", if at all possible. That way the head isn't bopping at a 1/3 beat off of the music.

Has this already been done? CAN this be done?

Once I have the information, I can have someone write the script (or whatever), since everything I know about computing can fit in the word "nothing".

The information on getting MIDI out of Traktor is here, if that makes a difference.

https://support.native-instruments.com/ ... in-TRAKTOR

Thanks

Re: [Extension] Fine adjust playback speed

Posted: 30 Jun 2017 23:27
by verdigris
Off topic. Start a new thread.

Re: [Extension] Fine adjust playback speed

Posted: 24 Feb 2018 18:51
by jfhenault
Does someone know how to implement/use hotkeys from this LUA file? It would be great to change speed rate with ultra fine precision without opening/clicking this extension all the time in Menu/View. Maybe this LUA extension with hotkeys support that loads automatically with VLC.

Is it possible?

And another thing : Is there a way to center the text in the textbox?

Re: [Extension] Fine adjust playback speed

Posted: 24 Feb 2018 20:40
by jfhenault
For those who know programming better than me, maybe this link could help.

https://forum.videolan.org/viewtopic.php?t=111880

As I said, it would be great to add hotkeys to this extension but also to load the extension anytime VLC is launched so we could change speed rate with ultra precision using hotkeys. A hotkey could also open a popup window only to specify the incrementation (e.g. 0.01x).

Thank you!!

Re: [Extension] Fine adjust playback speed

Posted: 25 Feb 2018 13:51
by mederi
No, hotkeys are not supported in plugins/addons in latest VLC. Old VLC 2.0.x supports callbacks (including hotkeys) in Lua scripts. Automatic activation of Extensions has not been implemented yet. Qt GUI (Windows, Linux) supports button hotkeys within dialog box (ampersand character somewhere in button label string => Alt+key).

Re: [Extension] Fine adjust playback speed

Posted: 19 Aug 2019 01:33
by gdeangel
Why did VLC get rid of the previous method of speed control????

It worked. I could use the keyboard to increase the speed.

...

Make thing intuitive but STOP getting rid of BASIC FUNCTIONS!!!!!!
I will give you my guess... because somewhere in the development process some code for the keyboard shortcuts got broken. My version of VLC will *sometimes* recognize the hotkeys ([ and ]), and sometimes not. That smacks of something other than intentional feature deprecation.

But what I really wanted to ask here is can this extension be used in a playlist to adjust playback speeds automatically?

Re: [Extension] Fine adjust playback speed

Posted: 19 Aug 2019 08:47
by verdigris
But what I really wanted to ask here is can this extension be used in a playlist to adjust playback speeds automatically?
That would be very nice, although you would need some way to store the adjustment factor alongside the track in the playlist and I'm not at all sure the standard for playlists will accommodate that - or, if it does, whether VLC's implementation can.

An alternative might be to store the preset speed adjustment in an MP3 tag, but again you would then need to persuade VLC to read the tag and act on it.

My opinion is that this is all too difficult for VLC and would need a bespoke MP3 player with that kind of functionality in mind from the ground up.

Re: [Extension] Fine adjust playback speed

Posted: 16 Jan 2021 15:27
by nickyg
it's a great extension it just lacks one thing to make it fantastic: the ability to control the << Slower | keys Faster >> with keyboard commands keeping the panel closed.
As VLC natively works, only VLC does not allow you to manually set the speed hops.