video_m wrote: ↑Thu Jan 06, 2022 8:22 pm
Now will i make from 444 video source a video with the alpha is green. I have try different script's but nothing works...
Ok, so, thank you for the PM.
I'm gonna share the solution here only 'cause others might need it in the future, dunno.
So what you wanna do is to swap the Alpha Channel of the clip with Green picked from an image.
What you were using in the code you sent me was the "Layer" function, however such a function is meant to be used to "overlay" something on top of something else, which is not what we're trying to do here.
So, first things first, let's take care of your input, which is 4:4:4:4 and to make things easier we're gonna use the good old RGB32 so that I can use MergeARGB().
The idea is to:
1) Index your source file
2) Convert to RGB32
3) Extract the R, G, B components and save them in a variable
4) Save the resolution, framerate and duration in variables
5) Index the image you wanna use
6) Convert the image to RGB32 too
7) Have as many frames as the input, at the same fps as the input at the same resolution as the input
8) Toss the Alpha Channel of the originally indexed clip and swap it with the one of the image you indexed
This can be accomplished in Avisynth with the following AVS Script:
Code: Select all
#Indexing the original clip
ColorBars(848, 480, pixel_type="YV24")
ConverttoRGB32()
#Extraction and Metadata
my_Red=ExtractR()
my_Green=ExtractG()
my_Blue=ExtractB()
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
#Indexing the image you want to use
my_alpha=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)
#Swap the alpha channel
MergeARGB(my_alpha, my_Red, my_Green, my_Blue)
Now, since you're using FFAStrans, the hard part is already accomplished by the A/V Decoder, therefore you would have to use m_clip instead, namely:
Code: Select all
#Indexing the original clip
ConverttoRGB32(m_clip)
#Extraction and Metadata
my_Red=ExtractR()
my_Green=ExtractG()
my_Blue=ExtractB()
my_width=Width()
my_height=Height()
my_framerate=FrameRate()
my_frames=FrameCount()
#Indexing the image you want to use
my_alpha=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)
#Swap the alpha channel
MergeARGB(my_alpha, my_Red, my_Green, my_Blue)
This way you have an ARGB file with the alpha channel swapped, however to confirm this I would need a proper alpha channel file and you're the only one who has it.
I know there's DRM and everything, but if you could share a tiny sample like honestly 5-10 seconds privately I could test it.
Thanks,
Frank