Opened 7 years ago

#2563 new enhancement

selection and x11grab

Reported by: ubitux Owned by:
Priority: wish Component: avdevice
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


A common use case of x11grab input device is to record a window, or a screen selection.

Recording a window can be achieved with a script such as:

☭ cat

if [ $# -lt 1 ]; then
    echo "usage: $0 [output options] <output>"
    exit 1

w=$(echo "$win_info" | grep 'Width:'       | awk         '{print $2}')
h=$(echo "$win_info" | grep 'Height:'      | awk         '{print $2}')
x=$(echo "$win_info" | grep 'Absolute.*X:' | awk -F': *' '{print $2}')
y=$(echo "$win_info" | grep 'Absolute.*Y:' | awk -F': *' '{print $2}')
cmd="ffmpeg -f x11grab -show_region 1 -draw_mouse 1 -s ${w}x${h} -r 24 -i :0.0+$x,$y $*"
echo "=> $cmd"
eval $cmd

I was willing to add such script to the wiki, but actually it might be more relevant to just add a -x11select option in the x11grab indev, allowing a more advanced selection. Basically, exactly the same as scrot -s (screenshot command line tool). The user then do a screen selection, or clic on a window.

Change History (0)

Note: See TracTickets for help on using tickets.