I'm overlaying my camera video on a screencast. Is there anyway to remove the background (like how zoom etc do it live) using ffmpeg and filter?

Here is the command I use now:

screencap() {
  file=`date +%Y-%m-%d-%H.%M.%S`
  ffmpeg -f alsa -i pulse -f x11grab -thread_queue_size 64 -i :0.0 \
    -i /dev/video0 -video_size 128x72 \
    -filter_complex '[2]scale=iw/2:-1[cam];[1][cam]overlay=main_w-overlay_w:main_h-overlay_h' \
    -framerate 60 -preset ultrafast ~/Videos/screencast-${file}.mp4


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.