video_m wrote: ↑Mon Jan 10, 2022 5:39 pm
Hello Frank,
the key stays black.
Thanks for the insight, now I know exactly what you mean: you wanna color the image with green using the transparency layer.
I came up with the right script for you:
Code: Select all
#Indexing
FFMpegSource2("Wvd3_clean.mov", atrack=-1)
#Getting rid of evil frame properties
propClearAll()
#Keeping the alpha channel
ConverttoRGB32()
#Collecting data
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
#Substituting the alpha channel with a custom image
mk=ExtractA().ConverttoRGB32()
bg=ImageSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\green_screen_sample.png", fps=my_framerate, start=0, end=my_frames, pixel_type="RGB32").Spline64Resize(my_width, my_height)
top=last.Mask(mk)
Layer(bg, top)
#Going to 4:2:2 planar
Converttoyv16()
in FFAStrans, this would be:
Code: Select all
#Keeping the alpha channel
ConverttoRGB32(m_clip)
#Getting rid of evil frame properties
propClearAll()
#Collecting data
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
#Substituting the alpha channel with a custom image
mk=ExtractA().ConverttoRGB32()
bg=ImageSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\green_screen_sample.png", fps=my_framerate, start=0, end=my_frames, pixel_type="RGB32").Spline64Resize(my_width, my_height)
top=last.Mask(mk)
Layer(bg, top)
#Going to 4:2:2 planar
m_clip=Converttoyv16()
return m_clip
and this will achieve the right result, so from this:
to this:
and as I always say: anything is possible with Avisynth eheheheheeh
if you want to keep audio, you need:
Code: Select all
#Keeping the alpha channel
ConverttoRGB32(m_clip)
#Getting rid of evil frame properties
propClearAll()
#Collecting data
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
my_audio_channels=AudioChannels()
my_audio=GetChannels(my_audio_channels)
#Substituting the alpha channel with a custom image
mk=ExtractA().ConverttoRGB32()
bg=ImageSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\green_screen_sample.png", fps=my_framerate, start=0, end=my_frames, pixel_type="RGB32").Spline64Resize(my_width, my_height)
top=last.Mask(mk)
video=Layer(bg, top)
audio=my_audio
AudioDub(video, audio)
#Going to 4:2:2 planar
m_clip=Converttoyv16()
return m_clip
if you're using an Avisynth version prior to 3.7.1, you can toss "propClearAll()", so:
Code: Select all
#Keeping the alpha channel
ConverttoRGB32(m_clip)
#Collecting data
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
my_audio_channels=AudioChannels()
my_audio=GetChannels(my_audio_channels)
#Substituting the alpha channel with a custom image
mk=ExtractA().ConverttoRGB32()
bg=ImageSource("\\mibctvan000.avid.mi.bc.sky.it\Ingest\MEDIA\temp\green_screen_sample.png", fps=my_framerate, start=0, end=my_frames, pixel_type="RGB32").Spline64Resize(my_width, my_height)
top=last.Mask(mk)
video=Layer(bg, top)
audio=my_audio
AudioDub(video, audio)
#Going to 4:2:2 planar
m_clip=Converttoyv16()
return m_clip