1

first let me thank you for this amazing software.
I've learned about it during a trainer seminar and will definitely include it in my trainings.

I really like the feature for audio triggerd capture but want to place the following feature requests for it. (version 0.9.5 on Windows 10)

  • 1:
    for our sports (traget shooting), it would be nice to have the option to only capture one single picture instead of starting a video.
    This question was already raised earlier in an 0.9.1-thread: https://www.kinovea.org/en/forum/viewto … 4297#p4297 (so I'm not the only one thinking about it)

    I could think of two radio buttons to select what action should be triggerd, start video or save image. Other setting wouldn't be touched.

    (actually I can stop the video after about 0.05 s, to only get a few frames recorded, but I still have to extract single pictures afterwards.)

  • 2:
    I would prefer to have the audio trigger to be "disarmed" when opening a new screen capture window, even if the general automation setting is enabled in the preferences.
    This way, one can make the necessary configurations without disturbance of an accidentially triggered recording. Once everything is being set, oen can arm the trigger with the speaker symbol.

  • 3:
    In a somewhat noise environment, I find the settable threshold a bit too low and beeing reached to often. Maybe the settable range can be increased e.g. 0-100?
    Of course, probably I need to decrease the input gain of my microphone (haven't that yet) to adjust the range. But then, it would also be nice to have this option to set the microphone gain from within kinovea instead of doing it system-wide from the OS-audio settings.



What do you and others think?

2

I like these suggestions.

For the first one though I think this option would have to go in the general preferences, there is already a lot of stuff going on in the screen UI.

For the last one I don't think I can do anything, the range is a mapping of what the microphone API is providing, so I'm already getting a number between 0..1 that is (log) mapped to the range seen in the user interface. So there is nothing "above" the max number, it's where the mic is clipping.

3 (edited by sam711 2022-02-14 00:15:05)

joan wrote:

I like these suggestions.

I'm happy to hear smile

joan wrote:

For the first one though I think this option would have to go in the general preferences...

For me not. As suggested, I would look for that switch between video-recording and save image in the capture\automation tab. Because it just selects what action should happen when the trigger is met.

I don't know how the things are implemented and I have only basic coding knowledge, but I guess there are already two methods for the functions <recording> and <save-image>, e.g. something like "record.start()" and "image.save()". Then the actionhandler of the audio-trigger would just need to select the correct method according to the radio-buttons (switch) in the automation tab.
All other parameters (like file formats and paths) are already present, because the two functions are still available for manual excecution.
Maybe inactivate the recording-specific parameters (stop recording, post recoding command), when the switch is to save.image.


joan wrote:

For the last one I don't think I can do anything, the range is a mapping of what the microphone API is providing, so I'm already getting a number between 0..1 that is (log) mapped to the range seen in the user interface. So there is nothing "above" the max number, it's where the mic is clipping.

I see. So one has to level down the microphone gain by the Windows sound settings. I've tested it, it works to some extend.
So for convenience, a button which opens the Windows microphone settings would be great. Or you may add such a hint in the help documentation. Something like: "if the microphone is too sensitive or the environment is too noisy, try to decrease the microphone gain from the OS sound settings."

4

sam711 wrote:

For me not. As suggested, I would look for that switch between video-recording and save image in the capture\automation tab. Because it just selects what action should happen when the trigger is met.

Yes, I meant the same. I just wanted to say that it won't be a live switch directly in the screen UI (like the arm/disarm button for example), but it will be away in the preferences.

It shall look like this:

https://www.kinovea.org/screencaps/0.9.6/096-trigger-action.png

I made it into a list as there might be other actions we could trigger through this mechanism.

5

In the meantime you could use the ability of Kinovea to call an external program after each recording, which is a great and versatile feature of Kinovea.

It can be found under: Options/Automation/post recording command

To extract an image frame from the video at a selected time position, ffmpeg.exe may be used in conjunction with a „batch“-file (windows files having the extension „bat“, serving as a simple command processor).

See below the content of a batch-file named EFsecond.bat (ExtractFrame using seconds)
The batch-file contains a final command using ffmpeg to extract an image frame out of a video.

To use this batch file you might:
- download FFMpeg and install to a directory (in the example: d:\ffmpeg\bin\ffmpeg.exe)?Go to ffmpeg.org and search for „Get packages & executable files“ to download an actual version compiled for windows. FFmpeg is free of charge.?if a different installation-directory is used, modify the line „set ffmpegexe=…“ in the batch-file according to the full path of your ffmpeg.exe - location
- Create a directory to contain the batch-file (in the example: d:\batch)
- Create a file that is named EFsecond.bat and copy the lines below to it.?Create a directory (your directory) the extracted images should be saved (in the example: c:\images)?set this value to the line: set targetdir=„your directory“?(do not use quotation marks or spaces after the „=„ and be sure the directory exists?Save the file. Be sure that the extension of the file is „bat“
- Open your Kinovea instance and go to the inputfield „post recording command“ in options
- Type in: d:\batch\EFsecond.bat %directory %filename s.ms?(s.ms means: second.milliseconds, i.e. 1.5 to extract the frame at the position 1.5 seconds. Use a DOT, not a Comma as decimal separator)

Now, after each recording, an image frame is extracted from the video and store in the image directory. Naming of the image is: SourceVideo.ext.JPG.
The batch-file may be modified to further needs.

Reiner


Some hints on Framerate in relation to the target frame to extract:
To extract a specific frame, you could calculate the seconds from the target frame.
Example: The resulting video has a frame rate of 120. So each frame „consumes“ a time of 1/120 seconds = 0.00833 seconds. To extract the 255. frame of the video, the time-value has to be 255*0.00833 = 2.124 seconds.

If you use a higher frame rate take into account the framerate-replacement feature of Kinovea. It is defined in the settings (Options/Capture/Recording):
Example: A Video is recorded using 200 fps for 2 seconds. FPS-replacement is set to 30 fps. FFmpeg will see the resulting video as a video having 30fps with a duration of (200/30 * 2.0) 13.3333 seconds. To catch a frame at the „real“ position of 1.5 seconds, a value of 1.5 * 200/30 has to be used: 10 seconds.
Dropped frames are not taken into account here. Furthermore, the exact target frame may not always be at the same location inside the movement due to some microseconds delay to the sound trigger.


Content of EFsecond.bat:

@echo off
REM ===== Extract an image frame out of a video at a specified time location (seconds.milliseconds)
REM ===== Example used in Kinovea/Options/Automation/post recording command:
REM =====    d:\Batch\EFSecond.bat %directory %filename 1.0
REM ===== Parameters in use
REM %1 contains directory, Kinovea: %directory
REM %2 contains filename, Kinovea: %filename
REM %3 timeposition to extract frame, if omitted uses 0.0 (first frame)
REM ===== Modify these parameter-values according to your setup
set ffmpegexe=d:\ffmpeg\bin\ffmpeg.exe
set targetdir=C:\images
set timepos=0.0
IF "%3"=="" GOTO Final
set timepos=%3
:Final
%ffmpegexe% -y -ss %timepos% -i %1\%2 -frames:v 1 %targetdir%\%2.jpg

6

sorry for the number of questions-marks (Don't know where they come from). They should be replace by a space.

7

joan wrote:

It shall look like this:
I made it into a list as there might be other actions we could trigger through this mechanism.

Perfect, very nice! Thank you.



Reiner wrote:

In the meantime you could use the ability of Kinovea to call an external program after each recording, which is a great and versatile feature of Kinovea.

It can be found under: Options/Automation/post recording command

To extract an image frame from the video at a selected time position, ffmpeg.exe may be used in conjunction with a „batch“-file (windows files having the extension „bat“, serving as a simple command processor).

Thank you Reiner, for this suggestion and script.
To prevent the images to get the same names and/or overwritten, I would even add a timestamp to the filename.

Therefore, adding this line to define another variable (timestamp as YYYYMMDD-hhmmss):

set timestamp=%date:~6,4%%date:~3,2%%date:~0,2%-%time:~0,2%%time:~3,2%%time:~6,2%

and then add it to the filename in the ffmpeg call:

%ffmpegexe% -y -ss %timepos% -i %1\%2 -frames:v 1 %targetdir%\%2-%timestamp%.jpg

8

nice solution, have never seen this function. Thanks