0
# Input Management
1
2
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.
3
4
## Capabilities
5
6
### Creating Inputs
7
8
Creates a new input endpoint that can receive live streams from external sources with specified protocol, tier, and configuration settings.
9
10
```python { .api }
11
def create_input(
12
self,
13
request: Union[CreateInputRequest, dict] = None,
14
*,
15
parent: str = None,
16
input: Input = None,
17
input_id: str = None,
18
retry: OptionalRetry = gapic_v1.method.DEFAULT,
19
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
21
) -> operation.Operation:
22
"""
23
Creates an input with the provided unique ID in the specified region.
24
25
Args:
26
request: The request object containing parent, input_id, input, and request_id
27
parent: Required. The parent location path (projects/{project}/locations/{location})
28
input: Required. The input resource to create
29
input_id: Required. The ID to use for the input (must be unique within parent)
30
retry: Retry configuration for the request
31
timeout: Request timeout in seconds
32
metadata: Additional metadata for the request
33
34
Returns:
35
google.api_core.operation.Operation: Long-running operation
36
37
Raises:
38
google.api_core.exceptions.GoogleAPICallError: If the request fails
39
"""
40
```
41
42
### Listing Inputs
43
44
Retrieves a list of input endpoints with pagination and filtering capabilities.
45
46
```python { .api }
47
def list_inputs(
48
self,
49
request: Union[ListInputsRequest, dict] = None,
50
*,
51
parent: str = None,
52
retry: OptionalRetry = gapic_v1.method.DEFAULT,
53
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
54
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
55
) -> pagers.ListInputsPager:
56
"""
57
Returns a list of all inputs in the specified region.
58
59
Args:
60
request: The request object containing parent, page_size, page_token, filter, order_by
61
parent: Required. The parent path (projects/{project}/locations/{location})
62
retry: Retry configuration for the request
63
timeout: Request timeout in seconds
64
metadata: Additional metadata for the request
65
66
Returns:
67
pagers.ListInputsPager: Pager for iterating over input results
68
69
Raises:
70
google.api_core.exceptions.GoogleAPICallError: If the request fails
71
"""
72
```
73
74
### Getting Input Details
75
76
Retrieves detailed information about a specific input including its URI, stream properties, and current state.
77
78
```python { .api }
79
def get_input(
80
self,
81
request: Union[GetInputRequest, dict] = None,
82
*,
83
name: str = None,
84
retry: OptionalRetry = gapic_v1.method.DEFAULT,
85
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
86
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
87
) -> Input:
88
"""
89
Returns the specified input.
90
91
Args:
92
request: The request object containing name
93
name: Required. The input name (projects/{project}/locations/{location}/inputs/{input})
94
retry: Retry configuration for the request
95
timeout: Request timeout in seconds
96
metadata: Additional metadata for the request
97
98
Returns:
99
Input: The input resource
100
101
Raises:
102
google.api_core.exceptions.GoogleAPICallError: If the request fails
103
"""
104
```
105
106
### Updating Inputs
107
108
Updates input configuration including preprocessing settings, security rules, and other properties.
109
110
```python { .api }
111
def update_input(
112
self,
113
request: Union[UpdateInputRequest, dict] = None,
114
*,
115
input: Input = None,
116
update_mask: field_mask_pb2.FieldMask = None,
117
retry: OptionalRetry = gapic_v1.method.DEFAULT,
118
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
119
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
120
) -> operation.Operation:
121
"""
122
Updates the specified input.
123
124
Args:
125
request: The request object containing update_mask, input, and request_id
126
input: Required. The input resource with updated fields
127
update_mask: Required. Field mask specifying which fields to update
128
retry: Retry configuration for the request
129
timeout: Request timeout in seconds
130
metadata: Additional metadata for the request
131
132
Returns:
133
google.api_core.operation.Operation: Long-running operation
134
135
Raises:
136
google.api_core.exceptions.GoogleAPICallError: If the request fails
137
"""
138
```
139
140
### Deleting Inputs
141
142
Permanently removes an input endpoint and all associated configuration data.
143
144
```python { .api }
145
def delete_input(
146
self,
147
request: Union[DeleteInputRequest, dict] = None,
148
*,
149
name: str = None,
150
retry: OptionalRetry = gapic_v1.method.DEFAULT,
151
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
152
metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
153
) -> operation.Operation:
154
"""
155
Deletes the specified input.
156
157
Args:
158
request: The request object containing name and request_id
159
name: Required. The input name (projects/{project}/locations/{location}/inputs/{input})
160
retry: Retry configuration for the request
161
timeout: Request timeout in seconds
162
metadata: Additional metadata for the request
163
164
Returns:
165
google.api_core.operation.Operation: Long-running operation
166
167
Raises:
168
google.api_core.exceptions.GoogleAPICallError: If the request fails
169
"""
170
```
171
172
## Input Configuration Types
173
174
### Input Resource
175
176
```python { .api }
177
class Input:
178
"""
179
Input resource represents the endpoint from which channels ingest input streams.
180
181
Attributes:
182
name (str): Input resource name
183
create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp
184
update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp
185
labels (MutableMapping[str, str]): User-defined labels
186
type_ (Type): Source type (RTMP_PUSH, SRT_PUSH, etc.)
187
tier (Tier): Maximum input specification tier
188
uri (str): Output only. URI to push the input stream to
189
preprocessing_config (PreprocessingConfig): Preprocessing configurations
190
security_rules (SecurityRule): Security rule for access control
191
input_stream_property (InputStreamProperty): Output only. Input stream properties
192
"""
193
194
class Type(proto.Enum):
195
"""Input type enumeration."""
196
TYPE_UNSPECIFIED = 0
197
RTMP_PUSH = 1
198
SRT_PUSH = 2
199
200
class Tier(proto.Enum):
201
"""Input tier enumeration defining maximum input specification."""
202
TIER_UNSPECIFIED = 0
203
SD = 1
204
HD = 2
205
UHD = 3
206
207
class SecurityRule:
208
"""Security rule for controlling input access."""
209
ip_ranges (MutableSequence[str]): Allowed IP address ranges in CIDR notation
210
```
211
212
### Preprocessing Configuration
213
214
```python { .api }
215
class PreprocessingConfig:
216
"""
217
Preprocessing configurations for input streams.
218
219
Attributes:
220
color (Color): Color preprocessing settings
221
deinterlace (Deinterlace): Deinterlacing settings
222
denoise (Denoise): Noise reduction settings
223
audio (Audio): Audio preprocessing settings
224
crop (Crop): Cropping settings
225
pad (Pad): Padding settings
226
"""
227
228
class Color:
229
"""Color correction settings."""
230
saturation (float): Saturation adjustment (-1.0 to 1.0)
231
contrast (float): Contrast adjustment (-1.0 to 1.0)
232
brightness (float): Brightness adjustment (-1.0 to 1.0)
233
234
class Deinterlace:
235
"""Deinterlacing configuration."""
236
yadif (Yadif): YADIF deinterlacing settings
237
bwdif (Bwdif): BWDIF deinterlacing settings
238
239
class Denoise:
240
"""Noise reduction settings."""
241
strength (float): Denoise strength (0.0 to 1.0)
242
tune (str): Tuning preset for noise reduction
243
244
class Audio:
245
"""Audio preprocessing settings."""
246
lufs (float): Target LUFS (Loudness Units relative to Full Scale)
247
high_boost (bool): Enable high frequency boost
248
low_boost (bool): Enable low frequency boost
249
250
class Crop:
251
"""Cropping settings."""
252
top_pixels (int): Pixels to crop from top
253
bottom_pixels (int): Pixels to crop from bottom
254
left_pixels (int): Pixels to crop from left
255
right_pixels (int): Pixels to crop from right
256
257
class Pad:
258
"""Padding settings."""
259
top_pixels (int): Pixels to pad at top
260
bottom_pixels (int): Pixels to pad at bottom
261
left_pixels (int): Pixels to pad at left
262
right_pixels (int): Pixels to pad at right
263
```
264
265
### Stream Properties
266
267
```python { .api }
268
class InputStreamProperty:
269
"""
270
Properties of the input stream (populated when stream is active).
271
272
Attributes:
273
last_establish_time (google.protobuf.timestamp_pb2.Timestamp): Last connection time
274
video_streams (MutableSequence[VideoStreamProperty]): Video stream properties
275
audio_streams (MutableSequence[AudioStreamProperty]): Audio stream properties
276
"""
277
278
class VideoStreamProperty:
279
"""
280
Video stream property information.
281
282
Attributes:
283
index (int): Stream index
284
video_format (VideoFormat): Video format details
285
"""
286
287
class AudioStreamProperty:
288
"""
289
Audio stream property information.
290
291
Attributes:
292
index (int): Stream index
293
audio_format (AudioFormat): Audio format details
294
"""
295
296
class VideoFormat:
297
"""
298
Video format specification.
299
300
Attributes:
301
codec (str): Video codec (h264, h265, etc.)
302
width_pixels (int): Video width in pixels
303
height_pixels (int): Video height in pixels
304
frame_rate (float): Frame rate in frames per second
305
"""
306
307
class AudioFormat:
308
"""
309
Audio format specification.
310
311
Attributes:
312
codec (str): Audio codec (aac, mp3, etc.)
313
channel_count (int): Number of audio channels
314
channel_layout (MutableSequence[str]): Channel layout (fl, fr, fc, etc.)
315
sample_rate_hertz (int): Sample rate in hertz
316
"""
317
```
318
319
## Usage Examples
320
321
### Creating RTMP Input
322
323
```python
324
from google.cloud.video import live_stream_v1
325
326
client = live_stream_v1.LivestreamServiceClient()
327
328
# Create basic RTMP input
329
input_resource = live_stream_v1.Input(
330
type_=live_stream_v1.Input.Type.RTMP_PUSH,
331
tier=live_stream_v1.Input.Tier.HD
332
)
333
334
request = live_stream_v1.CreateInputRequest(
335
parent="projects/my-project/locations/us-central1",
336
input_id="rtmp-input-1",
337
input=input_resource
338
)
339
340
operation = client.create_input(request=request)
341
input_result = operation.result()
342
print(f"Created input: {input_result.name}")
343
print(f"Stream to: {input_result.uri}")
344
```
345
346
### Creating Input with Security Rules
347
348
```python
349
# Create input with IP restrictions
350
input_resource = live_stream_v1.Input(
351
type_=live_stream_v1.Input.Type.RTMP_PUSH,
352
tier=live_stream_v1.Input.Tier.HD,
353
security_rules=live_stream_v1.Input.SecurityRule(
354
ip_ranges=[
355
"192.168.1.0/24",
356
"10.0.0.0/8"
357
]
358
)
359
)
360
361
request = live_stream_v1.CreateInputRequest(
362
parent="projects/my-project/locations/us-central1",
363
input_id="secure-input",
364
input=input_resource
365
)
366
367
operation = client.create_input(request=request)
368
```
369
370
### Creating Input with Preprocessing
371
372
```python
373
# Create input with video and audio preprocessing
374
preprocessing = live_stream_v1.PreprocessingConfig(
375
color=live_stream_v1.PreprocessingConfig.Color(
376
saturation=0.1,
377
contrast=0.05,
378
brightness=-0.02
379
),
380
deinterlace=live_stream_v1.PreprocessingConfig.Deinterlace(
381
yadif=live_stream_v1.PreprocessingConfig.Deinterlace.Yadif(
382
mode="send_frame",
383
parity="auto",
384
deint="all"
385
)
386
),
387
denoise=live_stream_v1.PreprocessingConfig.Denoise(
388
strength=0.5,
389
tune="hd"
390
),
391
audio=live_stream_v1.PreprocessingConfig.Audio(
392
lufs=-16.0,
393
high_boost=True,
394
low_boost=False
395
),
396
crop=live_stream_v1.PreprocessingConfig.Crop(
397
top_pixels=8,
398
bottom_pixels=8,
399
left_pixels=16,
400
right_pixels=16
401
)
402
)
403
404
input_resource = live_stream_v1.Input(
405
type_=live_stream_v1.Input.Type.SRT_PUSH,
406
tier=live_stream_v1.Input.Tier.UHD,
407
preprocessing_config=preprocessing
408
)
409
410
request = live_stream_v1.CreateInputRequest(
411
parent="projects/my-project/locations/us-central1",
412
input_id="preprocessed-input",
413
input=input_resource
414
)
415
```
416
417
### Updating Input Configuration
418
419
```python
420
from google.protobuf import field_mask_pb2
421
422
# Update preprocessing settings
423
updated_input = live_stream_v1.Input(
424
name="projects/my-project/locations/us-central1/inputs/my-input",
425
preprocessing_config=live_stream_v1.PreprocessingConfig(
426
denoise=live_stream_v1.PreprocessingConfig.Denoise(
427
strength=0.8,
428
tune="film"
429
)
430
)
431
)
432
433
update_mask = field_mask_pb2.FieldMask(
434
paths=["preprocessing_config.denoise"]
435
)
436
437
request = live_stream_v1.UpdateInputRequest(
438
input=updated_input,
439
update_mask=update_mask
440
)
441
442
operation = client.update_input(request=request)
443
updated_result = operation.result()
444
```