导出视频和动画

如需将有序图片集合导出为视频(其中帧由集合中的图片定义),请使用 Export.video()。您可以通过设置帧速率、缩放比例和尺寸来配置将 ImageCollection 转换为视频的方式。视频将编码为 MP4。

到云端硬盘

使用 Export.video.toDrive() 将视频导出到您的云端硬盘账号。例如,以下导出内容可用于制作 20 年 Landsat 影像的视频:

Code Editor (JavaScript)

// Load a Landsat 5 image collection.
var collection = ee.ImageCollection('LANDSAT/LT05/C02/T1_TOA')
  // San Francisco Bay.
  .filter(ee.Filter.eq('WRS_PATH', 44))
  .filter(ee.Filter.eq('WRS_ROW', 34))
  // Filter cloudy scenes.
  .filter(ee.Filter.lt('CLOUD_COVER', 30))
  // Get 20 years of imagery.
  .filterDate('1991-01-01','2011-12-30')
  // Make each image an 8-bit RGB image.
  .map(function(image) {
    return image.visualize({bands: ['B4', 'B3', 'B2'], min: 0.02, max: 0.35});
  });

// Define an area to export.
var polygon = ee.Geometry.Rectangle([-122.7286, 37.6325, -122.0241, 37.9592]);

// Export (change dimensions or scale for higher quality).
Export.video.toDrive({
  collection: collection,
  description: 'sfVideoExample',
  dimensions: 720,
  framesPerSecond: 12,
  region: polygon
});

请注意,可以通过传递给导出操作的参数字典来设置帧速率和尺寸。调整这些参数即可自定义视频。 另请注意,输入 ImageCollection 必须包含 3 个波段 (RGB)、8 位图像。在此示例中,明确设置了 8 位、3 个波段的格式。或者,映射一个会对集合调用 image.visualize() 的函数。如需了解详情,请参阅“可视化图片”部分。导出视频可能需要很长时间才能完成,因此导出任务长时间运行并不奇怪。

到 Cloud Storage

如需将视频导出到 Cloud Storage,请使用 Export.video.toCloudStorage()。例如,使用上例中的 ImageCollection

Code Editor (JavaScript)

// Export video to cloud storage.
Export.video.toCloudStorage({
  collection: collection,
  description: 'sfVideoExampleToCloud',
  bucket: 'your-bucket-name',
  dimensions: 720,
  framesPerSecond: 12,
  region: polygon
});