Exporting in Uncompressed AVI with Alpha gives me strange results

iamgarvy
iamgarvy Posts: 6 Just Starting Out

Can someone please help me with this problem, i cant find anything about this issue i am having.

The video plays well in the viewer and also exported as a mp4.


But gives a strange result in Uncompressed AVI.


I have been searching for a couple of days now but i cant find a answer to this dilemma.


Thanks for helping!!

Comments

  • TerryS
    TerryS Posts: 127 Enthusiast
    edited December 2020

    If you load the file into HitFilm, does it contain the artifacts?

    Most media players cannot handle HUGE uncompressed AVI files and play them back correctly. If they can play them at all.

    At least, thats my experience with uncompressed avi's.

    Why did you chose uncompressed avi if you don't mind my asking?

  • iamgarvy
    iamgarvy Posts: 6 Just Starting Out

    Hi Terry,

    I am not using any videofiles to create the scene.

    Its a scene made with a couple of png files and some effects from Hitfilm itself.


    I would like to have a alpha layer so i can use it as a overlay video on my stream.


    Also the size doe not seem to be a problem, if i convert the avi with ffmpeg to a webm file it still has the strange "cloud" effect.


    Thanks

  • TerryS
    TerryS Posts: 127 Enthusiast

    Have you tried a GoPro/Cinaform export?

    It seems to work on my end.

    The biggest problem is playing it back on a Windows machine. If you install the GoPro editor.https://www.techspot.com/downloads/6759-gopro-studio.html

    And use Media Player Classic https://mpc-hc.org/ You can playback Cinaform videos. I couldn't get my version of VLC, Windows media player or any player to work after installing decoders suggested in this forum long ago. https://community.fxhome.com/discussion/48983/any-way-to-playback-gopro-cineform-on-windows-10

    The Player suggested got Media Player Classic up and running.

    I don't know if this will resolve your problem? But it rendered lightning and a PNG correctly for me.


  • TerryS
    TerryS Posts: 127 Enthusiast

    Quick follow up.

    I was able to use Handbrake to convert the Cinaform video to WebM.


  • iamgarvy
    iamgarvy Posts: 6 Just Starting Out
  • TerryS
    TerryS Posts: 127 Enthusiast
    edited December 2020

    Well, I discovered the Handbrake file dropped transparency. Sorry for any false hope.

    I have no problems with AVI exports and artifacts. Perhaps thats what you need to get sorted out.

  • iamgarvy
    iamgarvy Posts: 6 Just Starting Out

    I tried it also, have got the same result. But....


    Have done some more searching on handbrake and came to a thread regarding alpha for FFMpeg.

    Tried the following command:

    ..\bin\ffmpeg -i slam.avi -c:v libvpx-vp9 -pix_fmt yuva420p slam.webm

    This gave me a good conversion but gave me artifacts for playback again:

    In mediaplayer:


    In VLC:


    But something i did not try before (Duhhhh) :)

    In OBS:

    The white background is a white color layer so the file is stil transparant.


    Strange thing is thus that for some reason my playback decoders for Mediaplayer/VLC seem to be the problem ?

    Have any knowledge on that.


    Atleast my problem for my stream is solved i can just use the converted mediafiles!


    Hooray :P

  • Triem23
    Triem23 Posts: 20,062 Ambassador

    There are two types of calculation for transparency - Straight and Premultiplied. I'll link this article on the differences. It's not actually directly related to your issue, but it's good to know.

    The problem is this. VLC doesn't properly support alpha channels on playback, and Windows Media doesn't properly support AVI with alpha. The problem you see is caused by the players not Hitfilm.

    You've already noted loading into OBS displays correctly. Another check is to load your rendered video back into Hitfilm. Ah, but if it doesn't display properly in Hitfilm, well... Right click on the File in the Media Bin, select Properties, look for Alpha, disable "from file" and swap Straight vs Premultiplied. One will work. Since the render is intended as an overlay for other videos, this is the only thing you need to worry about. Playback in anything else is irrelevant as long as your transparency works in Hitfilm for future compositing.

    If OBS reads things correctly, you're good to go for streaming. Again, VLC and Media Player are irrelevant. I think OBS has a switch for Straight/Premultiplied alpha, so, if getting edge artifacts in OBS flip that switch. Your OBS screenshot over the gray shows darkening. I'm guessing you have Premultiplied alpha over black on your file. This is pretty typical, so try making certain OBS is using Premultiplied alpha.

    Otherwise, TerryS is correct when he says you're better off rendering to Cineform RGBA than AVI. The AVI render is an ancient legacy format (and huge) while Cineform is a more modern codec better suited for current software. You'll also generate smaller files. Cineform (and ProRes) is specifically intended for just this kind of use case - high quality intermediates, and will perform better/faster in Hitfilm than the AVI.

    @TerryS FYI regarding your Handbrake tests. Mp4 doesn't support alpha. Period. It's just not in the spec. Remember Mp4 was developed for Blu-ray and is intended as a final, single stream of video to be watched.

  • iamgarvy
    iamgarvy Posts: 6 Just Starting Out

    Hi Triem,


    Thanks for the response. The graying you see in the still is a "smoke" effect, looks way better on a black background but will try the switch in OBS if i can find it :)


    Also the reimport is a good hint, had not occured to me to try that.


    The exported AVI is with the Cineform Codec and the Alpha channel, but will go for MOV instead in the future.


    Also one final bit, handbrake does give support for the webm output. Which would suggest support for a alpha channel, but i think the VP8/VP9 codec is not the VP8a/VP9a implementation at this moment (?).


    But for now my problems are solved for the timebeing.

    Am appreciating this a whole lot though. Learned a bunch in the short time playing around with animations :)

  • TerryS
    TerryS Posts: 127 Enthusiast
    edited December 2020

    I searched for an online Cinaform with alpha to webm. I even tried a website unsuccessfully.

    I may be missing something simple, but it seems conversions to webm + alpha are much more rare to obtain than simple conversions to webm.

    I thought VP9 in Handbrake was the ticket, then I discovered I was mistaken after installing Openshot and placing media behind it. I should have tested it before posting. Sorry about that. I wasted both of our time.

  • iamgarvy
    iamgarvy Posts: 6 Just Starting Out

    No worries man, you helped me a whole lot!

    I ended up using FFMpeg to convert to WebM:

    ..\bin\ffmpeg -i editor.avi -c:v libvpx-vp9 -pix_fmt yuva420p out.webm


    Still looking for the premultiplied option as Triem23 was pointing to. But learned aswell what doesn't work. Thats valuable aswell.

    Sometimes al you need is someone pointing you in the right direction.

  • TerryS
    TerryS Posts: 127 Enthusiast

    I've found a path.

    I accidentally used Openshot when I've been meaning to try ShotCut { Free open source Program } for years actually. LOL

    Well, I loaded a Cinaform render and trans coded it to Webm V9 with alpha using default settings.

    The export worked upon import on a background.

    Webm V8 alpha or some tweaked settings might yield better results?

    But its blue glowing lightning, which is going to look off unless the glow color is changed anyway. {:>)

    Anyway, You might want to compose your webm content in Shotcut down the road. Its been around for about 20 years.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast

    @Triem23

    Mp4 doesn't support alpha. Period.

    Not true. MP4 as a container does not care what the video or audio is. The video stream is a magic cookie WRT the container. I'm not sure any codecs registered for MP4 support alpha. It is really the codec that needs to support alpha. Not the container. Not every codec in the world is registered as a valid codec for MP4 containers.

    The MP4 container copies the Quicktime MOV container. Quicktime MOV certainly does support registered codecs which support alpha.

    Remember Mp4 was developed for Blu-ray and is intended as a final, single stream of video to be watched.

    The MP4 container was developed for itself and nothing else. Actually not really developed since it copied Quicktime.

  • TerryS
    TerryS Posts: 127 Enthusiast

    @NormanPCN

    Well, thats all fine and well. That an MP4 can contain a video with an alpha channel.

    However, can you produce a mp4 with a transparent background in HitFilm? Or any other video editor for that matter.

    Or, create/assemble a Mp4 with transparency. That will actually play in a media player?

    I'm trying to wrap my head around your statement. I understand mp4 is a container, but I've never seen one with transparency that I'm aware of.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast

    @TerryS

    That an MP4 can contain a video with an alpha channel.

    As previously stated... "I'm not sure any codecs registered for MP4 support alpha."

    Or, create/assemble a Mp4 with transparency.

    Hitfilm only supports exporting the AVC/H.264 in an MP4 file. AVC does not support an alpha channel.

    Your only options in Hitfilm for alpha export are image sequences (PNG, EXR) or Cineform in MOV/AVI (Windows) Prores (Mac).

    That will actually play in a media player?

    Alpha for a media player is kinda interesting because what is the player supposed to do with Alpha? A player can certainly provide an option for you to select what to do (color) with the alpha. Also, alpha is not all on/off so there is blending necessary with a chosen alpha color. Media players basically just skip alpha video probably for these reasons.

  • TerryS
    TerryS Posts: 127 Enthusiast

    That will actually play in a media player?

    What I meant was you can preview your transparent videos in a media player to see what they contain.

    If you could create a hypothetical mp4 with transparency, what are you supposed to do with it?

    If can't view it in a media player, and editing programs won't recognize format and open it.

    What good is it. I guess it was a bit of a bridge to far hypothetical for me. Sure, anythings possible. We may see a Mp4 with transparency some day? We might see mp4 phased out for something better sooner.

  • NormanPCN
    NormanPCN Posts: 4,081 Enthusiast

    We may see a Mp4 with transparency some day?

    Unlikely. Very few people in this world care about transparency. Those that do are editors. Something with transparency defines that the media is intended for actually editing. Your editor can use and display it. Here you can just use the common things in this scenario. Image sequence is likely the most commonly used thing in the high end world. Lossless and/or uncompressed formats. But for an actual "video file", then Cineform/Prores/DNxHR in a Quicktime MOV file container is the commonly supported thing. I don't see people wanting to create something new when something suitable already exists.