[FFmpeg-user] backgroundkey filter

Paul B Mahol onemda at gmail.com
Wed Jun 19 13:03:11 EEST 2024


On Wed, Jun 19, 2024 at 1:54 AM Erik Beck <bacon at tahoma.com> wrote:

> Hi all,
>
> I'm having conceptual issues using the backgroundkey filter.
>
> Is it intended to take a still image of a static background and remove
> it from a video stream? If so, I could use help with the filter syntax.
> If not, I need to be set straight.
>

backgroundkey filter uses single input only video stream and produces
single output only video stream,
and uses also scene detection to update alpha mask, this is controlled by
the filter threshold option.

Demo:

ffmpeg -i https://media.xiph.org/video/derf/y4m/bowing_cif.y4m -vf
"backgroundkey=threshold=0.2:similarity:0.02[v];color=s=cif:c=lime[c];[c][v]overlay=format=yuv422,format=yuv422p"
out.y4m


The more trivial, rudimentary technique, taking single still image of
supposed background and produce alpha mask with combination of input video,
is also possible, but not with backgroundkey filter, instead using several
different video filters in non-trivial combination...



>
> Thanks!
>
> Erik
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list