Reputation: 55
I have a 60 FPS screen recording of a significantly slower, variable frame rate, video. It is supposed to, however, be constant frame rate.
Fortunately, frame numbers are present in a fixed area of the screen. Within that area, the only time anything changes is when the frame number changes.
(There are sometimes changes between frames - in other parts of the frame - that I would like mpdecimate to ignore. Those changes, however, never appear in the frame count zone.)
Is there a way that I can tell mpdecimate to only evaluate that small 'frame counting' portion of the frame in determining whether sequential frames are duplicates?
Thank you.
Upvotes: 1
Views: 1402
Reputation: 93251
The basic method here is to clone the input stream, paint over the undesired portion of the frame with a solid color in one of the copies, run mpdecimate filter, then overlay the untouched copy on top of the de-duplicated copy.
Assume the bottom bar is static except for the frame counter and occupies the bottom 5% of height. drawbox will draw a white box over the top 95% of the frame.
ffmpeg -i in -vf "split=2[full][masked];[masked]drawbox=w=iw:h=ih*0.95:x=0:y=0:t=fill:c=white,mpdecimate[deduped];[deduped][full]overlay=shortest=1" -vsync vfr -c:a copy out
Upvotes: 2