transcodely 0.3.15__tar.gz → 0.3.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {transcodely-0.3.15 → transcodely-0.3.17}/PKG-INFO +29 -2
- {transcodely-0.3.15 → transcodely-0.3.17}/README.md +28 -1
- {transcodely-0.3.15 → transcodely-0.3.17}/pyproject.toml +1 -1
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/__init__.py +4 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_transport/error_mapping.py +28 -1
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/videos.py +28 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/types.py +29 -15
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/content_aware_pb2.py +3 -3
- transcodely-0.3.17/src/transcodely/v1/video_pb2.py +259 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/video_pb2.pyi +87 -8
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/version.py +1 -1
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/webhooks/types.py +2 -0
- transcodely-0.3.15/src/transcodely/v1/video_pb2.py +0 -235
- {transcodely-0.3.15 → transcodely-0.3.17}/.gitignore +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/LICENSE +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/buf/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/buf/validate/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/buf/validate/validate_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/buf/validate/validate_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_codec/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_codec/json_codec.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_transport/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_transport/headers.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/_transport/transport.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/client.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/errors.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/pagination.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/py.typed +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/_helpers.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/api_keys.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/apps.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/billing.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/events.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/health.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/ingest_rules.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/jobs.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/memberships.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/organizations.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/origins.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/presets.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/users.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/resources/webhook_endpoints.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/streaming.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/api_key_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/api_key_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/app_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/app_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/billing_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/billing_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_av1_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_av1_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_h264_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_h264_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_h265_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_h265_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_vp9_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/codec_vp9_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/common_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/common_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/content_aware_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/drm_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/drm_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/hdr_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/hdr_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/health_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/health_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/ingest_rule_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/ingest_rule_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/job_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/job_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/media_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/media_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/membership_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/membership_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/organization_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/organization_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/origin_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/origin_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/preset_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/preset_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/streaming_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/streaming_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/subtitles_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/subtitles_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/thumbnails_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/thumbnails_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/user_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/user_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/watermark_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/watermark_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/webhook_pb2.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/v1/webhook_pb2.pyi +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/webhooks/__init__.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/webhooks/construct_event.py +0 -0
- {transcodely-0.3.15 → transcodely-0.3.17}/src/transcodely/webhooks/signature.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: transcodely
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.17
|
|
4
4
|
Summary: Official Python SDK for Transcodely — encode video to HLS, DASH and MP4 into your own S3, GCS or R2 bucket, with DRM and signed playback.
|
|
5
5
|
Project-URL: Homepage, https://www.transcodely.com
|
|
6
6
|
Project-URL: Documentation, https://www.transcodely.com/docs
|
|
@@ -219,6 +219,25 @@ print(ins.id, ins.status) # ins_..., INSIGHTS_STATUS_PENDING
|
|
|
219
219
|
|
|
220
220
|
The entry also appears on `video.insights`. The `video.insights.ready` and `video.insights.failed` webhook events carry the entry itself as a `TranscriptInsights` in `event.data`.
|
|
221
221
|
|
|
222
|
+
## Highlight clips
|
|
223
|
+
|
|
224
|
+
A hosted video with ready insights can get short MP4 highlight clips cut around the quotes insights picked (default up to 5 clips of 8 to 60 seconds, padded 1.5 s each side). Each clip bills its rendered minutes at your encoding rate, with no processing fee:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
# `language` is needed only when the video has insights in several languages;
|
|
228
|
+
# every `config` field is optional.
|
|
229
|
+
highlights = client.videos.generate_highlights(
|
|
230
|
+
id="vid_a1b2c3d4e5f6g7",
|
|
231
|
+
config={"max_count": 3},
|
|
232
|
+
)
|
|
233
|
+
for h in highlights:
|
|
234
|
+
print(h.id, h.start_seconds, h.end_seconds, h.status) # hl_..., VIDEO_HIGHLIGHT_STATUS_PENDING
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Or ask for them at upload time with `highlights={"enabled": True}` next to `auto_insights=True` (on `videos.create_upload`, `videos.create_from_url` and the multipart create). The clips appear on `video.highlights`; once one is ready it carries a `playback_url` and a `poster_url`. The `video.highlights.ready` and `video.highlights.failed` webhook events fire once the whole set has finished and carry the `Video` in `event.data`.
|
|
238
|
+
|
|
239
|
+
Each clip is rendered by an ordinary clip job, tagged with `transcodely_kind`, `transcodely_highlight_id` and `transcodely_video_id` metadata. Metadata keys starting with `transcodely_` are reserved for the platform: a job or ingest rule that sets one is refused with `parameter_invalid` on `metadata.<key>`.
|
|
240
|
+
|
|
222
241
|
## Authentication
|
|
223
242
|
|
|
224
243
|
```python
|
|
@@ -231,7 +250,7 @@ API keys are opaque `ak_`-prefixed secrets — pass the full value shown once at
|
|
|
231
250
|
|
|
232
251
|
```python
|
|
233
252
|
client.jobs # create / get / list / cancel / confirm / watch
|
|
234
|
-
client.videos # upload helpers, multipart, create_from_url, get / list / update / delete / watch, get_stats / list_top_videos / get_seo_markup / generate_insights
|
|
253
|
+
client.videos # upload helpers, multipart, create_from_url, get / list / update / delete / watch, get_stats / list_top_videos / get_seo_markup / generate_insights / generate_highlights
|
|
235
254
|
client.presets # create / get / get_by_slug / list / update / duplicate / archive
|
|
236
255
|
client.origins # create / get / list / update / validate / archive
|
|
237
256
|
client.ingest_rules # create / get / list / update / delete / list_events / test / replay_event
|
|
@@ -540,6 +559,14 @@ except TranscodelyError as err:
|
|
|
540
559
|
print(f"[{err.request_id}] {err.code}: {err}")
|
|
541
560
|
```
|
|
542
561
|
|
|
562
|
+
Every validation refusal, whether the request schema, a codec check or a feature
|
|
563
|
+
rule caught it, comes back as an `InvalidRequestError` listing every bad field
|
|
564
|
+
at once. Each violation's `description` starts with that field's error code in
|
|
565
|
+
brackets, for example `[parameter_out_of_range] value must be ...`, and `code`
|
|
566
|
+
holds the error type, such as `validation_error`, `invalid_request_error`,
|
|
567
|
+
`codec_error` or `feature_error`. A refusal that names no field carries no
|
|
568
|
+
detail, so its code is empty. `type` holds the Connect code, `invalid_argument`.
|
|
569
|
+
|
|
543
570
|
| Class | Status | When |
|
|
544
571
|
|---|---|---|
|
|
545
572
|
| `APIConnectionError` | — | Network / DNS / TLS failure |
|
|
@@ -182,6 +182,25 @@ print(ins.id, ins.status) # ins_..., INSIGHTS_STATUS_PENDING
|
|
|
182
182
|
|
|
183
183
|
The entry also appears on `video.insights`. The `video.insights.ready` and `video.insights.failed` webhook events carry the entry itself as a `TranscriptInsights` in `event.data`.
|
|
184
184
|
|
|
185
|
+
## Highlight clips
|
|
186
|
+
|
|
187
|
+
A hosted video with ready insights can get short MP4 highlight clips cut around the quotes insights picked (default up to 5 clips of 8 to 60 seconds, padded 1.5 s each side). Each clip bills its rendered minutes at your encoding rate, with no processing fee:
|
|
188
|
+
|
|
189
|
+
```python
|
|
190
|
+
# `language` is needed only when the video has insights in several languages;
|
|
191
|
+
# every `config` field is optional.
|
|
192
|
+
highlights = client.videos.generate_highlights(
|
|
193
|
+
id="vid_a1b2c3d4e5f6g7",
|
|
194
|
+
config={"max_count": 3},
|
|
195
|
+
)
|
|
196
|
+
for h in highlights:
|
|
197
|
+
print(h.id, h.start_seconds, h.end_seconds, h.status) # hl_..., VIDEO_HIGHLIGHT_STATUS_PENDING
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Or ask for them at upload time with `highlights={"enabled": True}` next to `auto_insights=True` (on `videos.create_upload`, `videos.create_from_url` and the multipart create). The clips appear on `video.highlights`; once one is ready it carries a `playback_url` and a `poster_url`. The `video.highlights.ready` and `video.highlights.failed` webhook events fire once the whole set has finished and carry the `Video` in `event.data`.
|
|
201
|
+
|
|
202
|
+
Each clip is rendered by an ordinary clip job, tagged with `transcodely_kind`, `transcodely_highlight_id` and `transcodely_video_id` metadata. Metadata keys starting with `transcodely_` are reserved for the platform: a job or ingest rule that sets one is refused with `parameter_invalid` on `metadata.<key>`.
|
|
203
|
+
|
|
185
204
|
## Authentication
|
|
186
205
|
|
|
187
206
|
```python
|
|
@@ -194,7 +213,7 @@ API keys are opaque `ak_`-prefixed secrets — pass the full value shown once at
|
|
|
194
213
|
|
|
195
214
|
```python
|
|
196
215
|
client.jobs # create / get / list / cancel / confirm / watch
|
|
197
|
-
client.videos # upload helpers, multipart, create_from_url, get / list / update / delete / watch, get_stats / list_top_videos / get_seo_markup / generate_insights
|
|
216
|
+
client.videos # upload helpers, multipart, create_from_url, get / list / update / delete / watch, get_stats / list_top_videos / get_seo_markup / generate_insights / generate_highlights
|
|
198
217
|
client.presets # create / get / get_by_slug / list / update / duplicate / archive
|
|
199
218
|
client.origins # create / get / list / update / validate / archive
|
|
200
219
|
client.ingest_rules # create / get / list / update / delete / list_events / test / replay_event
|
|
@@ -503,6 +522,14 @@ except TranscodelyError as err:
|
|
|
503
522
|
print(f"[{err.request_id}] {err.code}: {err}")
|
|
504
523
|
```
|
|
505
524
|
|
|
525
|
+
Every validation refusal, whether the request schema, a codec check or a feature
|
|
526
|
+
rule caught it, comes back as an `InvalidRequestError` listing every bad field
|
|
527
|
+
at once. Each violation's `description` starts with that field's error code in
|
|
528
|
+
brackets, for example `[parameter_out_of_range] value must be ...`, and `code`
|
|
529
|
+
holds the error type, such as `validation_error`, `invalid_request_error`,
|
|
530
|
+
`codec_error` or `feature_error`. A refusal that names no field carries no
|
|
531
|
+
detail, so its code is empty. `type` holds the Connect code, `invalid_argument`.
|
|
532
|
+
|
|
506
533
|
| Class | Status | When |
|
|
507
534
|
|---|---|---|
|
|
508
535
|
| `APIConnectionError` | — | Network / DNS / TLS failure |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "transcodely"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.17"
|
|
8
8
|
description = "Official Python SDK for Transcodely — encode video to HLS, DASH and MP4 into your own S3, GCS or R2 bucket, with DRM and signed playback."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -66,6 +66,7 @@ from .types import (
|
|
|
66
66
|
DASHConfig,
|
|
67
67
|
DRMConfig,
|
|
68
68
|
HDRConfig,
|
|
69
|
+
HighlightsConfig,
|
|
69
70
|
HLSConfig,
|
|
70
71
|
IngestRule,
|
|
71
72
|
InsightsOptions,
|
|
@@ -102,6 +103,7 @@ from .types import (
|
|
|
102
103
|
UserWithOrganizations,
|
|
103
104
|
Video,
|
|
104
105
|
VideoCodec,
|
|
106
|
+
VideoHighlight,
|
|
105
107
|
VideoRendition,
|
|
106
108
|
VideoTextTrack,
|
|
107
109
|
VideoVariant,
|
|
@@ -157,6 +159,7 @@ __all__ = [
|
|
|
157
159
|
"FieldViolation",
|
|
158
160
|
"HDRConfig",
|
|
159
161
|
"HLSConfig",
|
|
162
|
+
"HighlightsConfig",
|
|
160
163
|
"IngestRule",
|
|
161
164
|
"InsightsOptions",
|
|
162
165
|
"InvalidRequestError",
|
|
@@ -201,6 +204,7 @@ __all__ = [
|
|
|
201
204
|
"UserWithOrganizations",
|
|
202
205
|
"Video",
|
|
203
206
|
"VideoCodec",
|
|
207
|
+
"VideoHighlight",
|
|
204
208
|
"VideoRendition",
|
|
205
209
|
"VideoTextTrack",
|
|
206
210
|
"VideoVariant",
|
|
@@ -25,7 +25,7 @@ def map_http_error(*, status: int, body: Any, headers: Mapping[str, str]) -> Tra
|
|
|
25
25
|
request_id = _header(headers, "x-request-id")
|
|
26
26
|
parsed = _parse_body(body)
|
|
27
27
|
message = parsed.get("message") or f"HTTP {status}"
|
|
28
|
-
detail = (parsed.get("details")
|
|
28
|
+
detail = _error_details(parsed.get("details"))
|
|
29
29
|
code = detail.get("code")
|
|
30
30
|
raw_violations = detail.get("field_violations") or detail.get("fieldViolations") or []
|
|
31
31
|
violations = [
|
|
@@ -77,6 +77,33 @@ def connection_error(cause: BaseException, message: str | None = None) -> APICon
|
|
|
77
77
|
return err
|
|
78
78
|
|
|
79
79
|
|
|
80
|
+
_ERROR_DETAILS_TYPE = "transcodely.v1.ErrorDetails"
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _error_details(details: Any) -> dict[str, Any]:
|
|
84
|
+
"""Return the debug payload of the first ErrorDetails detail, or ``{}``.
|
|
85
|
+
|
|
86
|
+
A detail is read when its type names ErrorDetails, or when it has no type
|
|
87
|
+
(bodies that omit it). A detail of any other type, or one that is not an
|
|
88
|
+
object, is skipped, so the error degrades to its message instead of taking
|
|
89
|
+
a foreign detail's fields.
|
|
90
|
+
"""
|
|
91
|
+
if not isinstance(details, list):
|
|
92
|
+
return {}
|
|
93
|
+
for d in details:
|
|
94
|
+
if not isinstance(d, dict):
|
|
95
|
+
continue
|
|
96
|
+
typ = d.get("type")
|
|
97
|
+
if (
|
|
98
|
+
typ is None
|
|
99
|
+
or typ == _ERROR_DETAILS_TYPE
|
|
100
|
+
or str(typ).endswith("/" + _ERROR_DETAILS_TYPE)
|
|
101
|
+
):
|
|
102
|
+
debug = d.get("debug")
|
|
103
|
+
return debug if isinstance(debug, dict) else {}
|
|
104
|
+
return {}
|
|
105
|
+
|
|
106
|
+
|
|
80
107
|
def _parse_body(body: Any) -> dict[str, Any]:
|
|
81
108
|
if isinstance(body, dict):
|
|
82
109
|
return body
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import builtins
|
|
5
6
|
from collections.abc import Generator
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
@@ -192,3 +193,30 @@ class Videos:
|
|
|
192
193
|
return self._t.unary(
|
|
193
194
|
_SERVICE, "GenerateInsights", req, video_pb2.GenerateInsightsResponse()
|
|
194
195
|
).insights
|
|
196
|
+
|
|
197
|
+
def generate_highlights(self, **kwargs: Any) -> builtins.list[video_pb2.VideoHighlight]:
|
|
198
|
+
"""Cut highlight clips from a hosted video around its insights' quotes.
|
|
199
|
+
|
|
200
|
+
Pass ``id`` (the ``vid_...`` video, required), plus optional
|
|
201
|
+
``language`` (ISO 639-2; needed only when the video has ready insights
|
|
202
|
+
in several languages), ``config`` (a dict or ``HighlightsConfig``:
|
|
203
|
+
``max_count`` 1-10, default 5; ``min_seconds`` default 8;
|
|
204
|
+
``max_seconds`` default 60; ``padding_seconds`` default 1.5) and
|
|
205
|
+
``app_id``. Returns the highlights in ``"pending"``; they also appear on
|
|
206
|
+
``video.highlights``, and ``video.highlights.ready`` (or
|
|
207
|
+
``video.highlights.failed``, when none could be rendered) fires once
|
|
208
|
+
every one has finished.
|
|
209
|
+
|
|
210
|
+
Each clip is its own clip job on the video, billed as its rendered
|
|
211
|
+
(clipped) minutes at your effective encoding rate, with no processing
|
|
212
|
+
fee. While any highlight of the video is pending, the call returns the
|
|
213
|
+
current set and bills nothing new; once all are ready or failed, a new
|
|
214
|
+
call replaces them. A video without ready insights is refused with
|
|
215
|
+
failed_precondition (code ``highlights_require_insights``).
|
|
216
|
+
"""
|
|
217
|
+
req = fill_from_dict(video_pb2.GenerateHighlightsRequest(), kwargs)
|
|
218
|
+
return list(
|
|
219
|
+
self._t.unary(
|
|
220
|
+
_SERVICE, "GenerateHighlights", req, video_pb2.GenerateHighlightsResponse()
|
|
221
|
+
).highlights
|
|
222
|
+
)
|
|
@@ -140,23 +140,27 @@ from transcodely.v1.common_pb2 import (
|
|
|
140
140
|
VideoCodec,
|
|
141
141
|
)
|
|
142
142
|
|
|
143
|
-
# ``ContentAwareConfig``
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
143
|
+
# ``ContentAwareConfig`` tunes one output's encode to its content, billed at 1.5x
|
|
144
|
+
# when the analysis shapes the encode. Both modes are accepted at create.
|
|
145
|
+
#
|
|
146
|
+
# ``CONTENT_AWARE_MODE_PER_TITLE``: the worker finds the CRF this source needs to reach the VMAF
|
|
147
|
+
# target and encodes the declared ladder at it. The ladder is unchanged, so the
|
|
148
|
+
# price quoted at create still holds. It needs at least one video rendition that
|
|
149
|
+
# is not pinned to an explicit bitrate (``parameter_incompatible`` at create) and
|
|
150
|
+
# a source of at least 120 seconds (``per_title_source_too_short``, at probe).
|
|
148
151
|
#
|
|
149
|
-
# ``
|
|
150
|
-
#
|
|
151
|
-
#
|
|
152
|
-
#
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
#
|
|
152
|
+
# ``CONTENT_AWARE_MODE_AUTO_ABR`` (hls, dash or adaptive outputs only): declare one seed video
|
|
153
|
+
# rendition with no resolution, width, height or bitrate, plus optional bounds in
|
|
154
|
+
# ``AutoABRConfig``. The API expands the seed into a ceiling of standard rungs
|
|
155
|
+
# (480p up to 1080p by default, never above the source), the worker drops the
|
|
156
|
+
# rungs the content does not need, and you are billed for the rungs rendered,
|
|
157
|
+
# never above the estimate. On a source too short to analyse, the whole ceiling
|
|
158
|
+
# renders at the quality tier's static settings and is billed at 1.0x.
|
|
156
159
|
#
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
+
# Either mode is refused with ``parameter_forbidden`` on an output that has an
|
|
161
|
+
# ``HDR_MODE_TONEMAP`` variant, and an auto_abr block sent with per_title is
|
|
162
|
+
# refused the same way. What the analysis decided comes back on
|
|
163
|
+
# ``report.content_aware``.
|
|
160
164
|
from transcodely.v1.content_aware_pb2 import (
|
|
161
165
|
AutoABRConfig,
|
|
162
166
|
ContentAnalysis,
|
|
@@ -405,6 +409,8 @@ from transcodely.v1.video_pb2 import (
|
|
|
405
409
|
CreateUploadResponse,
|
|
406
410
|
DailyUsage,
|
|
407
411
|
DeleteVideoRequest,
|
|
412
|
+
GenerateHighlightsRequest,
|
|
413
|
+
GenerateHighlightsResponse,
|
|
408
414
|
GenerateInsightsRequest,
|
|
409
415
|
GenerateInsightsResponse,
|
|
410
416
|
GetSeoMarkupRequest,
|
|
@@ -417,6 +423,7 @@ from transcodely.v1.video_pb2 import (
|
|
|
417
423
|
GetUsageResponse,
|
|
418
424
|
GetVideoRequest,
|
|
419
425
|
GetVideoResponse,
|
|
426
|
+
HighlightsConfig,
|
|
420
427
|
ListTopVideosRequest,
|
|
421
428
|
ListTopVideosResponse,
|
|
422
429
|
ListVideosRequest,
|
|
@@ -427,6 +434,8 @@ from transcodely.v1.video_pb2 import (
|
|
|
427
434
|
UploadPart,
|
|
428
435
|
UsageSummary,
|
|
429
436
|
Video,
|
|
437
|
+
VideoHighlight,
|
|
438
|
+
VideoHighlightStatus,
|
|
430
439
|
VideoRendition,
|
|
431
440
|
VideoStatsDay,
|
|
432
441
|
VideoStatsTotals,
|
|
@@ -574,6 +583,8 @@ __all__ = [
|
|
|
574
583
|
"GOPAlignmentMode",
|
|
575
584
|
"GcsCredentials",
|
|
576
585
|
"GcsOriginConfig",
|
|
586
|
+
"GenerateHighlightsRequest",
|
|
587
|
+
"GenerateHighlightsResponse",
|
|
577
588
|
"GenerateInsightsRequest",
|
|
578
589
|
"GenerateInsightsResponse",
|
|
579
590
|
"GetAPIKeyRequest",
|
|
@@ -633,6 +644,7 @@ __all__ = [
|
|
|
633
644
|
"HealthBucket",
|
|
634
645
|
"HealthCheckRequest",
|
|
635
646
|
"HealthCheckResponse",
|
|
647
|
+
"HighlightsConfig",
|
|
636
648
|
"HostingConfig",
|
|
637
649
|
"HttpCredentials",
|
|
638
650
|
"HttpOriginConfig",
|
|
@@ -801,6 +813,8 @@ __all__ = [
|
|
|
801
813
|
"VariantPricingSnapshot",
|
|
802
814
|
"Video",
|
|
803
815
|
"VideoCodec",
|
|
816
|
+
"VideoHighlight",
|
|
817
|
+
"VideoHighlightStatus",
|
|
804
818
|
"VideoRendition",
|
|
805
819
|
"VideoSettings",
|
|
806
820
|
"VideoStatsDay",
|
|
@@ -26,7 +26,7 @@ from buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2
|
|
|
26
26
|
from transcodely.v1 import common_pb2 as transcodely_dot_v1_dot_common__pb2
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"transcodely/v1/content_aware.proto\x12\x0etranscodely.v1\x1a\x1b\x62uf/validate/validate.proto\x1a\x1btranscodely/v1/common.proto\"\xb1\x02\n\rAutoABRConfig\x12\x31\n\x0cmin_variants\x18\x01 \x01(\x05\x42\t\xbaH\x06\x1a\x04\x18\x14(\
|
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\"transcodely/v1/content_aware.proto\x12\x0etranscodely.v1\x1a\x1b\x62uf/validate/validate.proto\x1a\x1btranscodely/v1/common.proto\"\xb1\x02\n\rAutoABRConfig\x12\x31\n\x0cmin_variants\x18\x01 \x01(\x05\x42\t\xbaH\x06\x1a\x04\x18\x14(\x01H\x00R\x0bminVariants\x88\x01\x01\x12\x31\n\x0cmax_variants\x18\x02 \x01(\x05\x42\t\xbaH\x06\x1a\x04\x18\x14(\x01H\x01R\x0bmaxVariants\x88\x01\x01\x12K\n\x0emin_resolution\x18\x03 \x01(\x0e\x32\x1a.transcodely.v1.ResolutionB\x08\xbaH\x05\x82\x01\x02\x10\x01R\rminResolution\x12K\n\x0emax_resolution\x18\x04 \x01(\x0e\x32\x1a.transcodely.v1.ResolutionB\x08\xbaH\x05\x82\x01\x02\x10\x01R\rmaxResolutionB\x0f\n\r_min_variantsB\x0f\n\r_max_variants\"\xf2\x01\n\x12\x43ontentAwareConfig\x12\x41\n\x04mode\x18\x01 \x01(\x0e\x32 .transcodely.v1.ContentAwareModeB\x0b\xbaH\x08\x82\x01\x02\x10\x01\xc8\x01\x01R\x04mode\x12=\n\x0bvmaf_target\x18\x02 \x01(\x01\x42\x17\xbaH\x14\x12\x12\x19\x00\x00\x00\x00\x00@X@)\x00\x00\x00\x00\x00\x00T@H\x00R\nvmafTarget\x88\x01\x01\x12=\n\x08\x61uto_abr\x18\x03 \x01(\x0b\x32\x1d.transcodely.v1.AutoABRConfigH\x01R\x07\x61utoAbr\x88\x01\x01\x42\x0e\n\x0c_vmaf_targetB\x0b\n\t_auto_abr\"\xa7\x01\n\x0f\x43ontentAnalysis\x12)\n\x10\x63omplexity_score\x18\x01 \x01(\x01R\x0f\x63omplexityScore\x12!\n\x0cmotion_score\x18\x02 \x01(\x01R\x0bmotionScore\x12#\n\rtexture_score\x18\x03 \x01(\x01R\x0ctextureScore\x12!\n\x0c\x63ontent_type\x18\x04 \x01(\tR\x0b\x63ontentType*y\n\x10\x43ontentAwareMode\x12\"\n\x1e\x43ONTENT_AWARE_MODE_UNSPECIFIED\x10\x00\x12 \n\x1c\x43ONTENT_AWARE_MODE_PER_TITLE\x10\x01\x12\x1f\n\x1b\x43ONTENT_AWARE_MODE_AUTO_ABR\x10\x02\x62\x06proto3')
|
|
30
30
|
|
|
31
31
|
_globals = globals()
|
|
32
32
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -34,9 +34,9 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'transcodely.v1.content_awar
|
|
|
34
34
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
35
35
|
DESCRIPTOR._loaded_options = None
|
|
36
36
|
_globals['_AUTOABRCONFIG'].fields_by_name['min_variants']._loaded_options = None
|
|
37
|
-
_globals['_AUTOABRCONFIG'].fields_by_name['min_variants']._serialized_options = b'\272H\006\032\004\030\024(\
|
|
37
|
+
_globals['_AUTOABRCONFIG'].fields_by_name['min_variants']._serialized_options = b'\272H\006\032\004\030\024(\001'
|
|
38
38
|
_globals['_AUTOABRCONFIG'].fields_by_name['max_variants']._loaded_options = None
|
|
39
|
-
_globals['_AUTOABRCONFIG'].fields_by_name['max_variants']._serialized_options = b'\272H\006\032\004\030\024(\
|
|
39
|
+
_globals['_AUTOABRCONFIG'].fields_by_name['max_variants']._serialized_options = b'\272H\006\032\004\030\024(\001'
|
|
40
40
|
_globals['_AUTOABRCONFIG'].fields_by_name['min_resolution']._loaded_options = None
|
|
41
41
|
_globals['_AUTOABRCONFIG'].fields_by_name['min_resolution']._serialized_options = b'\272H\005\202\001\002\020\001'
|
|
42
42
|
_globals['_AUTOABRCONFIG'].fields_by_name['max_resolution']._loaded_options = None
|