Page 1 of 1
Transparancy dissapears running Ffmpeg
Posted: Sun Aug 01, 2021 11:39 am
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?
Re: Transparancy dissapears running Ffmpeg
Posted: Mon Aug 02, 2021 9:57 am
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
Re: Transparancy dissapears running Ffmpeg
Posted: Mon Aug 02, 2021 12:50 pm
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?
Re: Transparancy dissapears running Ffmpeg
Posted: Mon Aug 02, 2021 5:15 pm
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.
Re: Transparancy dissapears running Ffmpeg
Posted: Mon Aug 02, 2021 8:15 pm
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?
Re: Transparancy dissapears running Ffmpeg
Posted: Tue Aug 03, 2021 10:34 am
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':
Re: Transparancy dissapears running Ffmpeg
Posted: Tue Aug 03, 2021 12:45 pm
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.
Re: Transparancy dissapears running Ffmpeg
Posted: Wed Aug 04, 2021 11:15 am
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.