Transparancy dissapears running Ffmpeg

Getting errors or found a bug when converting faces from a trained model? Post about them here


Forum rules

Read the FAQs and search the forum before posting a new topic.

This forum is for reporting errors with the Convert process. If you want to get tips, or better understand the Convert process, then you should look in the Convert Discussion forum.

Please mark any answers that fixed your problems so others can find the solutions.

Post Reply
User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Transparancy dissapears running Ffmpeg

Post by rolnor »

I have made a imagefile with openCV with the draw transparency setting and png.
Images look very nice, only the new face without the head.
When i convert this set of images to a video with Ffmpeg (running in dos) I get the head back, its no longer only the face. This video look very nice but I dont want the head, only the face.
How is this possible?


User avatar
torzdf
Posts: 1495
Joined: Fri Jul 12, 2019 12:53 am
Answers: 127
Has thanked: 51 times
Been thanked: 287 times

Re: Transparancy dissapears running Ffmpeg

Post by torzdf »

The images are saved as 4 channel RGBA pngs when enabling draw transparent. This can be carried through to video by changing the pixel format in ffmpeg (this is a command line thing in the original application, not something available in faceswap. RGBA video is so niche that it is not worth looking to adding).

This should get you started:
https://stackoverflow.com/questions/588 ... ing-ffmpeg

My word is final


User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Re: Transparancy dissapears running Ffmpeg

Post by rolnor »

Great, thanx!

Will the final result be a RGBA-video?
I dont think I have seen this format before. Is it possible to open this file in premiere pro for example?
Is it only nessecary to use the procedure in the link, do I have to add some more parameters?


User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Re: Transparancy dissapears running Ffmpeg

Post by rolnor »

I got a file but its very large 180GB. I used format=rgba and it seemd as if ffmpeg worked normal
I have tried to open the file with gimp, animate, mocha but it doesnt work. I am not sure if the file is ok at all, I need more help for sure.


User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Re: Transparancy dissapears running Ffmpeg

Post by rolnor »

I am using these parameters

ffmpeg -r 25 -f image2 -s 1920x1080 -start_number 1 -i NiklaPurpleKaya_%06d -vframes 1000 -vf format=rgba -f rawvideo test.rgba

The file is smaller now 16GB, I use fewer images

I can not open the file I think I have one program that should be able to do this, Heic something.
So please, what is wrong?


User avatar
torzdf
Posts: 1495
Joined: Fri Jul 12, 2019 12:53 am
Answers: 127
Has thanked: 51 times
Been thanked: 287 times

Re: Transparancy dissapears running Ffmpeg

Post by torzdf »

Ok, I have not done this, so I can't give you the exact steps. But... the problem you need to solve is you have an image sequence in RGBA format. The mask is in the alpha channel.....

You need to follow one of 2 approaches, I cannot tell you which is best, or which is easiest, as I do not know.

1) Apply the alpha channel to all the images in the sequence to turn the sequence into RGB with the mask applied to each channel

2) Find a video codec that you can use which supports RGBA format videos (it is fairly non-standard).

Google is going to be your best bet for this. Here's a start for you (from the search term 'rgba image sequence premiere pro':

My word is final


User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Re: Transparancy dissapears running Ffmpeg

Post by rolnor »

Thanx! Its working fine, I just import the images as sequence in premiere and rendered and changed the speed. I think its OK now.
I think this could be interesting for others here att the forum, its fascinating with the face clean like this.


User avatar
rolnor
Posts: 62
Joined: Tue Feb 23, 2021 10:09 am
Been thanked: 3 times

Re: Transparancy dissapears running Ffmpeg

Post by rolnor »

I have changed the duration of the images in premiere to 0.4s so now I dont need to change the speed of the video, this simplifys.
Also I have added the audio from the video I made with the Ffmpeg-plugin in faseswap and it syncs perfect.
Thanx again.


Post Reply