How to Export Animations to Video in FreeCAD

FreeCAD does not feature a native one-click tool to export animated assemblies or camera paths directly into containerized video formats like MP4 or AVI. Instead, the standard workflow requires generating the animation inside a specialized workbench, rendering out the movement as an ordered sequence of static image files, and compiling those frames into a video format using an external tool like FFmpeg. This guide walks through configuring your animation, saving your frame sequences, and encoding the final video output.

1. Prepare Your Animation in FreeCAD

To animate in FreeCAD, you must use a dedicated workbench such as Assembly4, ExplodedAssembly, or the community-developed Animation Workbench.

  1. Create your mechanical constraints or movement tracks using your chosen workbench.
  2. Define the duration, start variable, and end variable of your animation cycle.
  3. Test-run the animation inside the 3D view to verify that camera angles, lighting, and object trajectories behave as expected without clipping.

2. Export the Animation as an Image Sequence

Once the motion is configured, render the animation frame-by-frame:

  1. Set Up a Target Folder: Create a dedicated, empty folder on your drive (e.g., C:/FreeCAD_Renders/) to prevent cluttering your project directory with hundreds of images.
  2. Configure Frame Output: In your workbench’s animation dialog (such as the Animate Assembly window in Assembly4), look for the option labeled Save frames, Export sequence, or Record.
  3. Define Naming and Resolution: Set the output file pattern with zero-padded numbering, such as frame_%04d.png (resulting in frame_0001.png, frame_0002.png, etc.). Select your desired pixel resolution (e.g., 1920x1080) and set your target frame rate (typically 30 or 60 frames per second).
  4. Render: Execute the animation sequence. FreeCAD will step through each frame and save a corresponding PNG or JPEG image to your target folder.

(Alternative Method: For custom scripted motion, use the FreeCAD Python Console with a for loop that updates object placement and invokes Gui.ActiveDocument.ActiveView.saveImage('frame_%04d.png' % i, 1920, 1080, 'Transparent') on each iteration).

3. Convert Image Sequences to Video Using FFmpeg

The fastest and most reliable way to convert the image sequence into a video format is using FFmpeg, an open-source command-line multimedia framework.

  1. Open a terminal (macOS/Linux) or Command Prompt (Windows).

  2. Navigate to the folder containing your rendered images:

    cd path/to/your/frames
  3. Run the following command to compile the images into an H.264 MP4 video:

    ffmpeg -framerate 30 -i frame_%04d.png -c:v libx264 -pix_fmt yuv420p output.mp4
    • -framerate 30: Sets the video playback speed to 30 frames per second.
    • -i frame_%04d.png: Specifies the input naming pattern for four-digit numbers.
    • -c:v libx264: Uses the widely compatible H.264 video codec.
    • -pix_fmt yuv420p: Ensures maximum compatibility with standard media players and web browsers.
    • output.mp4: The filename of your finished video.

4. Alternative GUI Compilers

If you prefer not to use the command line, you can import the image sequence into standard graphical video editing programs:

  • Blender: Open the Video Sequence Editor, select Add > Image/Sequence, highlight all exported frames, set your output video format to FFmpeg Video / MP4, and click Render Animation.
  • OpenShot or Kdenlive: Import the first image of the sequence; the editor will typically detect the remaining sequence automatically and prompt to import it as a single video clip that you can export to any video format.