0

I'm trying to record a video using ffmpeg from two inputs: webcam (v4l2) and desktop (x11grab). I checked that both inputs are working fine:

ffmpeg \
    -f x11grab -s 1920x1080 -r 25 -i :0.0 \
    -vcodec libx264 x11.mkv
ffmpeg \
    -f v4l2 -s 960x540 -r 25 -i /dev/video0 \
    -vcodec libx264 v4l.mkv

but when I try to use both, only x11grab goes to output:

ffmpeg \
    -f x11grab -s 1920x1080 -r 25 -i :0.0 \
    -f v4l2 -s 960x540 -r 25 -i /dev/video0 \
    -vcodec libx264 test.mkv

Is it possible to merge these inputs into single output file and specify the position for video from webcam (move it to right bottom)?

1 Answer 1

1

You need to use the overlay filter within a filtergraph.

ffmpeg \
    -f x11grab -video_size 1920x1080 -framerate 25 -i :0.0 \
    -f v4l2 -video_size 960x540 -framerate 25 -i /dev/video0 \
    -filter_complex "[0][1]overlay=x=W-w:y=H-h" \
    -vcodec libx264 test.mkv

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .