MLV-App icon indicating copy to clipboard operation
MLV-App copied to clipboard

Corrupt frame detection and replacement

Open masc4ii opened this issue 5 years ago • 13 comments

When using ML cameras near to the edge of maximal write speed, we get here and there corrupted frames (mostly half of the frame is pink). It should be possible to detect such frames. In a first version we could manually select such bad frames.

Another task would be to replace such corrupted frames with:

  • the previous frame
  • the following frame
  • a blended frame ((previous+following)/2)
  • a synthetic frame (optical flow)

masc4ii avatar Jul 20 '19 18:07 masc4ii

Hmm very exciting idea

ilia3101 avatar Jul 21 '19 19:07 ilia3101

I think corrupt frame replacement should be done inside mlvObject, so it can be treated the same from outside when requesting a frame to process. @bouncyball-git as you have worked on that part of mlv app a lot, do you approve?

ilia3101 avatar Jul 21 '19 19:07 ilia3101

Discovery and replacement of the corrupted frames at the RAW level, I guess, is applicable only for:

"the previous frame" and "the following frame" Well... may be for blended frame as well but not for optical flow.

As you understand most Important thing here is the reliable discovery alg.

bouncyball-git avatar Jul 22 '19 06:07 bouncyball-git

I 100% agree. Optical flow should work after debayering only. If we would like to export as DNG / MLV dublicating one frame is easiest, blending could also work.

masc4ii avatar Jul 22 '19 07:07 masc4ii

Oh yeah optical flow would not be possible then :/

ilia3101 avatar Jul 22 '19 13:07 ilia3101

But never mind... I checked some sources for optical flow: yes, very nice (I don't understand anything).

masc4ii avatar Jul 22 '19 14:07 masc4ii

Actually we could do optical flow before debayer - split the image in to four: R G1 G2 and B, then optical flow on each one. Though it may generate some grain or pixel pattern oddness. It would be an interesting idea to try. Also may be faster than doing it after debayer.

Those frames should also be cached, as it would not be quick (I assume).

ilia3101 avatar Jul 22 '19 20:07 ilia3101

If you have a look here, there are several optical flow implementations. https://www.ipol.im/ It is indeed very interesting!

masc4ii avatar Jul 23 '19 13:07 masc4ii

I am all for this idea actually. Especially on the optical flow for each R G1 G2 & B splitted images re: corrupted frames. Should be doable. :) On Tuesday, July 23, 2019, 6:36:03 AM PDT, masc4ii [email protected] wrote:

If you have a look here, there are several optical flow implementations. https://www.ipol.im/ It is indeed very interesting!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

DeafEyeJedi avatar Jul 23 '19 17:07 DeafEyeJedi

Yes, interesting. But I don't know yet what to do with that code. On this page you can try out (life) the algorithms. I find anything else but not the interpolated picture...

masc4ii avatar Jul 23 '19 18:07 masc4ii

This idea is really good and important. FFmpeg wise it should be possible to output someting even if frames are missing here and there. Some links: http://paulherron.com/blog/forcing_keyframes_with_ffmpeg

https://stackoverflow.com/questions/50546359/ffmeg-force-keyframe-at-specific-interval

https://superuser.com/questions/908280/what-is-the-correct-way-to-fix-keyframes-in-ffmpeg-for-dash/908706#908706

dannephoto avatar Jul 31 '19 07:07 dannephoto

Some more interesting links: https://forum.videohelp.com/threads/381679-Finding-individual-bad-frames-in-video-and-save-frame-number-or-repair#post2470118

https://forum.videohelp.com/threads/381679-Finding-individual-bad-frames-in-video-and-save-frame-number-or-repair#post2470175

https://video.stackexchange.com/questions/23589/replace-black-frames-with-previous-frames

dannephoto avatar Aug 01 '19 06:08 dannephoto

Plus 1 for such a feature.

My use case is when using MLV App to process for stills photography, for example averaging an MLV to simulate a long exposure.

With no audio to worry about, ‘all’ one would need to do would be to delete the corrupted frame, ie no continuity issues.

But, of course, I realise this app is mainly for videographers ;-)

pigeonhill avatar Nov 24 '19 21:11 pigeonhill