Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [video] added TimecodeConfig for specifying the source of timecode used in media workflow synchronization #4114

Merged
merged 2 commits into from
Mar 21, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package google.cloud.video.livestream.v1;

import "google/api/field_behavior.proto";
import "google/protobuf/duration.proto";
import "google/type/datetime.proto";

option csharp_namespace = "Google.Cloud.Video.LiveStream.V1";
option go_package = "cloud.google.com/go/video/livestream/apiv1/livestreampb;livestreampb";
Expand Down Expand Up @@ -60,8 +61,9 @@ message MuxStream {
// - `ts` - the corresponding file extension is `.ts`
string container = 3;

// List of `ElementaryStream` [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed in this
// stream.
// List of `ElementaryStream`
// [key][google.cloud.video.livestream.v1.ElementaryStream.key]s multiplexed
// in this stream.
//
// - For `fmp4` container, must contain either one video or one audio stream.
// - For `ts` container, must contain exactly one audio stream and up to one
Expand All @@ -70,6 +72,10 @@ message MuxStream {

// Segment settings for `fmp4` and `ts`.
SegmentSettings segment_settings = 5;

// Identifier of the encryption configuration to use. If omitted, output
// will be unencrypted.
string encryption_id = 6;
}

// Manifest configuration.
Expand All @@ -87,15 +93,17 @@ message Manifest {
}

// The name of the generated file. The default is `manifest` with the
// extension suffix corresponding to the `Manifest` [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple
// extension suffix corresponding to the `Manifest`
// [type][google.cloud.video.livestream.v1.Manifest.type]. If multiple
// manifests are added to the channel, each must have a unique file name.
string file_name = 1;

// Required. Type of the manifest, can be `HLS` or `DASH`.
ManifestType type = 2 [(google.api.field_behavior) = REQUIRED];

// Required. List of `MuxStream` [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear in this
// manifest.
// Required. List of `MuxStream`
// [key][google.cloud.video.livestream.v1.MuxStream.key]s that should appear
// in this manifest.
//
// - For HLS, either `fmp4` or `ts` mux streams can be specified but not
// mixed.
Expand All @@ -115,6 +123,15 @@ message Manifest {
// player has, but were already deleted from the output Google Cloud Storage
// bucket. Default value is `60s`.
google.protobuf.Duration segment_keep_duration = 5;

// Whether to use the timecode, as specified in timecode config, when setting:
//
// - `availabilityStartTime` attribute in DASH manifests.
// - `#EXT-X-PROGRAM-DATE-TIME` tag in HLS manifests.
//
// If false, ignore the input timecode and use the time from system clock
// when the manifest is first generated. This is the default behavior.
bool use_timecode_as_timeline = 6;
}

// Sprite sheet configuration.
Expand Down Expand Up @@ -161,6 +178,22 @@ message SpriteSheet {

// Preprocessing configurations.
message PreprocessingConfig {
// Audio preprocessing configuration.
message Audio {
// Specify audio loudness normalization in loudness units relative to full
// scale (LUFS). Enter a value between -24 and 0 according to the following:
//
// - -24 is the Advanced Television Systems Committee (ATSC A/85)
// - -23 is the EU R128 broadcast standard
// - -19 is the prior standard for online mono audio
// - -18 is the ReplayGain standard
// - -16 is the prior standard for stereo audio
// - -14 is the new online audio standard recommended by Spotify, as well as
// Amazon Echo
// - 0 disables normalization. The default is 0.
double lufs = 1;
}

// Video cropping configuration for the input video. The cropped input video
// is scaled to match the output resolution.
message Crop {
Expand Down Expand Up @@ -193,6 +226,9 @@ message PreprocessingConfig {
int32 right_pixels = 4;
}

// Audio preprocessing configuration.
Audio audio = 1;

// Specify the video cropping configuration.
Crop crop = 2;

Expand All @@ -212,8 +248,8 @@ message VideoStream {
// Valid range is [180, 1080].
int32 height_pixels = 2;

// Required. The target video frame rate in frames per second (FPS). Must be less
// than or equal to 60. Will default to the input frame rate if larger
// Required. The target video frame rate in frames per second (FPS). Must be
// less than or equal to 60. Will default to the input frame rate if larger
// than the input frame rate. The API will generate an output FPS that is
// divisible by the input FPS, and smaller or equal to the target FPS. See
// [Calculating frame
Expand Down Expand Up @@ -242,16 +278,18 @@ message VideoStream {

// Select the GOP size based on the specified duration. The default is
// `2s`. Note that `gopDuration` must be less than or equal to
// [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration], and
// [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration] must be divisible
// by `gopDuration`. Valid range is [2s, 20s].
// [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration],
// and
// [segment_duration][google.cloud.video.livestream.v1.SegmentSettings.segment_duration]
// must be divisible by `gopDuration`. Valid range is [2s, 20s].
//
// All video streams in the same channel must have the same GOP size.
google.protobuf.Duration gop_duration = 8;
}

// Size of the Video Buffering Verifier (VBV) buffer in bits. Must be
// greater than zero. The default is equal to [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps].
// greater than zero. The default is equal to
// [bitrate_bps][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.bitrate_bps].
int32 vbv_size_bits = 9;

// Initial fullness of the Video Buffering Verifier (VBV) buffer in bits.
Expand All @@ -272,8 +310,9 @@ message VideoStream {
bool b_pyramid = 12;

// The number of consecutive B-frames. Must be greater than or equal to
// zero. Must be less than [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count] if set. The default
// is 0.
// zero. Must be less than
// [gop_frame_count][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_frame_count]
// if set. The default is 0.
int32 b_frame_count = 13;

// Specify the intensity of the adaptive quantizer (AQ). Must be between 0
Expand All @@ -291,15 +330,18 @@ message VideoStream {
// The available options are [FFmpeg-compatible Profile
// Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Profile).
// Note that certain values for this field may cause the
// transcoder to override other fields you set in the [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings]
// transcoder to override other fields you set in the
// [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings]
// message.
string profile = 15;

// Enforces the specified codec tune. The available options are
// [FFmpeg-compatible Encode
// Options](https://trac.ffmpeg.org/wiki/Encode/H.264#Tune)
// Note that certain values for this field may cause the transcoder to
// override other fields you set in the [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings] message.
// override other fields you set in the
// [H264CodecSettings][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings]
// message.
string tune = 16;
}

Expand All @@ -314,22 +356,30 @@ message VideoStream {
message AudioStream {
// The mapping for the input streams and audio channels.
message AudioMapping {
// Required. The `Channel` [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key] that identifies the input that this
// audio mapping applies to. If an active input doesn't have an audio
// mapping, the primary audio track in the input stream will be selected.
// Required. The `Channel`
// [InputAttachment.key][google.cloud.video.livestream.v1.InputAttachment.key]
// that identifies the input that this audio mapping applies to. If an
// active input doesn't have an audio mapping, the primary audio track in
// the input stream will be selected.
string input_key = 6 [(google.api.field_behavior) = REQUIRED];

// Required. The zero-based index of the track in the input stream.
// All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in the same [AudioStream][google.cloud.video.livestream.v1.AudioStream]
// must have the same input track.
// All [mapping][google.cloud.video.livestream.v1.AudioStream.mapping]s in
// the same [AudioStream][google.cloud.video.livestream.v1.AudioStream] must
// have the same input track.
int32 input_track = 2 [(google.api.field_behavior) = REQUIRED];

// Required. The zero-based index of the channel in the input stream.
int32 input_channel = 3 [(google.api.field_behavior) = REQUIRED];

// Required. The zero-based index of the channel in the output audio stream.
// Must be consistent with the [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel].
// Must be consistent with the
// [input_channel][google.cloud.video.livestream.v1.AudioStream.AudioMapping.input_channel].
int32 output_channel = 4 [(google.api.field_behavior) = REQUIRED];

// Audio volume control in dB. Negative values decrease volume,
// positive values increase. The default is 0.
double gain_db = 5;
}

// Specifies whether pass through (transmuxing) is enabled or not.
Expand All @@ -344,7 +394,8 @@ message AudioStream {
// - `aac`
string codec = 1;

// Required. Audio bitrate in bits per second. Must be between 1 and 10,000,000.
// Required. Audio bitrate in bits per second. Must be between 1 and
// 10,000,000.
int32 bitrate_bps = 2 [(google.api.field_behavior) = REQUIRED];

// Number of audio channels. Must be between 1 and 6. The default is 2.
Expand Down Expand Up @@ -386,12 +437,43 @@ message TextStream {
message SegmentSettings {
// Duration of the segments in seconds. The default is `6s`. Note that
// `segmentDuration` must be greater than or equal to
// [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration], and
// `segmentDuration` must be divisible by
// [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration],
// and `segmentDuration` must be divisible by
// [gop_duration][google.cloud.video.livestream.v1.VideoStream.H264CodecSettings.gop_duration].
// Valid range is [2s, 20s].
//
// All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in the same manifest must have the
// same segment duration.
// All [mux_streams][google.cloud.video.livestream.v1.Manifest.mux_streams] in
// the same manifest must have the same segment duration.
google.protobuf.Duration segment_duration = 1;
}

// Timecode configuration.
message TimecodeConfig {
// The source of timecode.
enum TimecodeSource {
// The timecode source is not specified.
TIMECODE_SOURCE_UNSPECIFIED = 0;

// Use input media timestamp.
MEDIA_TIMESTAMP = 1;

// Use input embedded timecode e.g. picture timing SEI message.
EMBEDDED_TIMECODE = 2;
}

// The source of the timecode that will later be used in outputs/manifests.
// It determines the initial timecode/timestamp (first frame) of output
// streams.
TimecodeSource source = 1;

// For EMBEDDED_TIMECODE source only.
// Used to interpret the embedded timecode (which contains only the time part
// and no date). We assume all inputs are live.
oneof time_offset {
// UTC offset. Must be whole seconds, between -18 hours and +18 hours.
google.protobuf.Duration utc_offset = 2;

// Time zone e.g. "America/Los_Angeles".
google.type.TimeZone time_zone = 3;
}
}
Loading