CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-media

Microsoft Azure Media Services Client Library for Python - A management library for Azure Media Services that provides programmatic access to media processing and streaming capabilities in the cloud.

83

1.09x

Quality

Pending

Does it follow best practices?

Impact

83%

1.09x

Average score across 10 eval scenarios

Overview
Eval results
Files

asset-tracks.mddocs/

Asset Tracks Management

Management of individual tracks within media assets including audio, video, and text tracks. Provides comprehensive track metadata handling, track data updates, and long-running track operations for detailed media content control.

Capabilities

Track Listing and Retrieval

List and retrieve individual tracks within media assets with detailed metadata.

def list(
    resource_group_name: str,
    account_name: str,
    asset_name: str
) -> Iterable[AssetTrack]:
    """
    List all tracks in a media asset.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str)
    - asset_name: Name of the asset (str)
    
    Returns:
    Iterable of AssetTrack objects with track metadata and properties
    """

def get(
    resource_group_name: str,
    account_name: str,
    asset_name: str,
    track_name: str
) -> AssetTrack:
    """
    Get a specific asset track with complete metadata.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str)
    - asset_name: Name of the asset (str)
    - track_name: Name of the track (str)
    
    Returns:
    AssetTrack object with detailed track information
    """

Track Creation and Updates

Create and update asset tracks with long-running operation support for comprehensive track management.

def begin_create_or_update(
    resource_group_name: str,
    account_name: str,
    asset_name: str,
    track_name: str,
    parameters: AssetTrack
) -> LROPoller[AssetTrack]:
    """
    Create or update an asset track.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str)
    - asset_name: Name of the asset (str)
    - track_name: Name for the track (str)
    - parameters: Track configuration and metadata (AssetTrack)
    
    Returns:
    LROPoller for tracking the creation/update operation
    """

def begin_update(
    resource_group_name: str,
    account_name: str,
    asset_name: str,
    track_name: str,
    parameters: AssetTrack
) -> LROPoller[AssetTrack]:
    """
    Update an existing asset track.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str)
    - asset_name: Name of the asset (str)
    - track_name: Name of the track (str)
    - parameters: Updated track configuration (AssetTrack)
    
    Returns:
    LROPoller for tracking the update operation
    """

def begin_delete(
    resource_group_name: str,
    account_name: str,
    asset_name: str,
    track_name: str
) -> LROPoller[None]:
    """
    Delete an asset track.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str)
    - asset_name: Name of the asset (str)
    - track_name: Name of the track (str)
    
    Returns:
    LROPoller for tracking the deletion operation
    """

Track Data Management

Update track data and content with specialized operations for track content modification.

def begin_update_track_data(
    resource_group_name: str,
    account_name: str,
    asset_name: str,
    track_name: str
) -> LROPoller[None]:
    """
    Update track data content.
    
    Parameters:
    - resource_group_name: Name of the resource group (str)
    - account_name: Name of the media service account (str) 
    - asset_name: Name of the asset (str)
    - track_name: Name of the track (str)
    
    Returns:
    LROPoller for tracking the track data update operation
    """

Data Types

class AssetTrack:
    """Individual track within a media asset."""
    name: str
    track: TrackBase
    provisioning_state: str
    
class TrackBase:
    """Base class for different track types."""
    pass
    
class AudioTrack(TrackBase):
    """Audio track with audio-specific properties."""
    file_name: str
    display_name: str
    language_code: str
    hls_settings: HlsSettings
    dash_settings: DashSettings
    mpeg4_track_id: int
    bitrate: int
    
class VideoTrack(TrackBase):
    """Video track with video-specific properties."""
    file_name: str
    display_name: str
    hls_settings: HlsSettings
    dash_settings: DashSettings
    mpeg4_track_id: int
    bitrate: int
    
class TextTrack(TrackBase):
    """Text/subtitle track with text-specific properties."""
    file_name: str
    display_name: str
    language_code: str
    hls_settings: HlsSettings
    dash_settings: DashSettings
    player_visibility: str  # Visible or Hidden
    
class HlsSettings:
    """HLS-specific track settings."""
    name: str
    group_id: str
    default: bool
    forced: bool
    characteristics: str
    
class DashSettings:
    """DASH-specific track settings."""
    role: str
    accessibility: str

Usage Examples

List Asset Tracks

from azure.mgmt.media import AzureMediaServices
from azure.identity import DefaultAzureCredential

client = AzureMediaServices(
    credential=DefaultAzureCredential(),
    subscription_id="your-subscription-id"
)

# List all tracks in an asset
tracks = client.tracks.list(
    resource_group_name="my-resource-group",
    account_name="my-media-service",
    asset_name="multi-track-asset"
)

for track in tracks:
    print(f"Track: {track.name}")
    
    if isinstance(track.track, AudioTrack):
        audio_track = track.track
        print(f"  Type: Audio")
        print(f"  Language: {audio_track.language_code}")
        print(f"  Bitrate: {audio_track.bitrate}")
        print(f"  File: {audio_track.file_name}")
        
    elif isinstance(track.track, VideoTrack):
        video_track = track.track
        print(f"  Type: Video")
        print(f"  Bitrate: {video_track.bitrate}")
        print(f"  File: {video_track.file_name}")
        
    elif isinstance(track.track, TextTrack):
        text_track = track.track
        print(f"  Type: Text/Subtitle")
        print(f"  Language: {text_track.language_code}")
        print(f"  Visibility: {text_track.player_visibility}")
        print(f"  File: {text_track.file_name}")

Create Text Track for Subtitles

from azure.mgmt.media.models import (
    AssetTrack, TextTrack, HlsSettings, DashSettings
)

# Configure HLS settings for subtitle track
hls_settings = HlsSettings(
    name="English Subtitles",
    group_id="subtitles",
    default=True,
    forced=False,
    characteristics="public.accessibility.describes-video"
)

# Configure DASH settings
dash_settings = DashSettings(
    role="subtitle",
    accessibility="urn:tva:metadata:cs:AudioPurposeCS:2007:1"
)

# Create text track
text_track = TextTrack(
    file_name="subtitles_en.vtt",
    display_name="English Subtitles",
    language_code="en-US",
    hls_settings=hls_settings,
    dash_settings=dash_settings,
    player_visibility="Visible"
)

asset_track = AssetTrack(track=text_track)

# Create the track
create_operation = client.tracks.begin_create_or_update(
    resource_group_name="my-resource-group",
    account_name="my-media-service",
    asset_name="video-asset",
    track_name="english-subtitles",
    parameters=asset_track
)

created_track = create_operation.result()
print(f"Text track created: {created_track.name}")

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-media

docs

asset-management.md

asset-tracks.md

content-delivery-streaming.md

content-protection.md

encoding-transforms.md

index.md

live-streaming.md

location-management.md

media-filters.md

media-services-management.md

network-security.md

operations-monitoring.md

tile.json