How to export an ArcMap animation as an AVI video file


This sample illustrates how to export an ArcMap animation as an AVI video file.

How to use

  1. Open an ArcMap document;
  2. Create one or more animation tracks in ArcMap using the animation toolbar (any type of animation is good);
  3. Copy and paste the following code into the VB editor in ArcMap, and change the export path to your own path;
  4. Make sure that "ESRI Animation Object Library" and "ESRI AnimationUI Object Library" are checked in the References dialog box of the VBA project;
  5. Run the macro "Export_Animation_AVI";
  6. Verify that an AVI video file is created by playing it in your system’s video player.
[VBA]
Public Sub Export_Animation_AVI()
    'Find the animation extension
    Dim pUID As New UID
    pUID.Value = "esriAnimation.AnimationExtension"
    Dim pAnimExt As IAnimationExtension
    Set pAnimExt = Application.FindExtensionByCLSID(pUID)
    
    'Create an instance of videoexporter
    Dim pVideoExporter As IVideoExporter
    Set pVideoExporter = New AnimationExporterAVI
    'Get statusbar from application
    Dim pStatusBar As IStatusBar
    Set pStatusBar = Application.StatusBar
    
    pVideoExporter.ExportFileName = "C:\Temp\VideoExp.avi"
    pVideoExporter.CodecCode = "CVID"
    pAnimExt.AnimationEnvironment.AnimationDuration = 5#
    
    pVideoExporter.ExportAnimation pAnimExt.AnimationTracks, pAnimExt.AnimationEnvironment, pStatusBar
    
End Sub