Correct Video Layer Setting for Transparency Channel (AVI)

Questions and answers on how to get the most out of FFAStrans
Post Reply
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

Hello,

Would somebody please tell me what are the correct settings I should use in Adobe Premier to export an AVI with transparency?

Image

I tried quite a few settings over the last hour and had no success.

Thanks
momocampo
Posts: 592
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by momocampo »

Hi,
I think Microsoft RLE or Uncompressed 422 should be ok but check your file size cause it's gonna be huge :)
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

Hi, I gave the following a go.

None of them worked.

I have a chroma video / used ultra key.

Am I missing something?

Thanks

Image


Image

momocampo wrote: Sun Jan 08, 2023 11:17 am Hi,
I think Microsoft RLE or Uncompressed 422 should be ok but check your file size cause it's gonna be huge :)
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

RE: Correct Video Layer Setting for Transparency Channel (AVI)

Post by emcodem »

Well obviously premiere does not offer any general purpose codec with alpha channel in avi container, you'd need to look out for something with a 4th component like 4:4:4:4 or yuva or rgba

Question is why you are bound using avi container, it is probably the oldest, most limited one you can go for :D
Why not use mov instead or such? Which target software does support alpha in avi anyways?

One alternative way for working with formats that don't support alpha is to export 2 versions, key and fill into separate files.

Some example ffmpeg commands for working with separate key and fill files:

*) map Y from yuv (alpha only, grayscale) file to new file with a real alpha channel:

Code: Select all

ffmpeg -i E:\temp\kf\WIPE02_KEY.mxf -filter_complex format=yuva444p,mergeplanes=0x03010200:yuva444p[4c];[4c]alphaextract -c:v prores_ks -pix_fmt yuva444p10le e:\temp\kf\withalpha.mov
*) Merge key and fill from 2 separate yuv files into one (ffastrans layer compatible avi). This is something we occasionally do at broadcast, as SDI signal doesnt carry alpha, we store alpha in a separate file. Here is how we can work with it:

Code: Select all

ffmpeg -i e:\temp\kf\WIPE02_KEY.mxf -i E:\temp\kf\WIPE02_FILL.mxf  -filter_complex format=yuva444p,mergeplanes=0x03010200:yuva444p[4c];[4c]alphaextract[1c];[1][1c]alphamerge[out] -map [out] -c:v rawvideo -pix_fmt rgba e:\temp\kf\merged.avi
Note that instead of -c:v rawvideo you could also do any other codec with alpha, e.g. -c:v prores_ks -pix_fmt yuva444p10l


*) Finally, when we have all components in a single file, use it for overlaying onto some other video (same as layer processor does but compatible to more file formats with alpha):

Code: Select all

ffmpeg -y -i e:\5.1.mp4 -i e:\temp\kf\merged.avi -filter_complex [0][1]overlay[v1] -map [v1] -map 0:a -c:a copy -c:v libx264 -preset ultrafast -shortest e:\temp\kf\finaloutput.mp4
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1658
Joined: Sat Feb 08, 2014 10:39 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by admin »

Hi authorleon,

In Premiere you must use "None" as video codec and set to 32 bit depth. It should give you a proper rgba file.

-steinar
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

first of all thank you for the post second of all let me try that and now get back to you and I will respond to emcodem.

Thank you
admin wrote: Mon Jan 09, 2023 12:14 pm Hi authorleon,

In Premiere you must use "None" as video codec and set to 32 bit depth. It should give you a proper rgba file.

-steinar
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

okay, I finally got it working. There was a setting that was set to 24-bit as opposed to 32-bit.

I have a question. The file sizes are colossal. Is there any alternative?

thanks


admin wrote: Mon Jan 09, 2023 12:14 pm Hi authorleon,

In Premiere you must use "None" as video codec and set to 32 bit depth. It should give you a proper rgba file.

-steinar
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

Wow. Thanks. I will need to go through this in detail!
authorleon
Posts: 108
Joined: Fri May 08, 2020 5:18 pm

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by authorleon »

Hello all:

I have a question. The file sizes are colossal. Is there any alternative? Smaller file size?

Thank you

PS: @emcodem, thank you for the info. But that is a little too complex at present.
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: Correct Video Layer Setting for Transparency Channel (AVI)

Post by emcodem »

Yeah sorry, sure you dont want to work with separate files, i just added my ffmpeg commands in order to preserve them next time when i need them :D

The reason why we only support uncompressed avi is that the videolayer processor is an unloved stepchild, it uses the avisynth source plugin "Avisource". But as far as i see, the "eat everything" source plugin ffvideosource also supports alpha channel these days.

So why don't we just try to replace the word "Avisource" by "ffvideosource" directly after the videolayer node?

Here is how i generated a small webm video from a transparent png for testing, you need to test which format + alpha from premiere is supported by ffvideosource (e.g. quicktime animation?).

Code: Select all

ffmpeg -loop 1 -i Desktop\transparent.png -r 30  -pix_fmt yuva420p c:\temp\transpavideo.webm
Here the workflow, it reads the .avs script after the videolayer node (%s_source%), replaces "Avisource" against "FFvideosource", writes the result to a file in work_folder and sets %s_source% to the resulting avs script. Tested with above webm transparent source, works for me.
emcodem_videolayer_ffvideosource.json
(4.85 KiB) Downloaded 57 times
Of course we can alternatively take a custom avs processor and recreate what the videolayer proc does. Looking at the source code of the videolayer processor, there is no logic at all, so basically it is just a convenience function for inserting these lines into the avs script (but it uses avisource instead of ffvideosource):

NOT TESTED:

Code: Select all

m_clip = ConvertTo8Bit(m_clip)
videolayer = FFVideoSource("C:\Users\emcod\Desktop\transparent.webm").converttorgb32().LanczosResize(m_clip.Width, m_clip.Height).ConvertFPS(m_clip.FrameRate)
audiolayer = BlankClip(m_clip, length = videolayer.FrameCount, color=$000000)
medialayer = AudioDub(videolayer, audiolayer)
m_clip = ConvertToRGB32(m_clip)
m_clip = Layer(m_clip,medialayer, "add", Round(254))
m_clip = ConvertToYUV444(m_clip)
Return m_clip
Edit: if the alpha source is interlaced, use ConvertToRGB32(m_clip, interlaced=true)
emcodem, wrapping since 2009 you got the rhyme?
Post Reply