View Single Post
Old 27th August 2020, 00:16   #1  |  Link
VideoOnTapes
Registered User
 
Join Date: Aug 2020
Location: France
Posts: 6
Recolorization of black and white frames

Hi there,

I'm newbie with AviSynth. I use AviSynth+ 64bit and AvsPmod 2.6.3.4.

I'm looking to restore old VHS recordings where some frames are in black and white.
Something similar to what's been done here: https://www.youtube.com/watch?v=iaUsvKDQycg

I figured out how to do it with MergeChroma() :

Code:
frame_number_with_good_colors = 128
good_frame= clip.Trim(frame_number_with_good_colors,1)

# Apply MergeChroma for frames with bad chroma (AverageChromaU() < 120)
# Apply MergeChroma for frames in black and white (vPlaneMedian() = 127 or 128)
copy=clip
chromed=MergeChroma(clip, good_frame)
clip=ConditionalSelect(clip,"v_median=vPlaneMedian()"+chr(13) \
+ "av_chromaU=AverageChromaU()"+chr(13) \
+"(v_median==128 || v_median==127)?1:(av_chromaU<120?1:0)", copy, chromed)
What I'd like to do is use the color values from the last frame that is correct.
To do this, I need to store the number of this correct frame, as it has to be reused until a new frame with correct colors is found.

However, I can't store the current_frame value in a variable. Could you help me on this point?

Also, I tried to write this value to a file:

Code:
clip = clip.WriteFile("variable.txt", "current_frame")
but it doesn't work for me :
Quote:
Script error: Invalid arguments to function 'WriteFile'

NB: The video I'm working on (as a test basis) is this one:
https://www.youtube.com/watch?v=rX0r6WbiutU
VideoOnTapes is offline   Reply With Quote