1

From this answer I am using this command to extract only components of a (mostly unchanging) video feed which have motion in them:

ffmpeg -i input.mp4 -vf "select=gt(scene\,0.0001),setpts=N/(25*TB)" output.mp4

However, I have found that under certain (e.g. lower) lighting conditions I start seeing a lot of frame capture despite nothing apparently happening in the video. Under these conditions there does seem to be a lot of noise, which I assume is making the total amount of change exceed the threshold. Indeed, if I double the threshold most of this goes away - but still not all of it. However, if I bump up the threshold more, I will start missing actual small motion that I don't want to miss.

My thought was that if the filter first did something to reduce the amount of noise in the scene, perhaps some kind of slight blurring at a resolution of 2-3 pixels, this would eliminate the spurious motion detection and I could detect actual motion on a smaller scale. I see some options to blur, but the documentation on the selection filter doesn't talk about how to use them indirectly, i.e. I don't want the actual output affected, only the scene detection.

Michael
  • 2,614
  • 6
  • 31
  • 51

1 Answers1

0

Have you tried an actual de-noising filter before select in your filter chain?

Something like ffmpeg -i input.mp4 -vf "vaguedenoiser=PARAMS,select=gt(scene\,0.0001),setpts=N/(25*TB)" output.mp4?

Do a search for denoise at https://ffmpeg.org/ffmpeg-filters.html#vaguedenoiser for a few others.

  • would that propogate the filtered frames to the output, or limit it to the scene selecter? – Michael Mar 28 '20 at 01:48
  • well so far i have played around with hard, soft and garrote methods, using strengths from 2 to 10 on a reduced light scene that is capturing 5fps with no movement. the only parameter that has helped at all is threshold=2, garrote which reduced it to 4fps. Not much of an improvement... – Michael Mar 28 '20 at 07:01
  • `unsharp=9:9:-2:9:9:-2` reduces fps from 5 to 3, although it also is blurring the output – Michael Mar 28 '20 at 07:33