This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Automatically remove "black frames"
#1
right now after processing a footage with Hybrid .. i need to use a Linux script (FFMPEG + blackdetect  filter) to cut in pieces the clip removing the black frames interruptions (i use a blackmagic intensity PRO that generate BLACK frames when the signal is too much "noised" ) and after that i need to merge all these parts to create an output without any BLACK frame..

is possible to used the "blackdetect" filter or something similar on Hybrid to AUTOMATICALLY remove all black frames from footage? (or maybe <5% black frames)

thank you!
Reply
#2
No, Hybrid has no filter which would:
a. remove black frames
and
b. cut the audio to keep the source sync


Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#3
thank you Cu Selur  Smile
Reply
#4
Cu = see you
Selur <- the Name Smile
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#5
Can you share a small sample of such a clip (with the black frames)?
I suspect that one could use something like:
def replace_low_luma_frames(clip, threshold): # Calculate average luma for each frame luma = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY) avg_luma = core.std.PlaneStats(luma) # Create a mask of frames with luma below the threshold low_luma_mask = core.std.Expr(avg_luma, f'x {threshold} <') # Get frame before for replacement frame_before = core.std.Trim(clip, 0, clip.num_frames - 1) # Replace frames with low luma using frame_before replaced = core.std.MaskedMerge(clip, frame_before, low_luma_mask) return replaced clip = replace_low_luma_frames(clip, 30)
(code is untested, not totally sure whether it works Wink)
to replace each frame which luma is below 30 (or lower) with the frame before it.
Assuming there are only single black frames in the soure and thus singe duplicates that one could use 'FillDrops' to replace the inserted duplicates with interpolated frames.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#6
try it - pulldown="telecine" or "interpolation"

+ tune: Grain or PSNR or SSIM
Reply
#7
OMG very thank you helping me!
here a small interlaced sample: www.wcn.it/black.avi

i have a lot of old footages with these black frames (generated by the blackmagic intensity pro card) (there are more than 1 black consecutive frames BTW.. in the sample maybe not.. but there are)

here there are a lot of black "zones" : www.wcn.it/black2.avi
Reply
#8
Okay, here's what you can do.
  • Start Hybrid
  • load clip
  • set 'Filtering->(De-)Interlace/Telecine->Overwrite input scan type to' to 'top field first'
  • optional: enable 'Filtering->(De-)Interlace/Telecine->QTGMC Vapoursynth->Bob'.
  • go to 'Filtering->Vapoursynth->Custom->Insert Before' set it to 'FillDrops', enable the text box below it.
  • in this custom section you now enter:
    # replace a black frames with last frame that was not black def ReplaceBlackFrames(clip, thresh=0.1, debug=False): core = vs.core if not isinstance(clip, vs.VideoNode): raise ValueError('This is not a clip') def selectFunc(n, f): if f.props['PlaneStatsAverage'] > thresh or n == 0: if debug: return core.text.Text(clip=clip,text="Org, avg: "+str(f.props['PlaneStatsAverage']),alignment=8) return clip toReplace = n for i in range(n)[::-1]: if clip.get_frame(i).props['PlaneStatsAverage'] <= thresh: continue # remove current replace with frame before start = core.std.Trim(clip, first=0, last=n-1) r = core.std.Trim(clip, first=i, last=i) end = core.std.Trim(clip, first=n+1) replaced = start + r + end break if debug: return core.text.Text(clip=replaced,text="Replaced, avg: "+str(f.props['PlaneStatsAverage']),alignment=8) return replaced clip = core.std.PlaneStats(clip) fixed = core.std.FrameEval(clip, selectFunc, prop_src=clip) return fixed clip = ReplaceBlackFrames(clip, thresh=0.1, debug=False)
    If you now look at the Vapoursynth Preview all black frames should be replaced with the last non-black frame.
  • optional: if there were no multiple black frames in a row, enable 'Filtering->Vapoursynth->Misc->FillDrops', this will then replace the duplicate with an interpolated version.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply
#9
OMG!!! very very very thank you!!!
Reply
#10
Happy that helped, note that this will only work on clips that do not start with black frames.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Offline between (including) 29th of June and 5th of July => RochHarz Festival
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)