Topic: Adding Hotkeys

Does anyone know if the hotkey mechanism in Kinovea is expandable? I see that the hotkeys are defined in the Preferences.xml file. I may just try adding one and see what happens.

Re: Adding Hotkeys

No, it is not expandable unless the source code is modified. The underlying mechanism is "commands" and the shortcuts are bound to commands.  The preferences.xml file defines the mapping between commands and shortcuts. In order to add a new shortcut there first need to be a existing command. A command does not necessarily have a corresponding shortcut bound to it.

What is the action you wanted to do via a keyboard shortcut?

Re: Adding Hotkeys

HI Joan,

I'm the one who has been emailing about shortcuts and config setup. I only recently started looking at the preferences file so I though maybe someone here had done something like that.

I am looking for the ability to switch from capture to playback mode and vice versa.

Thanks for your help!

Jeff

Re: Adding Hotkeys

Yeah, at the moment I don't have a good idea on how we could do this nicely.

One idea maybe would be to have a command that starts a playback screen on whatever is the most recent entry in the capture history. Then you could close the capture screen and use this command. To reload the camera afterwards would require the workspace function to work at any point in the life cycle of the application instead of just the startup.

Re: Adding Hotkeys

Maybe I misunderstand the problem. But the easiest was is to load 2 Kinovea side by side on the desktop.
The first Kinovea deliveres the "Life" Video and the second Kinovea uses observermode to replay.

Re: Adding Hotkeys

The requirement here if I understood correctly is to have a single instance of Kinovea with a single screen inside, and to switch between capture and playback, to minimize resources consumption.

Re: Adding Hotkeys

First of all: Kinovea is an amazing piece of software!

Here are current drawbacks with running multiple instances:
1 - The audio trigger is always live so for at least one of my instances, I do get multiple videos. I have added a line to the source code to disable the trigger but I don't have a sufficiently elegant way to re-enable it.
2 - The replay observer will always load the most current video and I am recording from 3 cameras into the same directory. I could record into different directories to solve this.
3 - The resources needed to capture 2 color cameras at 480 FPS 640x480(uncompressed so they load quicker into the playback instance) is ~ 8GB. I perform my own compression later with ffmpeg anyway. The playback resources to play them smoothly is about 4GB.
4 - Switching between modes (capture -> playback, playback -> capture) requires reconfiguration. I.e. - the cameras need to be reloaded manually when switching to capture mode. Right now, I simply close each instance and re-start them with an associated Default Workspace. This works, but the screen switching is less than ideal.

Ideally, I would like to be able to capture 2 cameras in one instance, switch to the playback mode and have the videos and annotations load automatically. Then have the ability to switch back to the capture mode and have the cameras ready to record again. 0.9.4 is really close to being able to accomplish that.

Much of this comes down to personal preference. I am working my way through most of this. Unfortunately, C# is not my expertise, I can muddle my way through most C++ (I learned C way back in my college days) but the structure of C# sometimes makes my head spin.

Thanks for all the help!

Re: Adding Hotkeys

jatracy wrote:

1 - The audio trigger is always live so for at least one of my instances, I do get multiple videos. I have added a line to the source code to disable the trigger but I don't have a sufficiently elegant way to re-enable it.

There is a command called "ToggleArmCaptureTrigger" that enable/disable the audio trigger, it's not bound to any keyboard shortcut by default but maybe you can use that? It's the same as clicking the speaker icon in the capture controls.

The auto disarming for a cool-off period is on the roadmap but most probably not for the next version.

jatracy wrote:

2 - The replay observer will always load the most current video and I am recording from 3 cameras into the same directory. I could record into different directories to solve this.

For this what I wanted to do originally was to support glob patterns in the filename. At the moment the "filename" field for a replay observer is set to "*", as in, "any file". (further filtered by supported extensions). But the idea was to allow for finer filtering on the filename so you could have observers that only load a specific camera if the file patterns are set appropriately.

The tricky part really is where to put the UI to let the user specify this. But we could start by making it work for workspaces.

Now that there is a menu to switch between video and observer directly in the player infobar, I think it will be a good place to host that extra customization option.

Re: Adding Hotkeys

I just pushed a change to support patterns in the filename part of the replay observer (everything was almost ready to go). This should work with observers defined in workspaces. So based on how you setup the capture output files it should be possible to have each observer specific to each capture.

For example, in the workspace file:

<FullPath>D:\temp\cam1-*.*</FullPath>

This will observe the files under "D:\temp\" but only the ones that start with the "cam1-" prefix. You can use multiple "*" wildcards and also "?" for single character match. For example "?at.*" will match "bat.mp4" and "cat.avi", but it won't match "flat.mp4".

A unique "*" will still match any file and is still the default when creating an observer from the main menu by pointing a folder.

Re: Adding Hotkeys

Excellent news on the replay observer filter. I will try it our today. Do I need to specify the <recent observers> section of the confit file also?

I’ll also see if I can figure out how to create a shortcut for the trigger toggle command. That seems like something I can do.

Thanks again for all your help!

Re: Adding Hotkeys

I'm not sure if that's what you meant but for the shortcut thing you don't have to write any code. All the commands are listed in Preferences > Keyboard. It's just that this particular one doesn't have a shortcut assigned, you'll see it says "None". But you can assign one from the preference page.

The recent observers list should be populated automatically when an observer is opened, but I imagine you could edit it manually for testing purposes.

12 (edited by jatracy 2021-Feb-22 17:47:22)

Re: Adding Hotkeys

I noticed that the code was already added to support the hotkey when I pulled the project in! Thanks for that!

The added filter for the replay observer works great! It solves that problem.

The hotkey for the ToggleArmCaptureTrigger only seems to toggle the trigger for the active capture window. I.e. - in dual capture mode, it only toggles the trigger for whatever window the mouse is in at the time. Is there a way to make this a “global” trigger?

Thanks again!