Summary
Creates an AVI or Quicktime video file from a set of images.
Usage
- The images in the Input Folder will be read in alphabetical order, and be loaded into the Output Video File in the order the images were read. If you wish to create a title frame, make sure to give the corresponding image a name that would place it before any other image when the folder is alphabetically sorted. For example, if the images have names like image_001.bmp, image_002.bmp, through to image_020.bmp, you can add an image named aimage_001.bmp that contains your desired title.
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.
Syntax
arcpy.conversion.RasterToVideo(input_folder, out_video_file, {image_format}, {codec}, {duration_method}, {time}, {quality})
Parameter | Explanation | Data Type |
input_folder | The folder containing the images that will be used to create the video. The images must all be of the same format, either bitmap (*.bmp) or JPEG (*.jpg). | Folder |
out_video_file | The output video file can be stored in the AVI format (*.avi) or in the Quicktime format (*.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 based on a number of factors such as the applications installed on the machine. | String |
duration_method (Optional) | The method to be used for defining the duration of the Output Video File.
| String |
time (Optional) | Duration of the video to be output. If the Output Duration Method is specified using frame rate, the number must be an integer. If the method is using time, the number is expressed in units of seconds. | Double |
quality (Optional) | The quality of the output video. The higher the value, the better the quality, and the lower the compression rate. The quality value can range from 1 to 100, if The default value is 100. | Long |
Code sample
RasterToVideo Example
The following sample demonstrates the use of this tool in the Python window.
# 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
- Basic: Yes
- Standard: Yes
- Advanced: Yes