Reputation: 1089
I plan on using Blender to render animated sequences for a game. I need the videos to have transparent backgrounds in the format expected by its engine. This format involves the transparency being defined as a separate grayscale video of equal FPS and duration. Since splitting the RGB and Alpha channels in Blender is more complicated, I'd prefer doing this directly from ffmpeg.
The input directory contains an image sequence of png files in RGBA format (eg: 0000.png to 0100.png). What I need ffmpeg to do is compile them into two separate videos: One containing only the RGB channels (leave transparency black) and another containing only the grayscale alpha channel. In the end I'd have something like my_video.mp4 + my_video_mask.mp4.
I'm familiar with compiling non-transparent image sequences into video using:
ffmpeg -f image2 -i /path/to/sequence/%04d.png output.mp4
But I don't know how to extract the alpha channel and make it a separate video file. What is the simplest ffmpeg command to achieve this result?
Upvotes: 3
Views: 2503
Reputation: 93018
Use
ffmpeg -f image2 -i /path/to/sequence/%04d.png my_video.mp4 -vf alphaextract my_video_mask.mp4
Upvotes: 3