The GetDPI Photography Forum

Great to see you here. Join our insightful photographic forum today and start tapping into a huge wealth of photographic knowledge. Completing our simple registration process will allow you to gain access to exclusive content, add your own topics and posts, share your work and connect with other members through your own private inbox! And don’t forget to say hi!

Automatically / Programatically Remove Bad Frames from Video.

AustinPass

New member
I have a load of time-lapse videos created from some cheap IP cameras that look like this:

https://drive.google.com/file/d/1hp2i0l4Msq2BdgVidE08iwUiW38R_BBE/view?usp=sharing_eil&ts=5d126f03

They're cool, and very effective, but due to the cheapness of the cameras, the effects of a harsh winter and the poor ADSL broadband at the remote location there are lots of corrupted frames. Is there a way to programatically remove or drop the corrupted frames? I was wondering if there was a way of checksumming the frames, and then removing anything that was outside of an accepted "range" of values. For example, if 40%+ of the frame was pink, then it would clearly be outside of the expected range.

As there's no accompanying audio, it wouldn't cause an issue for loss of sync in this regard. If it helps, the cameras/software produce accompanying JPG's for every frame in the video, so if it were easier to look at each of these JPG's and delete the corrupted ones before re-combining into a video then that would be possible to do.

Any ideas?
 

dougpeterson

Workshop Member
I have a load of time-lapse videos created from some cheap IP cameras that look like this:

https://drive.google.com/file/d/1hp2i0l4Msq2BdgVidE08iwUiW38R_BBE/view?usp=sharing_eil&ts=5d126f03

They're cool, and very effective, but due to the cheapness of the cameras, the effects of a harsh winter and the poor ADSL broadband at the remote location there are lots of corrupted frames. Is there a way to programatically remove or drop the corrupted frames? I was wondering if there was a way of checksumming the frames, and then removing anything that was outside of an accepted "range" of values. For example, if 40%+ of the frame was pink, then it would clearly be outside of the expected range.

As there's no accompanying audio, it wouldn't cause an issue for loss of sync in this regard. If it helps, the cameras/software produce accompanying JPG's for every frame in the video, so if it were easier to look at each of these JPG's and delete the corrupted ones before re-combining into a video then that would be possible to do.

Any ideas?
You could do this with AppleScript and Capture One (here's our kit for getting started, or you can try googling around for free info to get started). I'd suggest by picking several (7? 15?) RGB pickers, and taking a moving average (probably median) of 15-30 frames and then flagging images where 1/3rd or more of the pickers are more than X% (30%?) brighter or darker than that median. We do vaguely similar (but more involved) in our DT Time Lapse Editor software that stabilizes and batch edits high-end time lapse footage. You could also use the Exposure Evaluation (average total scene brightness) but it would be less robust.

But it would be a TON of work. At least several hours of coding assuming you already have a background in programming. As brutal as it is, you might well be better off manually going through the footage one JPG at a time in Capture One or Bridge or Photo Mechanic or LR.

A big advantage of doing it this way vs other programming libraries is that you'd see the result of your work visually immediately.

Doug
 
Top