Triaging Videos Using VLC's Python Bindings (Shallow Thoughts)

Akkana's Musings on Open Source Computing and Technology, Science, and Nature.

Tue, 08 Aug 2023

Triaging Videos Using VLC's Python Bindings

[Screenshot of video triage program] A few days ago I wrote about finding a way to triage videos by adding captions to mplayer. Better than nothing, but I really wanted something like pho or MetaPho where I could add the tags in the program itself, rather than keeping notes on a piece of paper.

Turns out it wasn't that hard using VLC's Python bindings.

I used TkInter as the GUI toolkit. I've become increasingly frustrated with GTK's incompleteness and lack of documentation, and Qt's updates are chaotic at least on Debian, so I've resolved to try to use TkInter more often. It worked out well. I was able to find several small example scripts showing me different ways to display a video in Tk, either in a window or fullscreen (I never did find a working example for GTK3). And despite not knowing much about Tk, I was never blocked because I couldn't find a way to do something, the way I increasingly am with GTK. The only toolkit-related difficulty I had was trying to figure out Tk's layout methods: Grid vs. Pack: I wanted to use a grid but never did get that to work, but pack worked okay.

The resulting script, vidtriage.py, acts a bit like pho: it plays through all the videos one by one. You can pause/resume with the spacebar, press digit keys 0-9 to mark with a numbered flag, or type d or DEL to add the video to a list of files to be deleted (it doesn't actually delete the files, it just prints the list at the end). Forward and back arrow keys skip to the next or previous video. ESC toggles fullscreen mode, though I haven't tested that very much.

I just used it to triage some crittercam videos and it worked pretty well. If you try it and find bugs or there's a feature you wish it had, drop me a line or open a GitHub issue.

Tags: ,
[ 13:18 Aug 08, 2023    More linux | permalink to this entry | ]

Comments via Disqus:

blog comments powered by Disqus