replace black frames with previous frames I have problematic footage from diving due to my camera/SD card - every 4th or so frame is just black, and I want to replace all those black frames with either an interpolation between the previous and next frame or just duplicate the previous frame. 

I found this question "remove black frames from vob files with ffmpeg", but I don't want to cut out the frames but instead want to interpolate between the two frames or duplicate the previous frame. 

I think I might be able to get all the relevant positions with the black-frame filters etc, but what kind of actions would I use to replace those frames with an interpolation or a duplicate of the previous frame in a fully automatic way (so I only pass my movie file into the script)? 

All I've found so far is the "shuffleframes" method, which I could somehow (how?) feed with the position of the black frames and then thereby duplicate the previous frame.

Demo footage detailing the probem can be found here.
It's possible to have the black frames removed and earlier frames duplicated.

ffmpeg -i in.mp4 -vf blackframe=0,metadata=select:key=lavfi.blackframe.pblack:value=50:function=less -vsync cfr -c:a copy out.mp4


The blackframe filter analyses and registers the proportion of a frame's pixels which are black. The metadata filter keeps all frames which have at most 50% of pixels black. The removed frames create a gap in the video stream. So by setting the video sync method to constant frame rate, ffmpeg duplicates earlier (non-black) frames to fill in those gaps.

You'll have to experiment with the metadata selection value 50 to get the right threshold.