A
A
akimdi2020-05-13 02:55:24
linux
akimdi, 2020-05-13 02:55:24

How to pass coordinates to capture video from X server interactively to ffmpeg?

I borrowed the command from here.

ffmpeg -f x11grab -s $(slop --noopengl --format "%w"x"%h") -r 60 -i :0.0 -qscale 0 -vcodec huffyuv $(date +"%d.%m.%Y_%H:%M:%S").avi

but this only works if there are no indents during recording, that is, in other words, the entire screen is recorded. Screen Position Offset For example, by specifying "-s 800x600 -i :0.0+200,100" you can write an 800x600 block with an offset of 200x100 from the top left corner of the screen.

More or less like this:
ffmpeg -f x11grab -s 800x600 -r 60 -i :0.0+200,100 -qscale 0 -vcodec huffyuv $(date +"%d.%m.%Y_%H:%M:%S").avi

Tell me how to make it so that you can interactively select with the mouse using the same slop and then transfer these coordinates to ffmpeg.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SOTVM, 2020-05-13
@akimdi

try xrectsel
under ffmpeg finished it yourself

as an example: a script that writes a gif using byzanz-record

#!/bin/bash

NAME="$(date +%d.%m.%Y_%H%M%S).gif"

DEFAULT_DURATION=10

echo -ne "Select area which will be recorded" 

AREA="$(xrectsel)"
IFS=+ read DIM X Y <<< $AREA
IFS=x read W H <<< $DIM

echo ""

#read -p "Enter recording duration in seconds: " USERDUR

# Duration and output file
if [ $USERDUR -gt 0 ]; then
    DURATION=$USERDUR
else
    DURATION=$DEFAULT_DURATION
fi

echo "$DURATION sec. Recording has started..." 

byzanz-record --cursor --duration=$DURATION --x=$X --y=$Y --width=$W --height=$H /tmp/"$NAME"

echo "Recording has ended."
if [ -f /tmp/"$NAME" ]; then
    xviewer /tmp/"$name"
fi

byzanz-record also writes videos ogg, ogv, webm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question