Sunday, 31 May 2020

recordmydesktop script

I've used recordmydesktop for grabbing the few desktop videos I need.

It's useful to record a specific window. This requires knowing the window ID beforehand, acquired by using xwininfo.

Remembering and executing this phase is sometimes a bit annoying, so I tried to shorten the process a bit by using the following script. I guess a front-end exists somewhere, though.

After running it, xwininfo is indeed launched but the info is directed through grep to a temporary file. I click on the window I want to record, the output is parsed so that the window ID is passed onto recordmydesktop.

It could be bit more elegant but what do I care.


#!/bin/bash
echo Click on Window
echo WILL RECORD INSTANTLY
echo using fps 30
xwininfo -display :0 | grep "id:" > temp.txt
more temp.txt | grep -Eo '0x[0-9]+' > temp2.txt
fname=$(<temp2.txt)
echo $fname
rm temp.txt
rm temp2.txt
recordmydesktop --windowid=$fname --fps 30


I noted that on occasions at least Chromium browser window refuses to work (unrelated to script I think). Recordmydesktop had trouble with the acquired window ID. First I thought it might have to do with detached tabs, but not really. Sooo... maybe just run another instance of it and try again or something.

1 comment:

  1. Shorter, but might blow up under unfortunate situations: recordmydesktop --windowid=`xwininfo -display :0 | grep "id:" | grep -Eo '0x[0-9]+'` --fps 30

    ReplyDelete