匯出影片和動畫

如要將排序圖片集合匯出為影片,其中影格由集合中的圖片定義,請使用 Export.video()。您可以設定影格速率、縮放和尺寸,設定 ImageCollection 轉換成影片的方式。影片會編碼為 MP4。

到雲端硬碟

使用 Export.video.toDrive() 將影片匯出至 Google 雲端硬碟帳戶。舉例來說,以下匯出作業會使用 20 年的 Landsat 圖像製作影片:

程式碼編輯器 (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

程式碼編輯器 (JavaScript)

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