CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-google-cloud-video-live-stream

Google Cloud Video Live Stream API client library that transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.

Pending
Overview
Eval results
Files

input-management.mddocs/

Input Management

Management of streaming input endpoints that receive live video streams via protocols like RTMP and SRT, with configuration for preprocessing, security rules, and stream properties.

Capabilities

Creating Inputs

Creates a new input endpoint that can receive live streams from external sources with specified protocol, tier, and configuration settings.

def create_input(
    self,
    request: Union[CreateInputRequest, dict] = None,
    *,
    parent: str = None,
    input: Input = None,
    input_id: str = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operation.Operation:
    """
    Creates an input with the provided unique ID in the specified region.

    Args:
        request: The request object containing parent, input_id, input, and request_id
        parent: Required. The parent location path (projects/{project}/locations/{location})
        input: Required. The input resource to create
        input_id: Required. The ID to use for the input (must be unique within parent)
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        google.api_core.operation.Operation: Long-running operation
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Listing Inputs

Retrieves a list of input endpoints with pagination and filtering capabilities.

def list_inputs(
    self,
    request: Union[ListInputsRequest, dict] = None,
    *,
    parent: str = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> pagers.ListInputsPager:
    """
    Returns a list of all inputs in the specified region.

    Args:
        request: The request object containing parent, page_size, page_token, filter, order_by
        parent: Required. The parent path (projects/{project}/locations/{location})
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        pagers.ListInputsPager: Pager for iterating over input results
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Getting Input Details

Retrieves detailed information about a specific input including its URI, stream properties, and current state.

def get_input(
    self,
    request: Union[GetInputRequest, dict] = None,
    *,
    name: str = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> Input:
    """
    Returns the specified input.

    Args:
        request: The request object containing name
        name: Required. The input name (projects/{project}/locations/{location}/inputs/{input})
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        Input: The input resource
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Updating Inputs

Updates input configuration including preprocessing settings, security rules, and other properties.

def update_input(
    self,
    request: Union[UpdateInputRequest, dict] = None,
    *,
    input: Input = None,
    update_mask: field_mask_pb2.FieldMask = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operation.Operation:
    """
    Updates the specified input.

    Args:
        request: The request object containing update_mask, input, and request_id
        input: Required. The input resource with updated fields
        update_mask: Required. Field mask specifying which fields to update
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        google.api_core.operation.Operation: Long-running operation
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Deleting Inputs

Permanently removes an input endpoint and all associated configuration data.

def delete_input(
    self,
    request: Union[DeleteInputRequest, dict] = None,
    *,
    name: str = None,
    retry: OptionalRetry = gapic_v1.method.DEFAULT,
    timeout: Union[float, object] = gapic_v1.method.DEFAULT,
    metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
) -> operation.Operation:
    """
    Deletes the specified input.

    Args:
        request: The request object containing name and request_id
        name: Required. The input name (projects/{project}/locations/{location}/inputs/{input})
        retry: Retry configuration for the request
        timeout: Request timeout in seconds
        metadata: Additional metadata for the request

    Returns:
        google.api_core.operation.Operation: Long-running operation
        
    Raises:
        google.api_core.exceptions.GoogleAPICallError: If the request fails
    """

Input Configuration Types

Input Resource

class Input:
    """
    Input resource represents the endpoint from which channels ingest input streams.
    
    Attributes:
        name (str): Input resource name
        create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp
        update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp
        labels (MutableMapping[str, str]): User-defined labels
        type_ (Type): Source type (RTMP_PUSH, SRT_PUSH, etc.)
        tier (Tier): Maximum input specification tier
        uri (str): Output only. URI to push the input stream to
        preprocessing_config (PreprocessingConfig): Preprocessing configurations
        security_rules (SecurityRule): Security rule for access control
        input_stream_property (InputStreamProperty): Output only. Input stream properties
    """
    
    class Type(proto.Enum):
        """Input type enumeration."""
        TYPE_UNSPECIFIED = 0
        RTMP_PUSH = 1
        SRT_PUSH = 2
    
    class Tier(proto.Enum):
        """Input tier enumeration defining maximum input specification."""
        TIER_UNSPECIFIED = 0
        SD = 1
        HD = 2
        UHD = 3
    
    class SecurityRule:
        """Security rule for controlling input access."""
        ip_ranges (MutableSequence[str]): Allowed IP address ranges in CIDR notation

Preprocessing Configuration

class PreprocessingConfig:
    """
    Preprocessing configurations for input streams.
    
    Attributes:
        color (Color): Color preprocessing settings
        deinterlace (Deinterlace): Deinterlacing settings
        denoise (Denoise): Noise reduction settings
        audio (Audio): Audio preprocessing settings
        crop (Crop): Cropping settings
        pad (Pad): Padding settings
    """
    
    class Color:
        """Color correction settings."""
        saturation (float): Saturation adjustment (-1.0 to 1.0)
        contrast (float): Contrast adjustment (-1.0 to 1.0)
        brightness (float): Brightness adjustment (-1.0 to 1.0)
    
    class Deinterlace:
        """Deinterlacing configuration."""
        yadif (Yadif): YADIF deinterlacing settings
        bwdif (Bwdif): BWDIF deinterlacing settings
    
    class Denoise:
        """Noise reduction settings."""
        strength (float): Denoise strength (0.0 to 1.0)
        tune (str): Tuning preset for noise reduction
    
    class Audio:
        """Audio preprocessing settings."""
        lufs (float): Target LUFS (Loudness Units relative to Full Scale)
        high_boost (bool): Enable high frequency boost
        low_boost (bool): Enable low frequency boost
    
    class Crop:
        """Cropping settings."""
        top_pixels (int): Pixels to crop from top
        bottom_pixels (int): Pixels to crop from bottom
        left_pixels (int): Pixels to crop from left
        right_pixels (int): Pixels to crop from right
    
    class Pad:
        """Padding settings."""
        top_pixels (int): Pixels to pad at top
        bottom_pixels (int): Pixels to pad at bottom
        left_pixels (int): Pixels to pad at left
        right_pixels (int): Pixels to pad at right

Stream Properties

class InputStreamProperty:
    """
    Properties of the input stream (populated when stream is active).
    
    Attributes:
        last_establish_time (google.protobuf.timestamp_pb2.Timestamp): Last connection time
        video_streams (MutableSequence[VideoStreamProperty]): Video stream properties
        audio_streams (MutableSequence[AudioStreamProperty]): Audio stream properties
    """

class VideoStreamProperty:
    """
    Video stream property information.
    
    Attributes:
        index (int): Stream index
        video_format (VideoFormat): Video format details
    """

class AudioStreamProperty:
    """
    Audio stream property information.
    
    Attributes:
        index (int): Stream index
        audio_format (AudioFormat): Audio format details
    """

class VideoFormat:
    """
    Video format specification.
    
    Attributes:
        codec (str): Video codec (h264, h265, etc.)
        width_pixels (int): Video width in pixels
        height_pixels (int): Video height in pixels
        frame_rate (float): Frame rate in frames per second
    """

class AudioFormat:
    """
    Audio format specification.
    
    Attributes:
        codec (str): Audio codec (aac, mp3, etc.)
        channel_count (int): Number of audio channels
        channel_layout (MutableSequence[str]): Channel layout (fl, fr, fc, etc.)
        sample_rate_hertz (int): Sample rate in hertz
    """

Usage Examples

Creating RTMP Input

from google.cloud.video import live_stream_v1

client = live_stream_v1.LivestreamServiceClient()

# Create basic RTMP input
input_resource = live_stream_v1.Input(
    type_=live_stream_v1.Input.Type.RTMP_PUSH,
    tier=live_stream_v1.Input.Tier.HD
)

request = live_stream_v1.CreateInputRequest(
    parent="projects/my-project/locations/us-central1",
    input_id="rtmp-input-1",
    input=input_resource
)

operation = client.create_input(request=request)
input_result = operation.result()
print(f"Created input: {input_result.name}")
print(f"Stream to: {input_result.uri}")

Creating Input with Security Rules

# Create input with IP restrictions
input_resource = live_stream_v1.Input(
    type_=live_stream_v1.Input.Type.RTMP_PUSH,
    tier=live_stream_v1.Input.Tier.HD,
    security_rules=live_stream_v1.Input.SecurityRule(
        ip_ranges=[
            "192.168.1.0/24",
            "10.0.0.0/8"
        ]
    )
)

request = live_stream_v1.CreateInputRequest(
    parent="projects/my-project/locations/us-central1",
    input_id="secure-input",
    input=input_resource
)

operation = client.create_input(request=request)

Creating Input with Preprocessing

# Create input with video and audio preprocessing
preprocessing = live_stream_v1.PreprocessingConfig(
    color=live_stream_v1.PreprocessingConfig.Color(
        saturation=0.1,
        contrast=0.05,
        brightness=-0.02
    ),
    deinterlace=live_stream_v1.PreprocessingConfig.Deinterlace(
        yadif=live_stream_v1.PreprocessingConfig.Deinterlace.Yadif(
            mode="send_frame",
            parity="auto",
            deint="all"
        )
    ),
    denoise=live_stream_v1.PreprocessingConfig.Denoise(
        strength=0.5,
        tune="hd"
    ),
    audio=live_stream_v1.PreprocessingConfig.Audio(
        lufs=-16.0,
        high_boost=True,
        low_boost=False
    ),
    crop=live_stream_v1.PreprocessingConfig.Crop(
        top_pixels=8,
        bottom_pixels=8,
        left_pixels=16,
        right_pixels=16
    )
)

input_resource = live_stream_v1.Input(
    type_=live_stream_v1.Input.Type.SRT_PUSH,
    tier=live_stream_v1.Input.Tier.UHD,
    preprocessing_config=preprocessing
)

request = live_stream_v1.CreateInputRequest(
    parent="projects/my-project/locations/us-central1",
    input_id="preprocessed-input",
    input=input_resource
)

Updating Input Configuration

from google.protobuf import field_mask_pb2

# Update preprocessing settings
updated_input = live_stream_v1.Input(
    name="projects/my-project/locations/us-central1/inputs/my-input",
    preprocessing_config=live_stream_v1.PreprocessingConfig(
        denoise=live_stream_v1.PreprocessingConfig.Denoise(
            strength=0.8,
            tune="film"
        )
    )
)

update_mask = field_mask_pb2.FieldMask(
    paths=["preprocessing_config.denoise"]
)

request = live_stream_v1.UpdateInputRequest(
    input=updated_input,
    update_mask=update_mask
)

operation = client.update_input(request=request)
updated_result = operation.result()

Install with Tessl CLI

npx tessl i tessl/pypi-google-cloud-video-live-stream

docs

asset-dvr-management.md

channel-management.md

clip-management.md

event-management.md

index.md

input-management.md

pool-management.md

tile.json