Creating Animated .GIFs (with Transparency) From Blender Output
1) Create an animation with Blender.
There are many tutorials out there so we will not cover Blender operation here.
If you want to preserve transparency, the main thing is to create an animation with no background planes or "World"/"Atmosphere" settings. Leave them blank so that your scene is rendered with no background.
Render your animation with the following Output Properties setup:
- Resolution: Set your desired resolution here. Keep in mind each frame will be added to final output so things can get large quickly.
- Output directory: c:\temp\
- Output Overwrite : Checked
- Output : File Extensions - Checked
- File Format: PNG
- Color : RGBA
When you generate the animation the output files will be written to the directory with a 4 digit number at the end of the file name which specifies each frame number.
2) Assemble output and convert to .gif with ffmpeg
Download and install ffmpeg (link)
The following commands will preserve the palette from the input files (including transparency), and then compile and convert
ffmpeg -i %04d.png -vf palettegen=reserve_transparent=1 palette.png ffmpeg -framerate 30 -i %04d.png -i palette.png -lavfi paletteuse=alpha_threshold=128 -gifflags -offsetting output.gif
3) Add Media Item to your OBS Stream
- Add Source
- Select "Image"
- Add local file c:\temp\output.gif
- Select "Apply"
- Adjust the image size and position in your scene.
- Adjust the layer by click-dragging in the Sources stack.