Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion video/src/vonage_video/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.4.0'
__version__ = '1.5.1'
27 changes: 26 additions & 1 deletion video/src/vonage_video/models/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ class Transcription(BaseModel):
Args:
status (str, Optional): The status of the transcription.
reason (str, Optional): May give a brief reason for the transcription status.
url (str, Optional): The URL of the transcription file.
primaryLanguageCode (str, Optional): The primary language code for transcription.
hasSummary (bool, Optional): Whether the transcription includes a summary.
"""

status: Optional[str] = None
reason: Optional[str] = None
url: Optional[str] = None
primaryLanguageCode: Optional[str] = None
hasSummary: Optional[bool] = None


class Archive(BaseModel):
Expand Down Expand Up @@ -71,6 +77,9 @@ class Archive(BaseModel):
transcription (Transcription, Optional): Transcription options for the archive.
max_bitrate (int, Optional): The maximum video bitrate of the archive, in bits per
second. This is only valid for composed archives.
quantization_parameter (int, Optional): Quantization parameter (QP) for video encoding,
smaller values generate higher quality and larger archives, larger values generate
lower quality and smaller archives. Range: 15-40. Only valid for composed archives.
"""

id: Optional[str] = None
Expand All @@ -97,6 +106,9 @@ class Archive(BaseModel):
url: Optional[str] = None
transcription: Optional[Transcription] = None
max_bitrate: Optional[int] = Field(None, validation_alias='maxBitrate')
quantization_parameter: Optional[int] = Field(
None, validation_alias='quantizationParameter'
)


class CreateArchiveRequest(BaseModel):
Expand All @@ -119,9 +131,12 @@ class CreateArchiveRequest(BaseModel):
automatically ("auto", the default) or manually ("manual").
max_bitrate (int, Optional): The maximum video bitrate of the archive, in bits per
second. This is only valid for composed archives.
quantization_parameter (int, Optional): Quantization parameter (QP) for video encoding,
smaller values generate higher quality and larger archives, larger values generate
lower quality and smaller archives. Range: 15-40. Only valid for composed archives.
Raises:
NoAudioOrVideoError: If neither `has_audio` nor `has_video` is set.
IndividualArchivePropertyError: If `resolution` or `layout` is set for individual archives
IndividualArchivePropertyError: If `resolution`, `layout`, or `quantization_parameter` is set for individual archives
or if `has_transcription` is set for composed archives.
"""

Expand All @@ -140,6 +155,9 @@ class CreateArchiveRequest(BaseModel):
max_bitrate: Optional[int] = Field(
None, ge=100_000, le=6_000_000, serialization_alias='maxBitrate'
)
quantization_parameter: Optional[int] = Field(
None, ge=15, le=40, serialization_alias='quantizationParameter'
)

@model_validator(mode='after')
def validate_audio_or_video(self):
Expand All @@ -159,6 +177,13 @@ def no_layout_or_resolution_for_individual_archives(self):
raise IndividualArchivePropertyError(
'The `layout` property cannot be set for `archive_mode: \'individual\'`.'
)
if (
self.output_mode == OutputMode.INDIVIDUAL
and self.quantization_parameter is not None
):
raise IndividualArchivePropertyError(
'The `quantization_parameter` property cannot be set for `archive_mode: \'individual\'`.'
)
return self

@model_validator(mode='after')
Expand Down
3 changes: 2 additions & 1 deletion video/tests/data/archive.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
"event": "archive",
"resolution": "1280x720",
"url": null,
"maxBitrate": 2000000
"maxBitrate": 2000000,
"quantizationParameter": 25
}
30 changes: 30 additions & 0 deletions video/tests/data/archive_with_transcription.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"id": "5b1521e6-115f-4efd-bed9-e527b87f0699",
"status": "available",
"name": "archive with transcription",
"reason": "session ended",
"sessionId": "test_session_id",
"applicationId": "test_application_id",
"createdAt": 1727870434974,
"size": 1048576,
"duration": 180,
"outputMode": "individual",
"streamMode": "auto",
"hasAudio": true,
"hasVideo": true,
"hasTranscription": true,
"sha256sum": "abc123def456",
"password": "",
"updatedAt": 1727870634977,
"multiArchiveTag": "",
"event": "archive",
"resolution": "1280x720",
"url": "https://example.com/archive.mp4",
"transcription": {
"status": "completed",
"reason": "transcription completed successfully",
"url": "https://example.com/transcription.json",
"primaryLanguageCode": "en-US",
"hasSummary": true
}
}
82 changes: 82 additions & 0 deletions video/tests/data/list_archives_with_transcription.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"count": 3,
"items": [
{
"id": "5b1521e6-115f-4efd-bed9-e527b87f0699",
"status": "paused",
"name": "archive without transcription",
"reason": "",
"sessionId": "test_session_id",
"applicationId": "test_application_id",
"createdAt": 1727870434974,
"size": 0,
"duration": 0,
"outputMode": "composed",
"streamMode": "auto",
"hasAudio": true,
"hasVideo": true,
"hasTranscription": false,
"sha256sum": "",
"password": "",
"updatedAt": 1727870434977,
"multiArchiveTag": "",
"event": "archive",
"resolution": "1280x720",
"url": null
},
{
"id": "a9cdeb69-f6cf-408b-9197-6f99e6eac5aa",
"status": "available",
"name": "completed archive",
"reason": "session ended",
"sessionId": "test_session_id",
"applicationId": "test_application_id",
"createdAt": 1727870434974,
"size": 1024000,
"duration": 134,
"outputMode": "composed",
"streamMode": "auto",
"hasAudio": true,
"hasVideo": true,
"hasTranscription": false,
"sha256sum": "test_sha256_sum",
"password": "",
"updatedAt": 1727870634977,
"multiArchiveTag": "",
"event": "archive",
"resolution": "1280x720",
"url": "https://example.com/archive.mp4",
"maxBitrate": 2000000
},
{
"id": "c1d2e3f4-g5h6-i7j8-k9l0-m1n2o3p4q5r6",
"status": "available",
"name": "transcribed archive",
"reason": "session ended",
"sessionId": "test_session_id",
"applicationId": "test_application_id",
"createdAt": 1727870434974,
"size": 2048000,
"duration": 240,
"outputMode": "individual",
"streamMode": "auto",
"hasAudio": true,
"hasVideo": true,
"hasTranscription": true,
"sha256sum": "test_transcription_sha256",
"password": "",
"updatedAt": 1727870734977,
"multiArchiveTag": "",
"event": "archive",
"resolution": "1280x720",
"url": "https://example.com/transcribed_archive.mp4",
"transcription": {
"status": "completed",
"reason": "transcription completed successfully",
"url": "https://example.com/transcriptions/c1d2e3f4.json",
"primaryLanguageCode": "es-ES",
"hasSummary": true
}
}
]
}
Loading