[FFmpeg-user] Using ffmpeg to blur moving objects

Boris T boris.t.richard at gmail.com
Mon Oct 31 16:23:27 EET 2016


Yes, I already have the moving objects' coordinates (x, y values, the box's
width and height, as well as the duration of the blur). I only need to use
ffmpeg to blur that object in the video according to the provided
coordinates. I have a working solution, but it becomes very slow the more
blurred overlays I have.

This is what I've tried with sendcmd to see if it could improve performance:

ffmpeg -i "input.mp4" -filter_complex
[0:v][fg]overlay=60:30[v]" -map "[v]" -y ouput.mp4

Contents of cropmask.cmd:

1-2 [enter] crop w 20,
  [enter] crop h 20,
  [enter] crop x 50,
  [enter] crop y 50,
  [enter] overlay x 50,
  [enter] overlay y 50;
2-3 [enter] crop w 20,
  [enter] crop h 20,
  [enter] crop x 150,
  [enter] crop y 150,
  [enter] overlay x 150,
  [enter] overlay y 150;

The problem is that it applies the new box blur inside the old box blur
(i.e. the original blur is 100 x 100, the blur from second 1 to second 2
becomes 20x20 but the original blur remains at 100x100 although it also
moves according to the new x,y values). I believe this is because ffmpeg
does a first pass to generate the crops before applying the overlays? Also
the original blur image becomes "static" (i.e. it is a static blurred image
moving around).



On Mon, Oct 31, 2016 at 6:22 AM, Nicolas George <george at nsup.org> wrote:

> Le decadi 10 brumaire, an CCXXV, Paul B Mahol a écrit :
> > Short story: AFAIK it is not currently possible to track specific
> > moving object with FFmpeg.
> I think Boris already has the coordinates of the objects and only needs
> a way to inject them in FFmpeg.
> It seems boxblur can not change its coordinates on the fly. The best
> course of action would be to implement process_command() for it, and it
> would probably not be that hard.
> Without changing the code, since crop and overlay support
> process_command(), using them to isolate the part of the image to apply
> boxblur seems a workable solution, and sendcmd can do that. We do not
> have enough information to know why it failed.
> (Please trim your quotes.)
> Regards,
> --
>   Nicolas George
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://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