0

I have a security cam footage, which I'd like to remove all frames from which are don't contain any change. I followed the question and answer on Remove sequentially duplicate frames when using FFmpeg

But my footage has a timestamp as part of the picture, so even if the image itself doesn't change, the timestamp still changes every second.

My idea to ignore the timestamp for the mpdecimate option on ffmpeg:

  1. The original file is called security_footage.mp4
  2. Crop the timestamp away, using IMovie, creates file: security_footage_cropped.mp4
  3. Run ffmpeg -i security_footage_cropped.mp4 -vf mpdecimate -loglevel debug -f null - > framedrop.log 2>&1 to get a log of all frames that are to drop from the file
  4. Somehow apply the log framedrop.log of security_footage_cropped.mp4 to the original file security_footage.mp4.

Question1: Anyone has a good idea how I could do number 3? Apply the mpdecimate filter log onto another video file.

If not, anyone has a good idea how to run mpdecimate with ignoring the timestamp in the top left corner?

Thanks in advance for any help!

Preexo
  • 2,102
  • 5
  • 29
  • 37

1 Answers1

0

I would suggest the following method:

  1. clone the video stream
  2. in one copy, black out the region with the timestamp
  3. run mpdecimate on it.
  4. overlay the other copy on the first one. overlay filter syncs with the first input, so the full clone is only seen when a frame exists for the base input.

ffmpeg -i security_footage.mp4 -vf "split=2[full][crop];[crop]drawbox=200:100:60:40:t=fill,mpdecimate[crop];[crop][full]overlay" out.mp4

A 200x100 black box is drawn with top-left corner at (60,40) from top-left corner of frame.

Gyan
  • 85,394
  • 9
  • 169
  • 201