Summary
Creates a video file from a set of images.
Usage
- When creating a video from images in a folder, make sure that the folder specified has more than one image file of the same type (BMP or JPEG).
- This tool reads the images in the folder in alphabetical order. The output video will contain frames in the order the images were read from the disk.
Keeping in mind that the images are read alphabetically, you can insert images in the folder of images such as a title image for your video. For example, if the folder of images has images with names image_1.bmp, image_2.bmp, and image_20.bmp, you can add an image named _image_1.bmp. Since the tool reads the images in an alphabetical order,_image_1.bmp will appear before image_1.bmp in the output video.
The resolution (width x height) of the output video is based on the resolution of the first image in the folder of images supplied to the tool. If the first image has a smaller or larger resolution than the others, the rest of the images will be stretched to fit the resolution of the first image. So try to keep the resolution of the images in the folder consistent.
Since AVI and QuickTime formats are supported on Windows only, this tool will not work on a non-Windows platform.
Syntax
RasterToVideo_conversion (input_folder, out_video_file, {image_format}, {codec}, {duration_method}, {time}, {quality})
Parameter | Explanation | Data Type |
input_folder | The folder containing the images. The images in the folder should be of the same type (BMP or JPEG). | Folder |
out_video_file | The output video file (*.avi or *.mov). | File |
image_format (Optional) | The format of the images files in the folder. The output video will be created using the images of the chosen format.
| String |
codec (Optional) | The codec used for compressing the frames while writing the video file. The list of codecs can vary on different machines. | String |
duration_method (Optional) | The method to be used for defining the output video duration.
| String |
time (Optional) | Duration of the video to be output. | Double |
quality (Optional) | The quality of the output video. The video can be exported at different qualities ranging from 1 to 100. The default value is 100. | Long |
Code sample
RasterTo Video Python example
# Name: RasterToVideo_AVI.py
# Description: Creates an AVI video from a folder of images
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "c:/data"
#Set local variables
inFolder = "images"
outputVideoFile = "outputVideo.avi"
#Execute RaserToVideo
arcpy.RasterToVideo_conversion(inFolder, outputVideoFile, "BMP",
"Microsoft Video 1", "FRAME_RATE", "2", "90")
Environments
Licensing information
- ArcGIS for Desktop Basic: Yes
- ArcGIS for Desktop Standard: Yes
- ArcGIS for Desktop Advanced: Yes