The output file extension for animation with the Blender Python API

When we specifying the full path to save the rendered animation, we must correctly set the file extension, which will change depending on the codec chosen for packing animation.

For rendering static images, the output file extension can be easily obtained through the “file_extension” property:

But this doesn’t work for animation. For video rendering, this property will still return the extension of the file used in temporary frames encoding, and not the final extension of the output video file.

To get exactly the extension with which we want to save the output animation, let’s write a simple function:

Here, we define a dictionary with the list of all video codec formats supported by Blender and the corresponding file extensions for these formats.

Now we can easily get the output file extension by simply calling thif function:

0 0 votes
Article Rating
Notify of
0 Comment
Inline Feedbacks
View all comments