Zulko/moviepy

Current method to export video with mask

yanyiju opened this issue · 3 comments

Hello, I want to export a video with mask into mov file, however, I only find the with_mask option in write_images_sequence and it seems that masks will be transed into RGB if I use write_videofile directly since a @convert_masks_to_RGB notation is placed over the function.

I also notice an outdated similar post(#1122), which indicates there used to be a with_mask option for write_videofile. Thus, is there any method currently available for saving video alpha channel?

I am not sure if I understand all these stuff correctly since I am new to this tool. Thank you if you can give me some advice!

After doing some research, I have an alternative method (but maybe a little complex): I try to use write_images_sequence first and then apply ffmpeg to combine the images together using qtrle encoding, which can satisfy my requirements.

ffmpeg -r 24 -i frame%03d.png -vcodec qtrle out.mov

Still, I suppose there may be some method inside moviepy that can directly achieve the target. BTW, #1237 mentions some ffmpeg functions like ffmpeg_writer_video, while I can't find it on the document, so is it still under development?

Hey. Have you found any leeway with this issue? Does a simple command exist now to composite videos and maintain the alpha channels? Or do we still need to rely on write_image_sequence to achieve what we want?

Hey @MDMA-Mowgli , my method is quite awkward which first export image sequences with argb channels and then combines all images using ffmpeg. The command is already presented above. My code is just an example of fulfilling it. Since argb-channel exporting is not necessary in my project, so I didn't dive deeper then. Thanks.

Seems like this issue is not resolved yet and in need by many people, I can reopen this issue. Hope any other can share their thoughts in this thread.