### Creating Shotstack Audio Asset (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates how to instantiate an `AudioAsset` object in Python. This asset is used to add sound effects or background music to a video. It requires importing `AudioAsset` from `shotstack_sdk.model`. The example shows setting the required `src` (publicly accessible audio URL) and optional parameters like `trim` (start offset), `volume` (level), and `effect` (fades). ```python from shotstack_sdk.model.audio_asset import AudioAsset audio_asset = AudioAsset( src = 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/music/unminus/lit.mp3', trim = 2.0, volume = 0.5, effect = 'fadeInFadeOut' ) ``` -------------------------------- ### Creating Shotstack Luma Asset (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Shows how to instantiate a `LumaAsset` object in Python. This asset is used for creating luma matte effects, transitions, or masks using a grayscale video. It requires importing `LumaAsset` from `shotstack_sdk.model`. The example sets the required `src` (publicly accessible MP4 video URL acting as the luma matte) and an optional `trim` parameter to specify the start point. ```python from shotstack_sdk.model.luma_asset import LumaAsset luma_asset = LumaAsset( src = 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/examples/luma-mattes/paint-left.mp4', trim = 5.0 ) ``` -------------------------------- ### Installing Shotstack Python SDK with pip (bash) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet provides the command-line instruction to install the Shotstack Python SDK package using the pip package manager. This is the standard way to get the library into your Python environment. It requires Python and pip to be installed on your system. ```bash pip install shotstack-sdk ``` -------------------------------- ### Creating Shotstack Transition Object (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Illustrates how to instantiate a `Transition` object in Python. This object defines the in and out transitions for a clip, such as fading. It requires importing `Transition` from `shotstack_sdk.model`. The example shows setting both the `_in` and `out` parameters to specify the desired transition type for the start and end of the clip. ```python from shotstack_sdk.model.transition import Transition transition = Transition( _in = 'fade', out = 'fade' ) ``` -------------------------------- ### Instantiating Output Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet illustrates how to create an `Output` model instance using the Shotstack Python SDK. The Output model defines the desired format, resolution, aspect ratio, and other settings for the final rendered video or image. The example includes various common output configuration options. ```python from shotstack_sdk.model.output import Output output = Output( format = 'mp4', resolution = 'sd', aspectRatio = '16:9', size = size, fps = 25.0, scaleTo = 'preview', quality = 'mediue', repeat = True, mute = False, _range = _range, poster = poster, thumbnail = thumbnail, destinations = destinations ) ``` -------------------------------- ### Creating Shotstack Image Asset (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates how to instantiate a `ImageAsset` object in Python. This asset is used to add images to a video. It requires importing `ImageAsset` from `shotstack_sdk.model`. The example shows setting the required `src` (publicly accessible image URL) and an optional `crop` parameter. ```python from shotstack_sdk.model.image_asset import ImageAsset image_asset = ImageAsset( src = 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/images/earth.jpg', crop = crop ) ``` -------------------------------- ### Instantiating Template Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create a `Template` model instance using the Shotstack Python SDK. A Template saves an entire video `Edit` object for later re-use. The example demonstrates setting a name for the template and associating it with a previously defined edit object. ```python from shotstack_sdk.model.template import Template template = Template( name = 'My Template', template = edit ) ``` -------------------------------- ### Creating Shotstack HTML Asset (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Shows how to instantiate an `HtmlAsset` object in Python. This asset allows using HTML and CSS for text-based layouts within a bounding box in the video. It requires importing `HtmlAsset` from `shotstack_sdk.model`. The example sets the required `html` string and optional parameters like `css`, `width`, `height`, `background`, and `position` to define the content, styling, and placement of the HTML block. ```python from shotstack_sdk.model.html_asset import HtmlAsset html_asset = HtmlAsset( html = '
Hello World
', css = 'p { color: #ffffff; } b { color: #ffff00; }', width = 400, height = 200, background = 'transparent', position = 'center' ) ``` -------------------------------- ### Instantiating SkewTransformation Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This code demonstrates the instantiation of the `SkewTransformation` model in the Shotstack Python SDK. This model allows shearing a clip along its x and y axes at an angle. The example sets both x and y skew values to 0.5. ```python from shotstack_sdk.model.skew_transformation import SkewTransformation skew_transformation = SkewTransformation( x = 0.5, y = 0.5 ) ``` -------------------------------- ### Instantiating Transformation Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This code demonstrates the instantiation of the `Transformation` model in the Shotstack Python SDK. The Transformation model serves as a container to apply one or more visual transformations (like rotate, skew, or flip) to a clip. The example shows how to potentially include separate transformation objects. ```python from shotstack_sdk.model.transformation import Transformation transformation = Transformation( rotate = rotate, skew = skew, flip = flip ) ``` -------------------------------- ### Instantiating Crop Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet illustrates how to create a `Crop` model instance using the Shotstack Python SDK. The Crop model allows trimming the edges of an asset by a relative amount, specified between 0 and 1. The example shows cropping from the top and bottom. ```python from shotstack_sdk.model.crop import Crop crop = Crop( top = 0.15, bottom= 0.15, left = 0.0, right = 0.0 ) ``` -------------------------------- ### Creating Shotstack Title Asset (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Illustrates how to instantiate a `TitleAsset` object in Python. This asset is used to add styled text titles to a video. It requires importing `TitleAsset` from `shotstack_sdk.model`. The example sets the required `text` and various optional parameters like `style`, `color`, `size`, `background`, `position`, and `offset` to customize the title's appearance and placement. ```python from shotstack_sdk.model.title_asset import TitleAsset title_asset = TitleAsset( text = 'My Title', style = 'minimal', color = '#ffffff', size = 'medium', background = '#000000', position = 'center', offset = offset ) ``` -------------------------------- ### Instantiating FlipTransformation Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet illustrates how to create a `FlipTransformation` model instance using the Shotstack Python SDK. This model is used to mirror a clip horizontally or vertically. The example shows setting both horizontal and vertical flip properties to True. ```python from shotstack_sdk.model.flip_transformation import FlipTransformation flip_transformation = FlipTransformation( horizontal = True, vertical = True ) ``` -------------------------------- ### Instantiating TemplateRender Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This code demonstrates how to create a `TemplateRender` model instance using the Shotstack Python SDK. This model is used to specify which template to render by its ID and optionally provide merge fields to customize the template content. The example shows providing a template ID and a merge fields object. ```python from shotstack_sdk.model.template_render import TemplateRender template_render = TemplateRender( id = '21e781c0-8232-4418-fec1-cc99f0280c21', merge = merge ) ``` -------------------------------- ### Defining Shotstack Clip Object Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates how to create a Clip object, which is a container for an asset defining its behavior on the timeline. It specifies the asset type, start time, duration, scaling ('fit', 'scale'), positioning, offset, transitions, effects, filters, opacity, and transformations. ```python from shotstack_sdk.model.clip import Clip clip = Clip( asset = asset, start = 2.0, length = 5.0, fit = 'crop', scale = 0.0, position = 'center', offset = offset, transition = transition, effect = 'zoomIn', filter = 'greyscale', opacity = 1.0, transform = transform, ) ``` -------------------------------- ### Instantiating Offset Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This code snippet demonstrates how to create an instance of the `Offset` model in the Shotstack Python SDK. The Offset model is used to adjust the horizontal and vertical position of an asset relative to the viewport. The example shows setting both the x and y offset values. ```python from shotstack_sdk.model.offset import Offset offset = Offset( x = 0.1, y = -0.2 ) ``` -------------------------------- ### Instantiating RotateTransformation Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create a `RotateTransformation` model instance using the Shotstack Python SDK. This model is specifically used to define the rotation angle for a clip. The example sets a rotation angle of 45 degrees. ```python from shotstack_sdk.model.rotate_transformation import RotateTransformation rotate_transformation = RotateTransformation( angle = 45.0 ) ``` -------------------------------- ### Specifying Render Time Range in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create a `Range` object to define the start time and duration for a render, allowing you to render only a portion of the timeline. Omitting this object renders the entire timeline. It can also be used to capture a single frame. ```python from shotstack_sdk.model.range import Range _range = Range( start = 3.0, length = 6.0 ) ``` -------------------------------- ### Instantiating MergeField Model in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This code demonstrates how to create a `MergeField` model instance using the Shotstack Python SDK. MergeField is used in templating to define a key-value pair where the `find` string (without delimiters) is replaced by the `replace` value. The example shows finding 'NAME' and replacing it with 'Jane'. ```python from shotstack_sdk.model.merge_field import MergeField merge_field = MergeField( find = 'NAME', replace = 'Jane' ) ``` -------------------------------- ### Creating Shotstack Video Asset Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Illustrates the instantiation of a VideoAsset object, specifically used within a Clip to represent a video file. It requires the publicly accessible source URL of the video and allows specifying parameters like trim time, volume, and volume effects. ```python from shotstack_sdk.model.video_asset import VideoAsset video_asset = VideoAsset( src = 'https://shotstack-assets.s3.aws.com/mountain.mp4', trim = 5.0, volume = 0.5, volumeEffect = 'fadeIn' crop = crop ) ``` -------------------------------- ### Inspecting Media with Shotstack SDK Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates how to use the Shotstack Python SDK to inspect a remote media file's metadata using the `probe` endpoint. It requires a Shotstack API key and the URL of the media asset. The code initializes the SDK, sets the API key, calls `api_instance.probe(url)`, and then parses the response to print video stream details like dimensions, framerate, and duration. ```Python import shotstack_sdk as shotstack from shotstack_sdk.api import edit_api host = "https://api.shotstack.io/stage" configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = "H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD" with shotstack.ApiClient(configuration) as api_client: api_instance = edit_api.EditApi(api_client) url = 'https://github.com/shotstack/test-media/raw/main/captioning/scott-ko.mp4' try: api_response = api_instance.probe(url) streams = api_response['response']['metadata']['streams'] for stream in streams: if stream['codec_type'] == 'video': print(f"Example settings for: {api_response['response']['metadata']['format']['filename']}") print(f"Width: {stream['width']}px") print(f"Height: {stream['height']}px") print(f"Framerate: {stream['r_frame_rate']} fps") print(f"Duration: {stream['duration']} secs") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Retrieving Assets by Render ID using Shotstack SDK (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to use the Shotstack Python SDK to fetch details for all assets produced by a single render ID. It initializes the client with an API key, specifies a render ID, calls the `get_asset_by_render_id` method, and prints the asset URL, asset ID, and render ID if the asset status is 'ready'. Requires the `shotstack_sdk` library. ```python import shotstack_sdk as shotstack from shotstack_sdk.api import serve_api host = 'https://api.shotstack.io/stage' configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = 'H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD' with shotstack.ApiClient(configuration) as api_client: api_instance = serve_api.ServeApi(api_client) id = '140924c6-077d-4334-a89f-94befcfc0155' try: api_response = api_instance.get_asset_by_render_id(id) data = api_response['data'] if data['attributes']['status'] == 'ready': print(f">> Asset CDN URL: {data['attributes']['url']}") print(f">> Asset ID: {data['attributes']['id']}") print(f">> Render ID: {data['attributes']['render_id']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Configuring Mux Destination in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to create a `MuxDestination` object to send rendered videos to the Mux hosting and streaming service. Mux credentials are required and configured via the Shotstack dashboard, not in this request object. Options can be included via a `MuxDestinationOptions` object. ```python from shotstack_sdk.model.mux_destination import MuxDestination mux_destination = MuxDestination( provider = 'mux', options = options ) ``` -------------------------------- ### Submitting Video Edit to Shotstack API (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to construct a complete video edit definition using Shotstack SDK models and submit it to the API for rendering. It initializes the API client with a host and developer key, defines a video asset, clip, track, timeline, and output format, and finally calls the `post_render` method. It requires the `shotstack_sdk` library and a valid developer key. The input is the structured `Edit` object, and the output is the render ID printed to the console upon success. ```python import shotstack_sdk as shotstack from shotstack_sdk.api import edit_api from shotstack_sdk.model.video_asset import VideoAsset from shotstack_sdk.model.clip import Clip from shotstack_sdk.model.track import Track from shotstack_sdk.model.timeline import Timeline from shotstack_sdk.model.output import Output from shotstack_sdk.model.edit import Edit host = 'https://api.shotstack.io/stage' configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = 'H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD' with shotstack.ApiClient(configuration) as api_client: api_instance = edit_api.EditApi(api_client) video_asset = VideoAsset( src = 'https://s3-ap-southeast-2.amazonaws.com/shotstack-assets/footage/skater.hd.mp4', trim = 3.0 ) video_clip = Clip( asset = video_asset, start = 0.0, length = 8.0 ) track = Track(clips=[video_clip]) timeline = Timeline(tracks=[track]) timeline['tracks'] = [another_track] output = Output( format = 'mp4', resolution = 'sd' ) edit = Edit( timeline = timeline, output = output ) try: api_response = api_instance.post_render(edit) print(f"{api_response['response']['id']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Creating Shotstack Edit Object Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates how to instantiate the Edit object, which represents the top-level configuration for a Shotstack render. It includes parameters for defining the timeline content, output format, merge fields for templating, an optional callback URL for status notifications, and the deprecated disk type setting. ```python from shotstack_sdk.model.edit import Edit edit = Edit( timeline = timeline, output = output, merge = merge, callback = "https://my-server.com/callback.php", disk = "local" ) ``` -------------------------------- ### Configuring Shotstack Destination in Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create a `ShotstackDestination` object to configure sending rendered assets to the default Shotstack hosting and CDN service. The `provider` is set to 'shotstack', and `exclude` can be used to opt-out. ```python from shotstack_sdk.model.shotstack_destination import ShotstackDestination shotstack_destination = ShotstackDestination( provider = 'shotstack', exclude = False ) ``` -------------------------------- ### Saving Shotstack Edit as Template (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet illustrates how to create a reusable video editing template from an `Edit` object, potentially incorporating placeholders for dynamic content. It builds the edit using SDK models, wraps it in a `Template` object with a name, and sends it to the API via `post_template`. Requires the `shotstack_sdk` library and a developer key, preferably loaded from an environment variable. Inputs include the edit structure with placeholders and a template name; the output is the template ID printed upon success. ```python import shotstack_sdk as shotstack import os from shotstack_sdk.api import edit_api from shotstack_sdk.model.video_asset import VideoAsset from shotstack_sdk.model.clip import Clip from shotstack_sdk.model.track import Track from shotstack_sdk.model.timeline import Timeline from shotstack_sdk.model.output import Output from shotstack_sdk.model.edit import Edit from shotstack_sdk.model.template import Template host = "https://api.shotstack.io/stage" configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = os.getenv("SHOTSTACK_KEY") with shotstack.ApiClient(configuration) as api_client: api_instance = edit_api.EditApi(api_client) video_asset = VideoAsset( src = '{{ URL }}', trim = '{{ TRIM }}' ) video_clip = Clip( asset = video_asset, start = 0.0, length = '{{ LENGTH }}' ) track = Track(clips=[video_clip]) timeline = Timeline( background = '#000000', tracks = [track] ) output = Output( format = 'mp4', resolution = 'sd' ) edit = Edit( timeline = timeline, output = output ) template = Template( name = 'Trim Template', template = edit ) try: api_response = api_instance.post_template(template) print(f"{api_response['response']['id']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Adding Shotstack Soundtrack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Shows how to create a Soundtrack object, used to add background music or audio to a timeline. It requires the source URL of an MP3 file and allows specifying an optional fade effect (fadeIn, fadeOut, or fadeInFadeOut) and the playback volume. ```python from shotstack_sdk.model.soundtrack import Soundtrack soundtrack = Soundtrack( src = 'https://s3-ap-southeast-2.amazonaws.com/shotstack-assets/music/disco.mp3', effect = 'fadeIn', volume = 1.0 ) ``` -------------------------------- ### Retrieving Asset by Asset ID using Shotstack SDK (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to fetch details for a single asset using its unique asset ID via the Shotstack Python SDK. It sets up the API client, provides an asset ID, calls the `get_asset` method, and prints the asset URL, asset ID, and render ID if the status is 'ready'. It relies on the `shotstack_sdk` library. ```python import shotstack_sdk as shotstack from shotstack_sdk.api import serve_api host = 'https://api.shotstack.io/stage' configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = 'H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD' with shotstack.ApiClient(configuration) as api_client: api_instance = serve_api.ServeApi(api_client) id = 'ed43eae3-4825-4c03-979d-f7dc47b9997c' try: api_response = api_instance.get_asset(id) data = api_response['data'] if data['attributes']['status'] == 'ready': print(">> Something went wrong, asset could not be copied.") else: print(f">> Asset CDN URL: {data['attributes']['url']}") print(f">> Asset ID: {data['attributes']['id']}") print(f">> Render ID: {data['attributes']['render_id']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Defining Shotstack Timeline Object Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Illustrates the instantiation of a Timeline object, which represents the content of a video or audio edit over time. It includes parameters for adding a soundtrack, setting a background color, including custom fonts, defining the layers of tracks containing clips, and controlling caching behavior. ```python from shotstack_sdk.model.timeline import Timeline timeline = Timeline( soundtrack = soundtrack, background = '#000000', fonts = fonts, tracks = tracks, cache = True, ) ``` -------------------------------- ### Setting Mux Destination Options in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create a `MuxDestinationOptions` object to pass additional configuration to Mux when using the Mux destination. Currently, this supports setting the `playback_policy`. ```python from shotstack_sdk.model.mux_destination_options import MuxDestinationOptions mux_destination_options = MuxDestinationOptions( playback_policy = ['public'] ) ``` -------------------------------- ### Generating Thumbnail Image in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to create a `Thumbnail` object to generate a small image from a specific point on the video or image timeline. It allows specifying the capture point in seconds and scaling the output thumbnail size relative to the viewport. ```python from shotstack_sdk.model.thumbnail import Thumbnail thumbnail = Thumbnail( capture = 1.0, scale = 0.3 ) ``` -------------------------------- ### Setting Custom Size for Render in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to create a `Size` object to specify a custom output width and height for a video or image render using the Shotstack SDK. Custom sizes require omitting `resolution` and `aspectRatio` and must be divisible by 2. ```python from shotstack_sdk.model.size import Size size = Size( width = 1200, height = 800 ) ``` -------------------------------- ### Creating Shotstack Track Object Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Illustrates the instantiation of a Track object, which represents a single layer within a timeline. Tracks are layered on top of each other, and this object primarily contains an array of Clip objects that define the content for this specific layer. ```python from shotstack_sdk.model.track import Track track = Track(clips=clips) ``` -------------------------------- ### Rendering Shotstack Template with Merge Fields (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to trigger a render based on a saved template ID, providing specific values to replace placeholders using `MergeField` objects. It constructs a `TemplateRender` object and calls the `post_template_render` API method. It requires the `shotstack_sdk` library, a developer key (from an environment variable), the template ID, and a list of merge field replacements. Input is the template ID and the merge field list; the output is the new render ID. ```python import shotstack_sdk as shotstack import os from shotstack_sdk.api import edit_api from shotstack_sdk.model.template_render import TemplateRender from shotstack_sdk.model.merge_field import MergeField host = "https://api.shotstack.io/stage" configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = os.getenv("SHOTSTACK_KEY") with shotstack.ApiClient(configuration) as api_client: api_instance = edit_api.EditApi(api_client) merge_field_url = MergeField( find = 'URL', replace = 'https://s3-ap-southeast-2.amazonaws.com/shotstack-assets/footage/skater.hd.mp4' ) merge_field_trim = MergeField( find = 'TRIM', replace = 3 ) merge_field_length = MergeField( find = 'LENGTH', replace = 6 ) template = TemplateRender( id = id, merge = [ merge_field_url, merge_field_trim, merge_field_length ] ) try: api_response = api_instance.post_template_render(template) print(f"{api_response['response']['id']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Generating Poster Image in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet illustrates how to create a `Poster` object to generate a single image from a specific point on the video timeline. The capture point is specified in seconds, and the output image size matches the video size. ```python from shotstack_sdk.model.poster import Poster poster = Poster( capture = 1.0 ) ``` -------------------------------- ### Setting S3 Destination Options in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet shows how to create an `S3DestinationOptions` object to pass additional configuration for storing files in S3 when using the S3 destination. This includes options like region, bucket name, prefix, filename, and ACL. ```python from shotstack_sdk.model.s3_destination_options import S3DestinationOptions s3_destination_options = S3DestinationOptions( region = 'us-east-1', bucket = 'my-bucket', prefix = 'my-renders', filename = 'my-file', acl = 'public-read' ) ``` -------------------------------- ### Adding Shotstack Custom Font Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md Demonstrates creating a Font object, used to specify a custom font file for use with HTML assets within a timeline. It requires the publicly accessible source URL of the font file (.ttf, .otf, .woff, or .woff2). ```python from shotstack_sdk.model.font import Font font = Font(src='https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/fonts/OpenSans-Regular.ttf') ``` -------------------------------- ### Checking Shotstack Render Status (Python) Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to check the processing status of a previously submitted video render using its unique ID. It configures the API client and calls the `get_render` method, optionally checking if the status is 'done' to retrieve and print the final output URL. It requires the `shotstack_sdk` library, a valid developer key, and the render ID obtained from a previous submission. ```python import shotstack_sdk as shotstack from shotstack_sdk.api import edit_api host = 'https://api.shotstack.io/stage' configuration = shotstack.Configuration(host = host) configuration.api_key['DeveloperKey'] = 'H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD' with shotstack.ApiClient(configuration) as api_client: api_instance = edit_api.EditApi(api_client) id = '75143ec6-4b72-46f8-a67a-fd7284546935' try: api_response = api_instance.get_render(id, data=False, merged=True) status = api_response['response']['status'] if status == 'done': print(f"{api_response['response']['url']}") except Exception as e: print(f"Unable to resolve API call: {e}") ``` -------------------------------- ### Configuring S3 Destination in Shotstack Python Source: https://github.com/shotstack/shotstack-sdk-python/blob/main/README.md This snippet demonstrates how to create an `S3Destination` object to send rendered assets to an Amazon S3 bucket. AWS credentials and bucket configuration are handled via the Shotstack dashboard, not in this request object. Additional storage options can be provided via an `S3DestinationOptions` object. ```python from shotstack_sdk.model.s3_destination import S3Destination s3_destination = S3Destination( provider = 's3', options = options ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.