公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
导出视频和动画
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如需将有序图片集合导出为视频(其中帧由集合中的图片定义),请使用 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
});
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eUse \u003ccode\u003eExport.video()\u003c/code\u003e in Earth Engine to create videos from image collections, where each image represents a frame in the video.\u003c/p\u003e\n"],["\u003cp\u003eConfigure the video output by specifying frame rate, scale, and dimensions, resulting in an MP4 encoded video.\u003c/p\u003e\n"],["\u003cp\u003eExport videos to your Google Drive with \u003ccode\u003eExport.video.toDrive()\u003c/code\u003e or to Cloud Storage with \u003ccode\u003eExport.video.toCloudStorage()\u003c/code\u003e, customizing with parameters like description, dimensions, frames per second, and region.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your image collection contains 3-band (RGB), 8-bit images for successful video export, using \u003ccode\u003eimage.visualize()\u003c/code\u003e if necessary.\u003c/p\u003e\n"],["\u003cp\u003eVideo exports in Earth Engine can be time-consuming, requiring patience for the task to complete.\u003c/p\u003e\n"]]],[],null,["# Exporting Video and Animations\n\nTo export ordered image collections as video, where frames are defined by images\nin the collection, use `Export.video()`. You can configure the way the\n`ImageCollection` is turned into video by setting frame rate, scale and\ndimensions. The video will be encoded as an MP4.\n\nto Drive\n--------\n\nExport video to your Drive account with `Export.video.toDrive()`. For example,\nthe following export makes a video from 20 years of Landsat imagery:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load a Landsat 5 image collection.\nvar collection = ee.ImageCollection('LANDSAT/LT05/C02/T1_TOA')\n // San Francisco Bay.\n .filter(ee.Filter.eq('WRS_PATH', 44))\n .filter(ee.Filter.eq('WRS_ROW', 34))\n // Filter cloudy scenes.\n .filter(ee.Filter.lt('CLOUD_COVER', 30))\n // Get 20 years of imagery.\n .filterDate('1991-01-01','2011-12-30')\n // Make each image an 8-bit RGB image.\n .map(function(image) {\n return image.visualize({bands: ['B4', 'B3', 'B2'], min: 0.02, max: 0.35});\n });\n\n// Define an area to export.\nvar polygon = ee.Geometry.Rectangle([-122.7286, 37.6325, -122.0241, 37.9592]);\n\n// Export (change dimensions or scale for higher quality).\nExport.video.toDrive({\n collection: collection,\n description: 'sfVideoExample',\n dimensions: 720,\n framesPerSecond: 12,\n region: polygon\n});\n```\n\nNote that the frame rate and dimensions can be set from a dictionary of\nparameters passed to the export. Adjust these parameters to customize the video.\nAlso note that the input ImageCollection is required to have 3-band (RGB), 8-bit\nimages. In this example, the 8-bit, 3-band format is explicitly set.\nAlternatively, map a function which calls `image.visualize()` over the\ncollection. See [the section on Visualization\nimages](/earth-engine/guides/image_visualization#visualization-images) for details. Video exports can\ntake a significant amount of time to complete, so it's not unusual to see the\nexport task running for an extended period.\n\nto Cloud Storage\n----------------\n\nTo export a video to Cloud Storage, use `Export.video.toCloudStorage()`. For\nexample, using the `ImageCollection` from the previous example:\n\n### Code Editor (JavaScript)\n\n```javascript\n// Export video to cloud storage.\nExport.video.toCloudStorage({\n collection: collection,\n description: 'sfVideoExampleToCloud',\n bucket: 'your-bucket-name',\n dimensions: 720,\n framesPerSecond: 12,\n region: polygon\n});\n```"]]