I have footage shot from a helicopter and I would like to remove the rotor blades. Since the blades are so fast it seems feasible to use the pixel values from the next frame (usually the sky) wherever the rotor appears. So logically, whichever pixel is brighter in frame N and N+1 should be the one to use. I'm using ffmpeg to attempt this and I've tried using "addition" and "Lighten" but the blades are still visible. Lighten does reduce the blades, but I'd really like them to vanish completely.
I've tried using and expression to select the brighter of the two pixels, but it's not giving the results I expected.
-filter_complex "[0:v]format=yuva420p,tblend=all_expr='if(gt(A,B),A,B)'
The result is not perfect, at least not what I'm expecting. I can see a sort of bluish tinge where the shadow has been replaced, but its not the same colour as the pixels I'm expecting. I'm guessing it might be something to do with how the chroma and luma planes are stored, but the blend function doesn't give you that level of detail. There is also a lut2 command, but that doesn't really look like it would work for this.
If my basic idea correct, or have I overlooked something?
maskedmax
filter to do this operation. There are probably other ways too, but this seems reasonably fast. Now I have another issue in that you end up with a ghosted edge around the blades where they catch the sun.ffmpeg -i %MOVIE% -t 5 -itsoffset 0.04 -i %MOVIE% -t 5 -filter_complex "color=0x202020:s=1920x1080:d=24[mask];[mask][0][1]maskedmax=:planes=0xf[out]" -map "[out]" %MOVIEOUT% "
This takes the same file twice, but with the second time offset by 1 frame, to produce two streams. Then creates a blank buffer and uses that to pick which pixels to use.