管理录制策略Manage recording policy

可以使用 IoT Edge 上的实时视频分析进行连续视频录制,持续数周或数月将视频录制到云中。You can use Live Video Analytics on IoT Edge for continuous video recording, whereby you can record video into the cloud for weeks or months. 可以使用 Azure 存储中内置的生命周期管理工具来管理云存档的时间长度(天)。You can manage the length (in days) of that cloud archive by using the Lifecycle Management tools built into Azure storage.

媒体服务帐户已链接到 Azure 存储帐户,将视频录制到云中时,内容会写入媒体服务资产Your Media Service account is linked to an Azure Storage account, and when you record video to the cloud, the content is written to a Media Service asset. 每个资产都映射到存储帐户中的一个容器。Each asset is mapped to a container in the storage account. 生命周期管理允许你为存储帐户定义策略,你可以在其中指定规则,如下所示。Lifecycle management allows you to define a policy for a Storage account, wherein you can specify a rule such as the following.

{
  "rules": [
    {
      "name": "NinetyDayRule",
      "enabled": true,
      "type": "Lifecycle",
      "definition": {
        "filters": {
          "blobTypes": [ "blockBlob" ]
        },
        "actions": {
          "baseBlob": {
            "tierToCool": { "daysAfterModificationGreaterThan": 30 },
            "delete": { "daysAfterModificationGreaterThan": 90 }
          }
        }
      }
    }
  ]
}

上述规则:The above rule:

  • 应用于存储帐户中的所有块 blob。Applies to all block blobs in the Storage account.
  • 指定当 blob 期限超过 30 天时,它们将从热访问层移动到冷访问层Specifies that when blobs age beyond 30 days, they are moved from the hot access tier to cool.
  • 如果 blob 期限超过 90 天,则将其删除。And when blobs age beyond 90 days, they are to be deleted.

使用实时视频分析来记录到资产时,请指定 segmentLength 属性,该属性指示模块在将视频写入云之前聚合视频的最小持续时间(以秒为单位)。When you use Live Video Analytics to record to an asset, you specify a segmentLength property that tells the module to aggregate a minimum duration of video (in seconds) before it's written to the cloud. 你的资产将包含一系列片段,每个片段的创建时间戳都在上一个之后 segmentLengthYour asset will contain a series of segments, each with a creation timestamp that is segmentLength newer than the previous. 生命周期管理策略启动后,它会删除早于指定阈值的段。When the lifecycle management policy kicks in, it deletes segments older than the specified threshold. 但你可以继续通过媒体服务 API 访问和播放剩余的片段。However, you will continue to be able to access and play back the remaining segments via Media Service APIs. 有关详细信息,请参阅播放录制内容For more information, see play back recordings.

限制Limitations

以下是生命周期管理的一些已知限制:Following are some known limitations with lifecycle management:

  • 策略中最多可以有 100 个规则,每个规则最多可以指定 10 个容器。You can have at most 100 rules within the policy, and each rule can specify up to 10 containers. 因此,如果你需要具有不同的录制策略(例如,正对停车场的摄像头为 3 天存档、装货码头的摄像头为 30 天、收银台后面的摄像头为 180 天),请使用媒体服务帐户,为最多 1000 个摄像头自定义规则。So if you needed to have different recording policies (for example, 3-day archive for the camera facing the parking lot, 30 days for the camera in the loading dock, and 180 days for the camera behind the checkout counter), then with one Media Service account you can customize the rules for at most 1000 cameras.
  • 生命周期管理策略更新不是即时的。Lifecycle management policy updates are not immediate. 有关更多详细信息,请参阅常见问题解答部分See this FAQ section for more details.
  • 如果选择应用将 blob 移动到冷访问层的策略,则该存档部分的播放可能会受到影响。If you choose to apply a policy where blobs get moved to the cool tier, then playback of that portion of the archive may be affected. 你可能会看到其他延迟,或偶尔发生的错误。You may see additional latencies, or sporadic errors. 媒体服务不支持在存档层中播放内容。Media Services does not support playback of content in the archive tier.

后续步骤Next steps

播放录制内容Playback of recordings