Skip to content

Saving Live Segments with a Harvest Job โ€‹

Updated

A Harvest Job extracts a past live segment retained on an endpoint and stores it in COS. It runs once after creation and differs from a job that re-publishes the source.

Saving a live segment as a file

Prerequisites โ€‹

  • Time-shifted Viewing must be enabled on the target endpoint.
  • The video to extract must still be within the actual retention window.
  • The end time must be in the past, and the start-to-end interval can be at most 24 hours.
  • Prepare a COS bucket in the same region as StreamPackage, with read / write permissions.
  • Use a unique Manifest key for each job.

Reusing the same Manifest key can cause a new playlist to overwrite the existing one. Keep the storage paths of different jobs separate as well.

Console Creation Procedure โ€‹

  1. In Harvest Jobs of the StreamPackage console, select Create Harvest Job.
  2. Specify the job ID and select the Origin endpoint.
  3. Under Date and time format, select either Epoch seconds or ISO-8601.
  4. Specify the start and end times.
  5. Verify the COS permissions and select a bucket in the same region.
  6. Specify a Manifest key that includes the path inside the bucket and the parent playlist file name.
  7. If you need a completion notification, configure the Callback HTTP URL.
  8. Review the details and create the job.

Per the official guide, job IDs use letters, digits, underscores, and hyphens, up to 128 characters.

Time Specification Example โ€‹

ItemISO-8601 example
Start2026-09-18T00:00:00Z
End2026-09-18T00:10:00Z

The dates above only illustrate the format. Replace them with a past segment that is actually retained.

Checking Status and Results โ€‹

Check the job status along with the channel, endpoint, and time range in the list or in Info. Once the job completes, verify that the playlist in COS and the segments it references exist, then play them back. Do not rely on the job status alone โ€” also compare the start / end range, duration, and video / audio.

A API query example follows. Check the parameter schema of the SDK you are using and replace the job ID.

bash
tccli mdp DescribeStreamPackageHarvestJobs --region ap-seoul
tccli mdp DescribeStreamPackageHarvestJob --region ap-seoul --ID YOUR_JOB_ID

Completion Callback โ€‹

The callback described in the official guide includes the following fields. The values below illustrate the format.

json
{
  "harvest_job_id": "demo_job",
  "state": "success",
  "time": 1789689600
}

The callback state is either success or failed, and time is a Unix timestamp. The receiver should handle notifications idempotently based on the notification ID and apply authentication / retry policies.

Verifying Results and Cleaning Up โ€‹

Check itemWhat to verify
Source retentionWhen time shifting was enabled and which segments remain
Time rangeStart < end, end time in the past, at most 24 hours
Storage locationA COS bucket in the same region, and its permissions
File pathA unique Manifest key and the risk of overwriting
Playback verificationWhether the segments exist, and the access policy

Manage job records based on the current status and the available operations shown in the console / API.

Clearing job records and deleting the COS result files are verified separately. When deleting test artifacts, specify the exact bucket / object path and first confirm whether they are shared.

Built with VitePress ยท Deployed on Tencent EdgeOne Pages