From 10adada9a3b4e0bbe37e2a1ba630f819916a78e0 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Tue, 11 Apr 2023 15:28:41 -0700 Subject: [PATCH 1/3] =?UTF-8?q?feat(Transcoder):=20update=20captions=20cod?= =?UTF-8?q?e=20samples=20for=20display=20name=20and=20l=E2=80=A6=20(#292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(Transcoder): update captions code samples for display name and language * test bucket should be deleted * Trigger Build --- .../create_job_with_embedded_captions.py | 12 ++- .../create_job_with_standalone_captions.py | 81 ++++++++++++++----- samples/snippets/job_test.py | 9 ++- 3 files changed, 75 insertions(+), 27 deletions(-) diff --git a/samples/snippets/create_job_with_embedded_captions.py b/samples/snippets/create_job_with_embedded_captions.py index 9943889..58f985d 100644 --- a/samples/snippets/create_job_with_embedded_captions.py +++ b/samples/snippets/create_job_with_embedded_captions.py @@ -38,7 +38,7 @@ def create_job_with_embedded_captions( input_captions_uri, output_uri, ): - """Creates a job based on an ad-hoc job configuration that embeds captions in the output video. + """Creates a job based on an ad-hoc job configuration that embeds closed captions in the output video. Args: project_id (str): The GCP project ID. @@ -87,7 +87,8 @@ def create_job_with_embedded_captions( transcoder_v1.types.ElementaryStream( key="audio-stream0", audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 + codec="aac", + bitrate_bps=64000, ), ), transcoder_v1.types.ElementaryStream( @@ -101,15 +102,12 @@ def create_job_with_embedded_captions( input_track=0, ), ], + language_code="en-US", + display_name="English", ), ), ], mux_streams=[ - transcoder_v1.types.MuxStream( - key="sd", - container="mp4", - elementary_streams=["video-stream0", "audio-stream0"], - ), transcoder_v1.types.MuxStream( key="sd-hls", container="ts", diff --git a/samples/snippets/create_job_with_standalone_captions.py b/samples/snippets/create_job_with_standalone_captions.py index e819660..4524185 100644 --- a/samples/snippets/create_job_with_standalone_captions.py +++ b/samples/snippets/create_job_with_standalone_captions.py @@ -14,11 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""Google Cloud Transcoder sample for creating a job that can use captions from a standalone file. +"""Google Cloud Transcoder sample for creating a job that can use subtitles from a standalone file. Example usage: python create_job_with_standalone_captions.py --project_id --location \ - --input_video_uri --input_captions_uri --output_uri + --input_video_uri --input_subtitles1_uri --input_subtitles2_uri --output_uri """ # [START transcoder_create_job_with_standalone_captions] @@ -36,17 +36,20 @@ def create_job_with_standalone_captions( project_id, location, input_video_uri, - input_captions_uri, + input_subtitles1_uri, + input_subtitles2_uri, output_uri, ): - """Creates a job based on an ad-hoc job configuration that can use captions from a standalone file. + """Creates a job based on an ad-hoc job configuration that can use subtitles from a standalone file. Args: project_id (str): The GCP project ID. location (str): The location to start the job in. input_video_uri (str): Uri of the input video in the Cloud Storage bucket. - input_captions_uri (str): Uri of the input captions file in the Cloud + input_subtitles1_uri (str): Uri of an input subtitles file in the Cloud + Storage bucket. + input_subtitles2_uri (str): Uri of an input subtitles file in the Cloud Storage bucket. output_uri (str): Uri of the video output folder in the Cloud Storage bucket.""" @@ -63,14 +66,18 @@ def create_job_with_standalone_captions( uri=input_video_uri, ), transcoder_v1.types.Input( - key="caption-input0", - uri=input_captions_uri, + key="subtitle-input-en", + uri=input_subtitles1_uri, + ), + transcoder_v1.types.Input( + key="subtitle-input-es", + uri=input_subtitles2_uri, ), ], edit_list=[ transcoder_v1.types.EditAtom( key="atom0", - inputs=["input0", "caption-input0"], + inputs=["input0", "subtitle-input-en", "subtitle-input-es"], ), ], elementary_streams=[ @@ -88,18 +95,34 @@ def create_job_with_standalone_captions( transcoder_v1.types.ElementaryStream( key="audio-stream0", audio_stream=transcoder_v1.types.AudioStream( - codec="aac", bitrate_bps=64000 + codec="aac", + bitrate_bps=64000, + ), + ), + transcoder_v1.types.ElementaryStream( + key="vtt-stream-en", + text_stream=transcoder_v1.types.TextStream( + codec="webvtt", + language_code="en-US", + display_name="English", + mapping_=[ + transcoder_v1.types.TextStream.TextMapping( + atom_key="atom0", + input_key="subtitle-input-en", + ), + ], ), ), transcoder_v1.types.ElementaryStream( - key="vtt-stream0", + key="vtt-stream-es", text_stream=transcoder_v1.types.TextStream( codec="webvtt", + language_code="es-ES", + display_name="Spanish", mapping_=[ transcoder_v1.types.TextStream.TextMapping( atom_key="atom0", - input_key="caption-input0", - input_track=0, + input_key="subtitle-input-es", ), ], ), @@ -117,9 +140,20 @@ def create_job_with_standalone_captions( elementary_streams=["audio-stream0"], ), transcoder_v1.types.MuxStream( - key="text-vtt", + key="text-vtt-en", container="vtt", - elementary_streams=["vtt-stream0"], + elementary_streams=["vtt-stream-en"], + segment_settings=transcoder_v1.types.SegmentSettings( + segment_duration=duration.Duration( + seconds=6, + ), + individual_segments=True, + ), + ), + transcoder_v1.types.MuxStream( + key="text-vtt-es", + container="vtt", + elementary_streams=["vtt-stream-es"], segment_settings=transcoder_v1.types.SegmentSettings( segment_duration=duration.Duration( seconds=6, @@ -132,7 +166,12 @@ def create_job_with_standalone_captions( transcoder_v1.types.Manifest( file_name="manifest.m3u8", type_="HLS", - mux_streams=["sd-hls-fmp4", "audio-hls-fmp4", "text-vtt"], + mux_streams=[ + "sd-hls-fmp4", + "audio-hls-fmp4", + "text-vtt-en", + "text-vtt-es", + ], ), ], ) @@ -157,8 +196,13 @@ def create_job_with_standalone_captions( required=True, ) parser.add_argument( - "--input_captions_uri", - help="Uri of the input captions file in the Cloud Storage bucket.", + "--input_subtitles1_uri", + help="Uri of an input subtitles file in the Cloud Storage bucket.", + required=True, + ) + parser.add_argument( + "--input_subtitles2_uri", + help="Uri of an input subtitles file in the Cloud Storage bucket.", required=True, ) parser.add_argument( @@ -172,6 +216,7 @@ def create_job_with_standalone_captions( args.project_id, args.location, args.input_video_uri, - args.input_captions_uri, + args.input_subtitles1_uri, + args.input_subtitles2_uri, args.output_uri, ) diff --git a/samples/snippets/job_test.py b/samples/snippets/job_test.py index 3cc8e6a..6dbf8cd 100644 --- a/samples/snippets/job_test.py +++ b/samples/snippets/job_test.py @@ -49,13 +49,17 @@ test_overlay_image_file_name = "overlay.jpg" test_concat1_file_name = "ForBiggerEscapes.mp4" test_concat2_file_name = "ForBiggerJoyrides.mp4" -test_captions_file_name = "caption.srt" +test_captions_file_name = "captions.srt" +test_subtitles1_file_name = "subtitles-en.srt" +test_subtitles2_file_name = "subtitles-es.srt" input_uri = f"gs://{input_bucket_name}{test_video_file_name}" overlay_image_uri = f"gs://{input_bucket_name}{test_overlay_image_file_name}" concat1_uri = f"gs://{input_bucket_name}{test_concat1_file_name}" concat2_uri = f"gs://{input_bucket_name}{test_concat2_file_name}" captions_uri = f"gs://{input_bucket_name}{test_captions_file_name}" +subtitles1_uri = f"gs://{input_bucket_name}{test_subtitles1_file_name}" +subtitles2_uri = f"gs://{input_bucket_name}{test_subtitles2_file_name}" output_uri_for_preset = f"gs://{output_bucket_name}/test-output-preset/" output_uri_for_template = f"gs://{output_bucket_name}/test-output-template/" output_uri_for_adhoc = f"gs://{output_bucket_name}/test-output-adhoc/" @@ -452,7 +456,8 @@ def test_create_job_with_standalone_captions(capsys, test_bucket): project_id, location, input_uri, - captions_uri, + subtitles1_uri, + subtitles2_uri, output_uri_for_standalone_captions, ) out, _ = capsys.readouterr() From a73bdbb1048d2cfacc80cef3db8fd135da2fcc35 Mon Sep 17 00:00:00 2001 From: Nicholas Cook Date: Wed, 12 Apr 2023 07:01:52 -0700 Subject: [PATCH 2/3] docs(samples): remove restriction of JPEGs only for overlay images (#299) --- samples/snippets/create_job_with_animated_overlay.py | 4 ++-- samples/snippets/create_job_with_static_overlay.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/snippets/create_job_with_animated_overlay.py b/samples/snippets/create_job_with_animated_overlay.py index a3f3cbb..52940e8 100644 --- a/samples/snippets/create_job_with_animated_overlay.py +++ b/samples/snippets/create_job_with_animated_overlay.py @@ -40,7 +40,7 @@ def create_job_with_animated_overlay( project_id: The GCP project ID. location: The location to start the job in. input_uri: Uri of the video in the Cloud Storage bucket. - overlay_image_uri: Uri of the JPEG image for the overlay in the Cloud Storage bucket. Must be a JPEG. + overlay_image_uri: Uri of the image for the overlay in the Cloud Storage bucket. output_uri: Uri of the video output folder in the Cloud Storage bucket.""" client = TranscoderServiceClient() @@ -143,7 +143,7 @@ def create_job_with_animated_overlay( ) parser.add_argument( "--overlay_image_uri", - help="Uri of the overlay JPEG image in the Cloud Storage bucket. Must be a JPEG.", + help="Uri of the overlay image in the Cloud Storage bucket.", required=True, ) parser.add_argument( diff --git a/samples/snippets/create_job_with_static_overlay.py b/samples/snippets/create_job_with_static_overlay.py index 37ce26b..67839bb 100644 --- a/samples/snippets/create_job_with_static_overlay.py +++ b/samples/snippets/create_job_with_static_overlay.py @@ -40,7 +40,7 @@ def create_job_with_static_overlay( project_id: The GCP project ID. location: The location to start the job in. input_uri: Uri of the video in the Cloud Storage bucket. - overlay_image_uri: Uri of the JPEG image for the overlay in the Cloud Storage bucket. Must be a JPEG. + overlay_image_uri: Uri of the image for the overlay in the Cloud Storage bucket. output_uri: Uri of the video output folder in the Cloud Storage bucket.""" client = TranscoderServiceClient() @@ -131,7 +131,7 @@ def create_job_with_static_overlay( ) parser.add_argument( "--overlay_image_uri", - help="Uri of the overlay JPEG image in the Cloud Storage bucket. Must be a JPEG.", + help="Uri of the overlay image in the Cloud Storage bucket.", required=True, ) parser.add_argument( From 0f4f8fafc455760bb4cfb520b0f0cbbf9ab924e9 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Wed, 12 Apr 2023 14:04:54 +0000 Subject: [PATCH 3/3] chore(main): release 1.9.0 (#298) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ google/cloud/video/transcoder/gapic_version.py | 2 +- google/cloud/video/transcoder_v1/gapic_version.py | 2 +- ...snippet_metadata_google.cloud.video.transcoder.v1.json | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7840fde..24d5689 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.8.1" + ".": "1.8.2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1972119..21f0586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.8.2](https://github.com/googleapis/python-video-transcoder/compare/v1.8.1...v1.8.2) (2023-04-12) + + +### Documentation + +* **samples:** Remove restriction of JPEGs only for overlay images ([#299](https://github.com/googleapis/python-video-transcoder/issues/299)) ([a73bdbb](https://github.com/googleapis/python-video-transcoder/commit/a73bdbb1048d2cfacc80cef3db8fd135da2fcc35)) +* **samples:** Update captions code samples for display name and language ([10adada](https://github.com/googleapis/python-video-transcoder/commit/10adada9a3b4e0bbe37e2a1ba630f819916a78e0)) + ## [1.8.1](https://github.com/googleapis/python-video-transcoder/compare/v1.8.0...v1.8.1) (2023-03-23) diff --git a/google/cloud/video/transcoder/gapic_version.py b/google/cloud/video/transcoder/gapic_version.py index 90e0293..9a1b07e 100644 --- a/google/cloud/video/transcoder/gapic_version.py +++ b/google/cloud/video/transcoder/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.1" # {x-release-please-version} +__version__ = "1.8.2" # {x-release-please-version} diff --git a/google/cloud/video/transcoder_v1/gapic_version.py b/google/cloud/video/transcoder_v1/gapic_version.py index 90e0293..9a1b07e 100644 --- a/google/cloud/video/transcoder_v1/gapic_version.py +++ b/google/cloud/video/transcoder_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "1.8.1" # {x-release-please-version} +__version__ = "1.8.2" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json index 7845598..4587da9 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.video.transcoder.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-video-transcoder", - "version": "1.8.1" + "version": "1.8.2" }, "snippets": [ { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy