[vlc-devel] Hot keys to log timestamp parts of video

Steve Lhomme robux4 at ycbcr.xyz
Tue Mar 8 08:42:47 UTC 2022


On 2022-03-07 21:19, John Hammer wrote:
>  > You mean visually?
> 
> Yes. Basically while watching the video pressing the key manually should 
> log timestamps to a file. There will be 2 keys one for start timestamp 
> and one for end timestamp. The goal is to log the timestamps of 
> interesting parts of the video for external processing.
> 
>  > There are time events reported by the core that you can hook into to 
> know where you are.
> 
> I could modify the Qt GUI module and could listen to the key presses. 
> The following is the patch that works. Where is the time event hook? 
> Does this mean I have to store the keypress event for later processing 
> in the time hook event?

In libvlc there are 2 events: libvlc_MediaPlayerPositionChanged and 
libvlc_MediaPlayerTimeChanged. But if you use VLC directly it's not much 
use. They correspond to INPUT_EVENT_POSITION in Qt (on 3.0).

It ends up doing
emit positionUpdated( f_pos, i_time, i_length / CLOCK_FREQ );



> diff --git a/modules/gui/qt/main_interface.cpp 
> b/modules/gui/qt/main_interface.cpp
> index a57506533d..cd1ebad916 100644
> --- a/modules/gui/qt/main_interface.cpp
> +++ b/modules/gui/qt/main_interface.cpp
> @@ -28,7 +28,7 @@
>   #endif
> 
>   #include "qt.hpp"
> -
> +#include <QDebug>
>   #include "main_interface.hpp"
>   #include "input_manager.hpp"                    // Creation
>   #include "actions_manager.hpp"                  // killInstance
> @@ -72,6 +72,7 @@
> 
>   #include <QTimer>
> 
> +
>   #include <vlc_actions.h>                    /* Wheel event */
>   #include <vlc_vout_display.h>               /* vout_thread_t and VOUT_ 
> events */
> 
> @@ -1612,6 +1613,17 @@ void 
> MainInterface::dragLeaveEvent(QDragLeaveEvent *event)
>    ************************************************************************/
>   void MainInterface::keyPressEvent( QKeyEvent *e )
>   {
> +    switch (e->key()) {
> +    case Qt::Key_End:
> +    case Qt::Key_1:
> +      qDebug()<<e<<" start timestamp \n";
> +      break;
> +    case Qt::Key_PageDown:
> +    case Qt::Key_2:
> +      qDebug()<<e<<" end timestamp \n";
> +      break;
> +    }
> +
>       handleKeyPress( e );
> 
> Thanks,
> John
> 
> On Mon, Mar 7, 2022 at 2:02 PM Steve Lhomme <robux4 at ycbcr.xyz 
> <mailto:robux4 at ycbcr.xyz>> wrote:
> 
> 
> 
>     On 2022-03-05 19:01, John Hammer wrote:
>      > Hi,
>      >     I want to retrieve the start and end timestamp of parts of
>     the video
>      > for post-processing with an external program. Since Lua extension
>     does
> 
>     You mean visually ? There are time events reported by the core that you
>     can hook into to know where you are.
> 
>      > not support keybindings, I have decided to modify the source code. I
>      > could compile the 3.x branch and debug the qt module interface.
>     It looks
>      > like this in the keypress event callbacks of this module is where
>     the
>      > code to log the timestamps should go.
>      >
>      >      Am I on the right track on implementing this feature or is
>     there
>      > any other way?
>      >
>      >     I also would like to color the areas on the time slider where
>     the
>      > start and end timestamps occurred. I have no idea how to achieve
>     this.
>      > Any suggestions on which module to be changed to achieve this?
> 
>     If you want to change the UI you have to modify the Qt gui module/
> 
>      > --
>      > Thanks,
>      > John
>      >
>      > _______________________________________________
>      > vlc-devel mailing list
>      > To unsubscribe or modify your subscription options:
>      > https://mailman.videolan.org/listinfo/vlc-devel
>     <https://mailman.videolan.org/listinfo/vlc-devel>
>     _______________________________________________
>     vlc-devel mailing list
>     To unsubscribe or modify your subscription options:
>     https://mailman.videolan.org/listinfo/vlc-devel
>     <https://mailman.videolan.org/listinfo/vlc-devel>
> 
> 
> 
> -- 
> Regards
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list