LiveLive

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Updated at: Mar 31, 2022 GMT+08:00

Snapshot Capturing

The Live service captures snapshots from a live stream based on a configured template and stores the captured snapshots in an OBS bucket. Multiple snapshot templates can be configured for a domain name. The template in which AppName is same as that in the ingest URL takes effect.

Process Flow

Figure 1 shows the process for configuring a snapshot template.

Figure 1 Process for configuring a snapshot template
  1. (Optional) Create an OBS bucket for storing live video snapshots. If you already have one, go to 2.

    The OBS bucket for storing live video snapshots must be in the same region as the Live service. For example, if you use Live in the CN North-Beijing4 region, then snapshots must be stored in an OBS bucket in the CN North-Beijing4 region.

  2. Authorize access to the OBS bucket so that the system can save the snapshots in the OBS bucket.
  3. Configure a snapshot template to capture snapshots from a video stream at a specified interval and save them as JPG files in an authorized OBS bucket.
  4. View snapshots in the output path.

Notes

  • The region where the Live service is located must be the same as the OBS bucket for storing snapshots.
  • Only JPG files can be generated.
  • In the AP-Bangkok region, submit a service ticket for review after configuring a template. The configuration takes effect only after it is approved.

Prerequisites

  • Domain names have been added.
  • CNMAE records have been added to your domains' DNS records.
  • Snapshots are stored in OBS. Therefore, you must enable OBS before storing snapshots in OBS. For details, see OBS Getting Started Guide.

Pricing Notes

  • Snapshot capturing is a billing item. You are billed based on the number of snapshots. For details, see Live Pricing Details.
  • Snapshots are stored in OBS. Therefore, OBS charges you for the storage. For details, see OBS Pricing Details.

Step 1: (Optional) Create an OBS Bucket

If you have not created an OBS bucket, create one in the same region as Live by referring to Creating a Bucket. If you already have one, go to Step 2: Authorize Access to the OBS Bucket.

Step 2: Authorize Access to the OBS Bucket

Perform the following steps to authorize Live to store snapshots in your OBS bucket.

  1. Log in to the Live console.
  2. In the navigation pane, choose Authorization.
  3. On the OBS Authorization tab, click Authorize in the Operation column of the row containing the target OBS bucket.

Step 3: Configure a Snapshot Template

After OBS authorization is successful, you can configure a snapshot template.

  1. Log in to the Live console.
  2. In the navigation pane, choose Domains.
  3. Click Settings in the row containing the target ingest domain name.
  4. In the navigation pane, choose Template Settings > Snapshot Capturing.
  5. Click Create Template.

    Figure 2 Creating a snapshot template

    Table 1 describes the parameters.

    Table 1 Template parameters

    Parameter

    Description

    AppName

    Application name. The default value is live. You can customize the application name. Only letters, digits, underscores (_), and hyphens (-) are allowed.

    Storage Bucket

    OBS bucket for storing snapshots

    Storage Path

    OBS storage path

    Screenshot Frequency

    The unit is second.

    Value range: 5 to 3600

    Storage Mode

    The value can be Full storage or Instant storage.

    • Full storage: All snapshot files are stored. A snapshot file is named as follows:
      {domain}/{app_name}/{stream_name}/{UTCTimestamp}.jpg
    • Instant storage: Only the latest snapshot is saved. A snapshot file is named as follows:
      {domain}/{app_name}/{stream_name}.jpg

    Callback

    Whether to enable callback

    Callback URL

    Enter a callback URL when Callback is enabled. A callback URL cannot contain message headers or parameters.

    Callback messages in JSON format are sent in POST requests to your server through HTTP APIs. For details about a callback message body, see Callback Message.

    Authentication Key

    Authentication key. If callback authentication is required, set this parameter. Otherwise, leave it empty.

    • A key contains 32 to 128 characters.
    • A key can also be automatically generated.

  6. Click OK.

    After a snapshot template is configured, stream push starts. During the stream pushing, the system takes snapshots of the live stream based on template settings.

  7. Click Edit in the Operation column to modify template parameters. AppName cannot be modified.

Step 4: View Snapshots

View the snapshots in the predefined output path or from a download link in your received callback message.

  • Viewing the snapshots on the console
    1. Log in to the Live console.
    2. In the navigation pane, choose Domains.
    3. Click Settings in the row containing the target ingest domain name.
    4. In the navigation pane, choose Template Settings > Snapshot Capturing.
    5. Click the output path in the Storage Location column to go to the OBS bucket and view snapshot details.
      Figure 3 Viewing snapshot details

      You can download and share the snapshots. For details, see OBS Help Center.

  • Viewing snapshots through a callback message

    If you set a callback URL when configuring a snapshot template, then you will receive a message each time a snapshot is generated. Table 2 describes the fields in a callback message.

    { 
        "domain": "play.example.com",
        "app": "live",
        "stream_name": "test001",
        "snapshot_url": "https://xxx.obs.cn-north-4.myhuaweicloud.com:443...",
        "width":"720",
        "height":"1280",
        "obs_addr": {
            "bucket": "xxx",
            "location": "cn-north-4",
            "object": "xxx.jpg"
        },
        "auth_timestamp":"1587954140,",
        "auth_sign":"4918b1axxxxxxb583cffa119d72513bbc35a989f8569fxxxxxx057646154a04a"
    }
    Table 2 Message body

    Field

    Description

    domain

    Ingest domain name

    app

    Application name

    stream_name

    Stream name

    snapshot_url

    URL to download snapshots

    width

    Image width

    Unit: pixel

    height

    Image height

    Unit: pixel

    obs_addr

    Address of the OBS bucket where snapshots are stored.
    • bucket: OBS bucket name
    • location: Region where the OBS bucket is located
    • object: OBS object path

    auth_timestamp

    UNIX timestamp when the event notification signature expires. This parameter is carried when an authentication key is configured.

    The value is a decimal UNIX timestamp, that is, the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

    Example: 1592639100 (June 20, 2020 15:45)

    auth_sign

    Event notification signature. This parameter is carried when an authentication key is configured.

    auth_sign = HmacSHA256(domain + app + stream_name + snapshot_url + width + height + obs_addr.bucket + obs_addr.location + obs_addr.object + auth_timestamp,key)

    key indicates the key used for authentication.

Did you find this page helpful?

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel