Clip videos given a start and end time
Clips a video based on the specified start and end times provided in seconds.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Accepted Permissions (at least one required)
Parameters
Lists the origins allowed to display the video. Enter allowed origin domains in an array and use * for wildcard subdomains. Empty arrays allow the video to be viewed on any origin.
The maximum duration in seconds for a video upload. Can be set for a video that is not yet uploaded to limit its duration. Uploads that exceed the specified duration will fail during processing. A value of -1 means the value is unknown.
Indicates whether the video can be a accessed using the UID. When set to true, a signed token must be generated with a signing key to view the video.
The timestamp for a thumbnail image calculated as a percentage value of the video's duration. To convert from a second-wise timestamp to a percentage, divide the desired timestamp by the total duration of the video. If this value is not set, the default thumbnail image is taken from 0s of the video.
Clip videos given a start and end time
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
clip = client.stream.clip.create(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
clipped_from_video_uid="023e105f4ecef8ad9ca31a8372d0c353",
end_time_seconds=0,
start_time_seconds=0,
)
print(clip.clipped_from_video_uid){
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"allowedOrigins": [
"example.com"
],
"clippedFromVideoUID": "023e105f4ecef8ad9ca31a8372d0c353",
"created": "2014-01-02T02:20:00Z",
"creator": "creator-id_abcde12345",
"endTimeSeconds": 0,
"maxDurationSeconds": 1,
"meta": {
"name": "video12345.mp4"
},
"modified": "2014-01-02T02:20:00Z",
"playback": {
"dash": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.mpd",
"hls": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.m3u8"
},
"preview": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/watch",
"requireSignedURLs": true,
"startTimeSeconds": 0,
"status": "inprogress",
"thumbnailTimestampPct": 0.529241,
"watermark": {
"uid": "ea95132c15732412d22c1476fa83f27a"
}
}
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"success": true,
"result": {
"allowedOrigins": [
"example.com"
],
"clippedFromVideoUID": "023e105f4ecef8ad9ca31a8372d0c353",
"created": "2014-01-02T02:20:00Z",
"creator": "creator-id_abcde12345",
"endTimeSeconds": 0,
"maxDurationSeconds": 1,
"meta": {
"name": "video12345.mp4"
},
"modified": "2014-01-02T02:20:00Z",
"playback": {
"dash": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.mpd",
"hls": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/manifest/video.m3u8"
},
"preview": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/ea95132c15732412d22c1476fa83f27a/watch",
"requireSignedURLs": true,
"startTimeSeconds": 0,
"status": "inprogress",
"thumbnailTimestampPct": 0.529241,
"watermark": {
"uid": "ea95132c15732412d22c1476fa83f27a"
}
}
}