This method saves an animation from spatiotemporal analysis to a video file.
Note: If you have trouble viewing videos, we recommend the VLC Media Player, a free and open-source application.
Example
This example builds a spatio-temporal series from sample gridded data in the ENVI installation path. It creates a raster series layer, animates the series, and exports the animation to AVI video format.
e = ENVI()
TimeSeriesDir = Filepath('', Subdir=['data','time_series'], $
Root_Dir = e.Root_Dir)
files = File_Search(TimeSeriesDir, 'AirTemp*.dat')
numRasters = N_Elements(files)
rasters = ObjArr(numRasters)
FOR i=0, (numRasters-1) DO $
rasters[i] = e.OpenRaster(files[i])
Task = ENVITask('BuildTimeSeries')
Task.INPUT_RASTERS = rasters
Task.OUTPUT_RASTERSERIES_URI = e.GetTemporaryFilename('series')
Task.Execute
Series = Task.OUTPUT_RASTERSERIES
View = e.GetView()
Layer = View.CreateLayer(Series)
VideoFile = e.GetTemporaryFilename('avi')
View.ChipToVideo, VideoFile, SERIES_LAYER=Layer, DURATION=10
Syntax
ENVIView.ChipToVideo, URI, [Format] [, Keywords=value]
Arguments
URI
Specify a string with the full path and name of the video file to create. You can specify the output format by including a filename extension (avi, mp4, mov, gif, swf, flv, or webm) or by setting the optional Format argument.
Format (optional)
Specify a string with the output video format. Type the following at the IDL command line to obtain a list of supported video formats; use one of the strings from this list:
IDL> Format = IDLffVideoWrite.GetFormats()
IDL> PRINT, Format
Keywords
CODEC (optional)
Specify a string with the output coding-decoding (codec) format. Type the following at the IDL command line to obtain a list of supported code formats; use one of the strings from this list.
IDL> Codec = IDLffVideoWrite.GetCodecs()
IDL> PRINT, Codec
DURATION (optional)
Specify a floating-point value that represents the total duration of the video, in seconds. If you do not set this keyword, the default value is the number of frames in the animation with an effective rate of one frame per second.
ERROR (optional)
Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.
When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.
See Manage Errors for more information on error handling in ENVI programming.
SERIES_LAYER (optional)
Specify an ENVIRasterSeriesLayer that will be animated frame-by-frame (first to last) to produce the video. If you do not set this keyword, the top-most raster series layer will be automatically selected.
Version History
API Version
4.3
See Also
ENVIView, ENVIRasterSeriesLayer, ENVIRasterSeries