shotstack 0.2.1 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/README.md +387 -23
- data/Rakefile +10 -0
- data/lib/shotstack/api/create_api.rb +158 -0
- data/lib/shotstack/api/edit_api.rb +20 -20
- data/lib/shotstack/api/ingest_api.rb +338 -0
- data/lib/shotstack/api/serve_api.rb +76 -8
- data/lib/shotstack/api_client.rb +28 -24
- data/lib/shotstack/api_error.rb +3 -2
- data/lib/shotstack/configuration.rb +55 -9
- data/lib/shotstack/models/asset.rb +4 -4
- data/lib/shotstack/models/asset_render_response.rb +23 -20
- data/lib/shotstack/models/asset_response.rb +23 -20
- data/lib/shotstack/models/asset_response_attributes.rb +38 -21
- data/lib/shotstack/models/asset_response_data.rb +30 -20
- data/lib/shotstack/models/audio_asset.rb +57 -23
- data/lib/shotstack/models/audio_enhancement.rb +43 -0
- data/lib/shotstack/models/clip.rb +29 -33
- data/lib/shotstack/models/crop.rb +40 -28
- data/lib/shotstack/models/destinations.rb +78 -244
- data/lib/shotstack/models/did_generated_asset.rb +273 -0
- data/lib/shotstack/models/did_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/did_text_to_avatar_options.rb +313 -0
- data/lib/shotstack/models/dolby_enhancement.rb +239 -0
- data/lib/shotstack/models/dolby_enhancement_options.rb +257 -0
- data/lib/shotstack/models/edit.rb +22 -24
- data/lib/shotstack/models/eleven_labs_generated_asset.rb +273 -0
- data/lib/shotstack/models/eleven_labs_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/eleven_labs_text_to_speech_options.rb +303 -0
- data/lib/shotstack/models/enhancements.rb +215 -0
- data/lib/shotstack/models/flip_transformation.rb +16 -24
- data/lib/shotstack/models/font.rb +18 -20
- data/lib/shotstack/models/generated_asset.rb +48 -0
- data/lib/shotstack/models/generated_asset_error_response.rb +225 -0
- data/lib/shotstack/models/generated_asset_error_response_data.rb +257 -0
- data/lib/shotstack/models/generated_asset_response.rb +222 -0
- data/lib/shotstack/models/generated_asset_response_attributes.rb +376 -0
- data/lib/shotstack/models/generated_asset_response_data.rb +256 -0
- data/lib/shotstack/models/google_cloud_storage_destination.rb +232 -0
- data/lib/shotstack/models/google_cloud_storage_destination_options.rb +243 -0
- data/lib/shotstack/models/google_drive_destination.rb +239 -0
- data/lib/shotstack/models/google_drive_destination_options.rb +233 -0
- data/lib/shotstack/models/hey_gen_generated_asset.rb +273 -0
- data/lib/shotstack/models/hey_gen_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/hey_gen_text_to_avatar_options.rb +396 -0
- data/lib/shotstack/models/html_asset.rb +20 -26
- data/lib/shotstack/models/image_asset.rb +18 -20
- data/lib/shotstack/models/ingest_error_response.rb +225 -0
- data/lib/shotstack/models/ingest_error_response_data.rb +257 -0
- data/lib/shotstack/models/luma_asset.rb +18 -20
- data/lib/shotstack/models/merge_field.rb +20 -20
- data/lib/shotstack/models/mux_destination.rb +18 -22
- data/lib/shotstack/models/mux_destination_options.rb +50 -25
- data/lib/shotstack/models/offset.rb +46 -46
- data/lib/shotstack/models/open_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/open_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/open_ai_text_generator_options.rb +313 -0
- data/lib/shotstack/models/output.rb +40 -35
- data/lib/shotstack/models/outputs.rb +227 -0
- data/lib/shotstack/models/outputs_response.rb +218 -0
- data/lib/shotstack/models/poster.rb +18 -20
- data/lib/shotstack/models/probe_response.rb +22 -20
- data/lib/shotstack/models/queued_response.rb +22 -20
- data/lib/shotstack/models/queued_response_data.rb +20 -20
- data/lib/shotstack/models/queued_source_response.rb +222 -0
- data/lib/shotstack/models/queued_source_response_data.rb +240 -0
- data/lib/shotstack/models/range.rb +26 -22
- data/lib/shotstack/models/render_response.rb +22 -20
- data/lib/shotstack/models/render_response_data.rb +24 -35
- data/lib/shotstack/models/rendition.rb +429 -0
- data/lib/shotstack/models/rendition_response_attributes.rb +336 -0
- data/lib/shotstack/models/rotate_transformation.rb +16 -22
- data/lib/shotstack/models/s3_destination.rb +232 -0
- data/lib/shotstack/models/s3_destination_options.rb +270 -0
- data/lib/shotstack/models/shotstack_destination.rb +19 -25
- data/lib/shotstack/models/shotstack_generated_asset.rb +273 -0
- data/lib/shotstack/models/shotstack_generated_asset_options.rb +60 -0
- data/lib/shotstack/models/shotstack_image_to_video_options.rb +298 -0
- data/lib/shotstack/models/shotstack_text_generator_options.rb +274 -0
- data/lib/shotstack/models/shotstack_text_to_image_options.rb +308 -0
- data/lib/shotstack/models/shotstack_text_to_speech_options.rb +339 -0
- data/lib/shotstack/models/size.rb +39 -35
- data/lib/shotstack/models/skew_transformation.rb +16 -24
- data/lib/shotstack/models/soundtrack.rb +18 -22
- data/lib/shotstack/models/source.rb +244 -0
- data/lib/shotstack/models/source_list_response.rb +225 -0
- data/lib/shotstack/models/source_response.rb +222 -0
- data/lib/shotstack/models/source_response_attributes.rb +373 -0
- data/lib/shotstack/models/source_response_data.rb +256 -0
- data/lib/shotstack/models/speed.rb +254 -0
- data/lib/shotstack/models/stability_ai_generated_asset.rb +273 -0
- data/lib/shotstack/models/stability_ai_generated_asset_options.rb +54 -0
- data/lib/shotstack/models/stability_ai_text_to_image_options.rb +390 -0
- data/lib/shotstack/models/template.rb +18 -20
- data/lib/shotstack/models/template_data_response.rb +24 -22
- data/lib/shotstack/models/template_data_response_data.rb +25 -22
- data/lib/shotstack/models/template_list_response.rb +24 -22
- data/lib/shotstack/models/template_list_response_data.rb +20 -20
- data/lib/shotstack/models/template_list_response_item.rb +20 -30
- data/lib/shotstack/models/template_render.rb +19 -21
- data/lib/shotstack/models/template_response.rb +23 -21
- data/lib/shotstack/models/template_response_data.rb +20 -20
- data/lib/shotstack/models/thumbnail.rb +20 -20
- data/lib/shotstack/models/timeline.rb +19 -25
- data/lib/shotstack/models/title_asset.rb +19 -27
- data/lib/shotstack/models/track.rb +18 -20
- data/lib/shotstack/models/transcription.rb +250 -0
- data/lib/shotstack/models/transfer.rb +259 -0
- data/lib/shotstack/models/transfer_response.rb +222 -0
- data/lib/shotstack/models/transfer_response_attributes.rb +280 -0
- data/lib/shotstack/models/transfer_response_data.rb +225 -0
- data/lib/shotstack/models/transformation.rb +16 -20
- data/lib/shotstack/models/transition.rb +16 -20
- data/lib/shotstack/models/upload_response.rb +222 -0
- data/lib/shotstack/models/upload_response_attributes.rb +257 -0
- data/lib/shotstack/models/upload_response_data.rb +256 -0
- data/lib/shotstack/models/video_asset.rb +102 -22
- data/lib/shotstack/version.rb +3 -3
- data/lib/shotstack.rb +63 -2
- data/shotstack.gemspec +8 -8
- metadata +80 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9696b3f6d9627da8217c280bcac571281c4c4f0157a032152f955f27df2ed901
|
4
|
+
data.tar.gz: 0ac97e916f6a934eb0519cadfdf87f0b0c55451b8356aeddb8f6c1b7bc058c16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c868d028cd6c837174f31da955e7157481e6a4ee4a2a618df11362ead2077eca42cd126bd89faa4d8c11834a1782d5053b431b30691cf2956f989dd00ce0dc0
|
7
|
+
data.tar.gz: 5561e90e6a05edf47ae4784c63488479b4dbd91118b1d6319a57a114221ec873c3d0e8f4f69d2eb8c4081cb9354e682d010635af09f23753871eb4e3929a5232
|
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -16,6 +16,8 @@ For examples of how to use the SDK to create videos using code checkout the Ruby
|
|
16
16
|
- [Video Editing](#video-editing)
|
17
17
|
- [Video Editing Example](#video-editing-example)
|
18
18
|
- [Status Check Example](#status-check-example)
|
19
|
+
- [Save a Template Example](#save-a-template-example)
|
20
|
+
- [Render a Template Example](#render-a-template-example)
|
19
21
|
- [Video Editing Schemas](#video-editing-schemas)
|
20
22
|
- [Edit](#edit)
|
21
23
|
- [Timeline](#timeline)
|
@@ -37,18 +39,33 @@ For examples of how to use the SDK to create videos using code checkout the Ruby
|
|
37
39
|
- [SkewTransformation](#skewtransformation)
|
38
40
|
- [FlipTransformation](#fliptransformation)
|
39
41
|
- [MergeField](#mergefield)
|
42
|
+
- [Template Schemas](#template-schemas)
|
43
|
+
- [Template](#template)
|
44
|
+
- [TemplateRender](#templaterender)
|
40
45
|
- [Output Schemas](#output-schemas)
|
41
46
|
- [Output](#output)
|
42
47
|
- [Size](#size)
|
43
48
|
- [Range](#range)
|
44
49
|
- [Poster](#poster)
|
45
50
|
- [Thumbnail](#thumbnail)
|
51
|
+
- [Destinations](#destinations)
|
46
52
|
- [ShotstackDestination](#shotstackdestination)
|
53
|
+
- [MuxDestination](#muxdestination)
|
54
|
+
- [MuxDestinationOptions](#muxdestinationoptions)
|
55
|
+
- [S3DestinationOptions](#s3destinationoptions)
|
47
56
|
- [Render Response Schemas](#render-response-schemas)
|
48
57
|
- [QueuedResponse](#queuedresponse)
|
49
58
|
- [QueuedResponseData](#queuedresponsedata)
|
50
59
|
- [RenderResponse](#renderresponse)
|
51
60
|
- [RenderResponseData](#renderresponsedata)
|
61
|
+
- [Template Response Schemas](#template-response-schemas)
|
62
|
+
- [TemplateResponse](#templateresponse)
|
63
|
+
- [TemplateResponseData](#templateresponsedata)
|
64
|
+
- [TemplateDataResponse](#templatedataresponse)
|
65
|
+
- [TemplateDataResponseData](#templatedataresponsedata)
|
66
|
+
- [TemplateListResponse](#templatelistresponse)
|
67
|
+
- [TemplateListResponseData](#templatelistresponsedata)
|
68
|
+
- [TemplateListResponseItem](#templatelistresponseitem)
|
52
69
|
- [Inspecting Media](#inspecting-media)
|
53
70
|
- [Probe Example](#probe-example)
|
54
71
|
- [Probe Schemas](#probe-schemas)
|
@@ -134,13 +151,118 @@ Shotstack.configure do |config|
|
|
134
151
|
config.base_path = "stage"
|
135
152
|
end
|
136
153
|
|
137
|
-
id = "75143ec6-4b72-46f8-a67a-fd7284546935"
|
154
|
+
id = "75143ec6-4b72-46f8-a67a-fd7284546935" # Use the render id from the previous example
|
138
155
|
api_client = Shotstack::EditApi.new
|
139
156
|
|
140
157
|
response = api_client.get_render(id, { data: false, merged: true }).response
|
141
158
|
|
142
159
|
if response.status === "done"
|
143
|
-
|
160
|
+
puts response.url
|
161
|
+
```
|
162
|
+
|
163
|
+
### Save a Template Example
|
164
|
+
|
165
|
+
The example below uses the Edit we create in the [Video Editing Example](#video-editing-example) and saves it as a
|
166
|
+
template. The template can be rendered at a later date and can include placeholders. Placeholders can be replaced
|
167
|
+
when rendered using [merge fields](#mergefield).
|
168
|
+
|
169
|
+
This example uses a placeholder for the video src (URL), trim (TRIM), and length (LENGTH) to allow you to trim any video
|
170
|
+
using a template.
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
require "shotstack"
|
174
|
+
|
175
|
+
Shotstack.configure do |config|
|
176
|
+
config.api_key['x-api-key'] = "H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD"
|
177
|
+
config.host = "api.shotstack.io"
|
178
|
+
config.base_path = "stage"
|
179
|
+
end
|
180
|
+
|
181
|
+
api_client = Shotstack::EditApi.new
|
182
|
+
|
183
|
+
video_asset = Shotstack::VideoAsset.new(
|
184
|
+
src: "{{URL}}",
|
185
|
+
trim: "{{TRIM}}"
|
186
|
+
)
|
187
|
+
|
188
|
+
video_clip = Shotstack::Clip.new(
|
189
|
+
asset: video_asset,
|
190
|
+
start: 0,
|
191
|
+
length: "{{LENGTH}}"
|
192
|
+
)
|
193
|
+
|
194
|
+
track = Shotstack::Track.new(clips: [video_clip])
|
195
|
+
|
196
|
+
timeline = Shotstack::Timeline.new(
|
197
|
+
background: "#000000",
|
198
|
+
tracks: [track]
|
199
|
+
)
|
200
|
+
|
201
|
+
output = Shotstack::Output.new(
|
202
|
+
format: "mp4",
|
203
|
+
resolution: "sd"
|
204
|
+
)
|
205
|
+
|
206
|
+
edit = Shotstack::Edit.new(
|
207
|
+
timeline: timeline,
|
208
|
+
output: output
|
209
|
+
)
|
210
|
+
|
211
|
+
template = Shotstack::Template.new(
|
212
|
+
name: "Trim Template",
|
213
|
+
template: edit
|
214
|
+
)
|
215
|
+
|
216
|
+
response = api_client.post_template(template).response
|
217
|
+
|
218
|
+
puts response.id
|
219
|
+
```
|
220
|
+
|
221
|
+
### Render a Template Example
|
222
|
+
|
223
|
+
The example below renders the template we created in the previous example and includes merge fields that will replace
|
224
|
+
the placeholders. Once submitted use the returned render ID and call the [Status Check Example](#status-check-example)
|
225
|
+
to get the render progress.
|
226
|
+
|
227
|
+
```ruby
|
228
|
+
require "shotstack"
|
229
|
+
|
230
|
+
Shotstack.configure do |config|
|
231
|
+
config.api_key['x-api-key'] = "H7jKyj90kd09lbLOF7J900jNbSWS67X87xs9j0cD"
|
232
|
+
config.host = "api.shotstack.io"
|
233
|
+
config.base_path = "stage"
|
234
|
+
end
|
235
|
+
|
236
|
+
id = "8aeabb0e-b5eb-8c5e-847d-82297dd4802a"; # use the template id from previous example
|
237
|
+
api_client = Shotstack::EditApi.new
|
238
|
+
|
239
|
+
merge_field_url = Shotstack::MergeField.new(
|
240
|
+
find: "URL",
|
241
|
+
replace: "https://s3-ap-southeast-2.amazonaws.com/shotstack-assets/footage/skater.hd.mp4"
|
242
|
+
)
|
243
|
+
|
244
|
+
merge_field_trim = Shotstack::MergeField.new(
|
245
|
+
find: "TRIM",
|
246
|
+
replace: 3
|
247
|
+
)
|
248
|
+
|
249
|
+
merge_field_length = Shotstack::MergeField.new(
|
250
|
+
find: "LENGTH",
|
251
|
+
replace: 6
|
252
|
+
)
|
253
|
+
|
254
|
+
template = Shotstack::TemplateRender.new(
|
255
|
+
id: id,
|
256
|
+
merge: [
|
257
|
+
merge_field_url,
|
258
|
+
merge_field_trim,
|
259
|
+
merge_field_length
|
260
|
+
]
|
261
|
+
)
|
262
|
+
|
263
|
+
response = api_client.post_template_render(template).response
|
264
|
+
|
265
|
+
puts response.id
|
144
266
|
```
|
145
267
|
|
146
268
|
## Video Editing Schemas
|
@@ -173,7 +295,7 @@ timeline | [Shotstack::Timeline](#timeline) | A timeline represents the contents
|
|
173
295
|
output | [Shotstack::Output](#output) | The output format, render range and type of media to generate. | Y
|
174
296
|
merge | [Shotstack::MergeField[]](#mergefield) | An array of key/value pairs that provides an easy way to create templates with placeholders. The placeholders can be used to find and replace keys with values. For example you can search for the placeholder `{{NAME}}` and replace it with the value `Jane`. | -
|
175
297
|
callback | string | An optional webhook callback URL used to receive status notifications when a render completes or fails. See [webhooks](https://shotstack.io/docs/guide/architecting-an-application/webhooks/) for more details. | -
|
176
|
-
disk | string | The disk type to use for storing footage and asset for each render. See [disk types](https://shotstack.io/docs/guide/architecting-an-application/disk-types/) for more details. [default to `local`] <ul><li>`local` - optimized for high speed rendering with up to 512MB storage</li><li>`mount` - optimized for larger file sizes and longer videos with 5GB for source footage and 512MB for output render</li></ul> | -
|
298
|
+
disk | string | **(Deprecated)** The disk type to use for storing footage and asset for each render. See [disk types](https://shotstack.io/docs/guide/architecting-an-application/disk-types/) for more details. [default to `local`] <ul><li>`local` - optimized for high speed rendering with up to 512MB storage</li><li>`mount` - optimized for larger file sizes and longer videos with 5GB for source footage and 512MB for output render</li></ul> | -
|
177
299
|
|
178
300
|
-----
|
179
301
|
|
@@ -314,8 +436,8 @@ scale | float | Scale the asset to a fraction of the viewport size - i.e. ting t
|
|
314
436
|
position | string | Place the asset in one of nine predefined positions of the viewport. This is most effective for when the asset is scaled and you want to position the element to a specific position [default to `center`].<ul><li>`top` - top (center)</li><li>`topRight` - top right</li><li>`right` - right (center)</li><li>`bottomRight` - bottom right</li><li>`bottom` - bottom (center)</li><li>`bottomLeft` - bottom left</li><li>`left` - left (center)</li><li>`topLeft` - top left</li><li>`center` - center</li></ul> | -
|
315
437
|
offset | [Shotstack::Offset](#offset) | Offset the location of the asset relative to its position on the viewport. The offset distance is relative to the width of the viewport - for example an x offset of 0.5 will move the asset half the viewport width to the right. | -
|
316
438
|
transition | [Shotstack::Transition](#transition) | In and out transitions for a clip - i.e. fade in and fade out | -
|
317
|
-
effect | string | A motion effect to apply to the Clip. <ul><li>`zoomIn` - slow zoom in</li><li>`zoomOut` - slow zoom out</li><li>`slideLeft` - slow slide (pan) left</li><li>`slideRight` - slow slide (pan) right</li><li>`slideUp` - slow slide (pan) up</li><li>`slideDown` - slow slide (pan) down</li></ul
|
318
|
-
filter | string | A filter effect to apply to the Clip. <ul><li>`boost` - boost contrast and saturation</li><li>`contrast` - increase contrast</li><li>`darken` - darken the scene</li><li>`greyscale` - remove colour</li><li>`lighten` - lighten the scene</li><li>`muted` - reduce saturation and contrast</li><li>`
|
439
|
+
effect | string | A motion effect to apply to the Clip. <ul><li>`zoomIn` - slow zoom in</li><li>`zoomOut` - slow zoom out</li><li>`slideLeft` - slow slide (pan) left</li><li>`slideRight` - slow slide (pan) right</li><li>`slideUp` - slow slide (pan) up</li><li>`slideDown` - slow slide (pan) down</li></ul> The motion effect speed can also be controlled by appending `Fast` or `Slow` to the effect, e.g. `zoomInFast` or `slideRightSlow`.| -
|
440
|
+
filter | string | A filter effect to apply to the Clip. <ul><li>`boost` - boost contrast and saturation</li><li>`contrast` - increase contrast</li><li>`darken` - darken the scene</li><li>`greyscale` - remove colour</li><li>`lighten` - lighten the scene</li><li>`muted` - reduce saturation and contrast</li><li>`negative` - invert colors</li></ul> | -
|
319
441
|
opacity | float | s the opacity of the Clip where 1 is opaque and 0 is transparent. [default to `1`] | -
|
320
442
|
transform | [Shotstack::Transformation](#transformation) | A transformation lets you modify the visual properties of a clip. Available transformations are [Shotstack::RotateTransformation](#rotatetransformation), [Shotstack::SkewTransformation](#skewtransformation) and [Shotstack::FlipTransformation](#fliptransformation). Transformations can be combined to create interesting new shapes and effects. | -
|
321
443
|
|
@@ -331,10 +453,11 @@ resource such as an mp4 file.
|
|
331
453
|
```ruby
|
332
454
|
require "shotstack"
|
333
455
|
|
334
|
-
|
456
|
+
video_asset = Shotstack::VideoAsset.new(
|
335
457
|
src: 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/footage/table-mountain.mp4',
|
336
458
|
trim: 5,
|
337
459
|
volume: 0.5,
|
460
|
+
volume_effect: 'fadeIn',
|
338
461
|
crop: crop
|
339
462
|
)
|
340
463
|
```
|
@@ -346,6 +469,7 @@ Argument | Type | Description | Required
|
|
346
469
|
src | string | The video source URL. The URL must be publicly accessible or include credentials. | Y
|
347
470
|
trim | float | The start trim point of the video clip, in seconds (defaults to 0). Videos will start from the in trim point. The video will play until the file ends or the Clip length is reached. | -
|
348
471
|
volume | float | Set the volume for the video clip between 0 and 1 where 0 is muted and 1 is full volume (defaults to 0). | -
|
472
|
+
volume_effect | string | The volume effect to apply to the video asset.<ul><li>`fadeIn` - fade volume in only</li><li>`fadeOut` - fade volume out only</li><li>`fadeInFadeOut` - fade volume in and out</li></ul> | -
|
349
473
|
crop | [Shotstack::Crop](#crop) | Crop the sides of an asset by a relative amount. The size of the crop is specified using a scale between 0 and 1, relative to the screen width - i.e. a left crop of 0.5 will crop half of the asset from the left, a top crop of 0.25 will crop the top by quarter of the asset. | -
|
350
474
|
|
351
475
|
---
|
@@ -359,7 +483,7 @@ The **ImageAsset** is used to create video from images to compose an image. The
|
|
359
483
|
```ruby
|
360
484
|
require "shotstack"
|
361
485
|
|
362
|
-
|
486
|
+
image_asset = Shotstack::ImageAsset.new(
|
363
487
|
src: 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/images/earth.jpg',
|
364
488
|
crop: crop
|
365
489
|
)
|
@@ -383,7 +507,7 @@ The **TitleAsset** clip type lets you create video titles from a text string and
|
|
383
507
|
```ruby
|
384
508
|
require "shotstack"
|
385
509
|
|
386
|
-
|
510
|
+
title_asset = Shotstack::TitleAsset.new(
|
387
511
|
text: 'My Title',
|
388
512
|
style: 'minimal',
|
389
513
|
color: '#ffffff',
|
@@ -417,7 +541,7 @@ The **HtmlAsset** clip type lets you create text based layout and formatting usi
|
|
417
541
|
```ruby
|
418
542
|
require "shotstack"
|
419
543
|
|
420
|
-
|
544
|
+
html_asset = Shotstack::HtmlAsset.new(
|
421
545
|
html: '<p>Hello <b>World</b></p>',
|
422
546
|
css: 'p { color: #ffffff; } b { color: #ffff00; }',
|
423
547
|
width: 400,
|
@@ -450,7 +574,7 @@ publicly accessible URL to an audio resource such as an mp3 file.
|
|
450
574
|
```ruby
|
451
575
|
require "shotstack"
|
452
576
|
|
453
|
-
|
577
|
+
audio_asset = Shotstack::AudioAsset.new(
|
454
578
|
src: 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/music/unminus/lit.mp3',
|
455
579
|
trim: 2,
|
456
580
|
volume: 0.5,
|
@@ -478,7 +602,7 @@ The **LumaAsset** is used to create luma matte masks, transitions and effects be
|
|
478
602
|
```ruby
|
479
603
|
require "shotstack"
|
480
604
|
|
481
|
-
|
605
|
+
luma_asset = Shotstack::LumaAsset.new(
|
482
606
|
src: 'https://shotstack-assets.s3-ap-southeast-2.amazonaws.com/examples/luma-mattes/paint-left.mp4',
|
483
607
|
trim: 5
|
484
608
|
)
|
@@ -536,8 +660,8 @@ offset = Shotstack::Offset.new(
|
|
536
660
|
|
537
661
|
Argument | Type | Description | Required
|
538
662
|
:--- | :--- | :--- | :---:
|
539
|
-
x | float | Offset an asset on the horizontal axis (left or right), range varies from -
|
540
|
-
y | float | Offset an asset on the vertical axis (up or down), range varies from -
|
663
|
+
x | float | Offset an asset on the horizontal axis (left or right), range varies from -10 to 10. Positive numbers move the asset right, negative left. For all asset except titles the distance moved is relative to the width of the viewport - i.e. an X offset of 0.5 will move the asset half the screen width to the right. [default to `0`] | -
|
664
|
+
y | float | Offset an asset on the vertical axis (up or down), range varies from -10 to 10. Positive numbers move the asset up, negative down. For all asset except titles the distance moved is relative to the height of the viewport - i.e. an Y offset of 0.5 will move the asset up half the screen height. [default to `0`] | -
|
541
665
|
|
542
666
|
---
|
543
667
|
|
@@ -604,7 +728,7 @@ Rotate a clip by the specified angle in degrees. Rotation origin is set based on
|
|
604
728
|
```ruby
|
605
729
|
require "shotstack"
|
606
730
|
|
607
|
-
|
731
|
+
rotate_transformation = Shotstack::RotateTransformation.new(
|
608
732
|
angle: 45
|
609
733
|
)
|
610
734
|
```
|
@@ -626,7 +750,7 @@ Skew a clip so its edges are sheared at an angle. Use values between 0 and 3. Ov
|
|
626
750
|
```ruby
|
627
751
|
require "shotstack"
|
628
752
|
|
629
|
-
|
753
|
+
skew_transformation = Shotstack::SkewTransformation.new(
|
630
754
|
x: 0.5,
|
631
755
|
y: 0.5
|
632
756
|
)
|
@@ -650,7 +774,7 @@ Flip a clip vertically or horizontally. Acts as a mirror effect of the clip alon
|
|
650
774
|
```ruby
|
651
775
|
require "shotstack"
|
652
776
|
|
653
|
-
|
777
|
+
flip_transformation = Shotstack::FlipTransformation.new(
|
654
778
|
horizontal: true,
|
655
779
|
vertical: true
|
656
780
|
)
|
@@ -674,7 +798,7 @@ A merge field consists of a key; `find`, and a `value`; replace. Merge fields ca
|
|
674
798
|
```ruby
|
675
799
|
require "shotstack"
|
676
800
|
|
677
|
-
|
801
|
+
merge_field = Shotstack::MergeField.new(
|
678
802
|
find: 'NAME',
|
679
803
|
replace: 'Jane'
|
680
804
|
)
|
@@ -689,6 +813,59 @@ replace | replace | The replacement value. The replacement can be any valid JSON
|
|
689
813
|
|
690
814
|
---
|
691
815
|
|
816
|
+
## Template Schemas
|
817
|
+
|
818
|
+
The following schemas specify how to use templates to store and render templates. A template lets you save an
|
819
|
+
[Edit](#edit) that can be rendered by its template ID and optionally include merge fields that are merged with the
|
820
|
+
template when rendered.
|
821
|
+
|
822
|
+
### Template
|
823
|
+
|
824
|
+
A template is a saved [Edit](#edit) than can be loaded and re-used.
|
825
|
+
|
826
|
+
#### Example:
|
827
|
+
|
828
|
+
```ruby
|
829
|
+
require "shotstack"
|
830
|
+
|
831
|
+
template = Shotstack::Template.new(
|
832
|
+
name: 'My Template',
|
833
|
+
template: edit
|
834
|
+
)
|
835
|
+
```
|
836
|
+
|
837
|
+
#### Arguments:
|
838
|
+
|
839
|
+
Argument | Type | Description | Required
|
840
|
+
:--- | :--- | :--- | :---:
|
841
|
+
name | string | The template name. | Y
|
842
|
+
template | [Shotstack::Edit](#edit) | An edit defines the arrangement of a video on a timeline, an audio edit or an image design and the output format. | Y
|
843
|
+
|
844
|
+
### TemplateRender
|
845
|
+
|
846
|
+
Configure the id and optional merge fields to render a template by id.
|
847
|
+
|
848
|
+
#### Example:
|
849
|
+
|
850
|
+
|
851
|
+
```ruby
|
852
|
+
require "shotstack"
|
853
|
+
|
854
|
+
template = Shotstack::TemplateRender.new(
|
855
|
+
id: '21e781c0-8232-4418-fec1-cc99f0280c21',
|
856
|
+
merge: merge
|
857
|
+
)
|
858
|
+
```
|
859
|
+
|
860
|
+
#### Arguments:
|
861
|
+
|
862
|
+
Argument | Type | Description | Required
|
863
|
+
:--- | :--- | :--- | :---:
|
864
|
+
id | string | The id of the template to render in UUID format. | Y
|
865
|
+
merge | [Shotstack::MergeField[]](#mergefield) | An array of key/value pairs that provides an easy way to create templates with placeholders. The placeholders can be used to find and replace keys with values. For example you can search for the placeholder `{{NAME}}` and replace it with the value `Jane`. | -
|
866
|
+
|
867
|
+
---
|
868
|
+
|
692
869
|
## Output Schemas
|
693
870
|
|
694
871
|
The following schemas specify the output format and tings.
|
@@ -707,13 +884,14 @@ output = Shotstack::Output.new(
|
|
707
884
|
aspectRatio: '16:9',
|
708
885
|
size: size,
|
709
886
|
fps: 25,
|
710
|
-
|
887
|
+
scale_to: 'preview',
|
711
888
|
quality: 'medium',
|
712
889
|
repeat: true,
|
890
|
+
mute: false,
|
713
891
|
range: range,
|
714
892
|
poster: poster,
|
715
893
|
thumbnail: thumbnail,
|
716
|
-
|
894
|
+
destinations: destinations
|
717
895
|
)
|
718
896
|
```
|
719
897
|
|
@@ -729,10 +907,11 @@ fps | float | Override the default frames per second. Useful for when the source
|
|
729
907
|
scaleTo | string | Override the resolution and scale the video or image to render at a different size. When using scaleTo the asset should be edited at the resolution dimensions, i.e. use font sizes that look best at HD, then use scaleTo to output the file at SD and the text will be scaled to the correct size. This is useful if you want to create multiple asset sizes. <ul><li>`preview` - 512px x 288px @ 15fps</li><li>`mobile` - 640px x 360px @ 25fps</li><li>`sd` - 1024px x 576px @25fps</li><li>`hd` - 1280px x 720px @25fps</li><li>`1080` - 1920px x 1080px @25fps</li></ul> | -
|
730
908
|
quality | string | Adjust the output quality of the video, image or audio. Adjusting quality affects render speed, download speeds and storage requirements due to file size. The default `medium` provides the most optimized choice for all three factors. <ul><li>`low` - slightly reduced quality, smaller file size</li><li>`medium` - optimized quality, render speeds and file size</li><li>`high` - slightly increased quality, larger file size</li></ul> | -
|
731
909
|
repeat | bool | Loop tings for gif files. Set to `true` to loop, `false` to play only once. [default to `true`] | -
|
910
|
+
mute | bool | Mute the audio track of the output video. Set to `true` to mute, `false` to un-mute. | -
|
732
911
|
range | [Shotstack::Range](#range) | Specify a time range to render, i.e. to render only a portion of a video or audio file. Omit this ting to export the entire video. Range can also be used to render a frame at a specific time point - ting a range and output format as `jpg` will output a single frame image at the range `start` point. | -
|
733
912
|
poster | [Shotstack::Poster](#poster) | Generate a poster image from a specific point on the timeline. | -
|
734
913
|
thumbnail | [Shotstack::Thumbnail](#thumbnail) | Generate a thumbnail image from a specific point on the timeline. | -
|
735
|
-
destinations | [
|
914
|
+
destinations | [Shotstack::Destinations[]](#destinations) | A destination is a location where output files can be sent to for serving or hosting. By default all rendered assets are automatically sent to the Shotstack hosting destination. | -
|
736
915
|
|
737
916
|
---
|
738
917
|
|
@@ -830,6 +1009,8 @@ scale | float | Scale the thumbnail size to a fraction of the viewport size - i.
|
|
830
1009
|
|
831
1010
|
---
|
832
1011
|
|
1012
|
+
## Destinations
|
1013
|
+
|
833
1014
|
### ShotstackDestination
|
834
1015
|
|
835
1016
|
Send rendered asset to the Shotstack hosting and CDN service. This destination is enabled by default.
|
@@ -839,7 +1020,7 @@ Send rendered asset to the Shotstack hosting and CDN service. This destination i
|
|
839
1020
|
```ruby
|
840
1021
|
require "shotstack"
|
841
1022
|
|
842
|
-
|
1023
|
+
shotstack_destination = Shotstack::ShotstackDestination.new(
|
843
1024
|
provider: 'shotstack',
|
844
1025
|
exclude: false
|
845
1026
|
)
|
@@ -849,9 +1030,100 @@ shotstackDestination = Shotstack::ShotstackDestination.new(
|
|
849
1030
|
|
850
1031
|
Argument | Type | Description | Required
|
851
1032
|
:--- | :--- | :--- | :---:
|
852
|
-
provider | string | The destination to send rendered
|
1033
|
+
provider | string | The destination to send rendered assets to - set to `shotstack` for Shotstack. | Y
|
853
1034
|
exclude | bool | Set to `true` to opt-out from the Shotstack hosting and CDN service. All files must be downloaded within 24 hours of rendering. [default to `false`] | -
|
854
1035
|
|
1036
|
+
### MuxDestination
|
1037
|
+
|
1038
|
+
Send rendered videos to the [Mux](https://shotstack.io/docs/guide/serving-assets/destinations/mux) video hosting and
|
1039
|
+
streaming service. Mux credentials are required and added via the
|
1040
|
+
[dashboard](https://dashboard.shotstack.io/integrations/mux), not in the request.
|
1041
|
+
|
1042
|
+
#### Example:
|
1043
|
+
|
1044
|
+
```ruby
|
1045
|
+
require "shotstack"
|
1046
|
+
|
1047
|
+
mux_destination = Shotstack::MuxDestination.new(
|
1048
|
+
provider: 'mux',
|
1049
|
+
options: mux_destination_options
|
1050
|
+
)
|
1051
|
+
```
|
1052
|
+
#### Arguments:
|
1053
|
+
|
1054
|
+
Argument | Type | Description | Required
|
1055
|
+
:--- | :--- | :--- | :---:
|
1056
|
+
provider | string | The destination to send rendered assets to - set to `mux` for Mux. | Y
|
1057
|
+
options | [Shotstack::MuxDestinationOptions](#muxdestinationoptions) | Additional Mux configuration and features. | -
|
1058
|
+
|
1059
|
+
### MuxDestinationOptions
|
1060
|
+
|
1061
|
+
Pass additional options to control how Mux processes video. Currently supports playback policy option.
|
1062
|
+
|
1063
|
+
#### Example:
|
1064
|
+
|
1065
|
+
mux_destination_options = Shotstack::MuxDestinationOptions.new(
|
1066
|
+
playback_policy: ['public']
|
1067
|
+
)
|
1068
|
+
```
|
1069
|
+
|
1070
|
+
#### Arguments:
|
1071
|
+
|
1072
|
+
Argument | Type | Description | Required
|
1073
|
+
:--- | :--- | :--- | :---:
|
1074
|
+
playback_policy | [string] | Sets the Mux `playback_policy` option. Value is an array of strings - use **public**, **signed**, or both. | -
|
1075
|
+
|
1076
|
+
### S3Destination
|
1077
|
+
|
1078
|
+
Send rendered videos to an [Amazon S3](https://shotstack.io/docs/guide/serving-assets/destinations/s3) bucket. Send
|
1079
|
+
files to any region with your own prefix and filename. AWS credentials are required and added via the
|
1080
|
+
[dashboard](https://dashboard.shotstack.io/integrations/s3), not in the request.
|
1081
|
+
|
1082
|
+
#### Example:
|
1083
|
+
|
1084
|
+
```python
|
1085
|
+
require "shotstack"
|
1086
|
+
|
1087
|
+
const s3_destination = new Shotstack::S3Destination.new(
|
1088
|
+
provider: 's3',
|
1089
|
+
options: S3_destination_options
|
1090
|
+
)
|
1091
|
+
```
|
1092
|
+
#### Arguments:
|
1093
|
+
|
1094
|
+
Argument | Type | Description | Required
|
1095
|
+
:--- | :--- | :--- | :---:
|
1096
|
+
provider | string | The destination to send rendered assets to - set to `s3` for S3. | Y
|
1097
|
+
options | [S3DestinationOptions](#s3destinationoptions) | Additional S3 configuration options. | -
|
1098
|
+
|
1099
|
+
### S3DestinationOptions
|
1100
|
+
|
1101
|
+
Pass additional options to control how files are stored in S3.
|
1102
|
+
|
1103
|
+
#### Example:
|
1104
|
+
|
1105
|
+
```python
|
1106
|
+
require "shotstack"
|
1107
|
+
|
1108
|
+
const s3_destination_options = new Shotstack::S3DestinationOptions.new(
|
1109
|
+
region: 'us-east-1',
|
1110
|
+
bucket: 'my-bucket',
|
1111
|
+
prefix: 'my-renders',
|
1112
|
+
filename: 'my-file',
|
1113
|
+
acl: 'public-read',
|
1114
|
+
)
|
1115
|
+
```
|
1116
|
+
|
1117
|
+
#### Arguments:
|
1118
|
+
|
1119
|
+
Argument | Type | Description | Required
|
1120
|
+
:--- | :--- | :--- | :---:
|
1121
|
+
region | string | Choose the region to send the file to. Must be a valid [AWS region](https://docs.aws.amazon.com/general/latest/gr/s3.html#s3_region) string like `us-east-1` or `ap-southeast-2` | Y
|
1122
|
+
bucket | string | The bucket name to send files to. The bucket must exist in the AWS account before files can be sent. | Y
|
1123
|
+
prefix | string | A prefix for the file being sent. This is typically a folder name, i.e. `videos` or `customerId/videos`. | -
|
1124
|
+
filename | string | Use your own filename instead of the default render ID filename. Note: omit the file extension as this will be appended depending on the output format. Also `-poster.jpg` and `-thumb.jpg` will be appended for poster and thumbnail images. | -
|
1125
|
+
acl | string | Sets the S3 Access Control List (acl) permissions. Default is `private`. Must use a valid S3 [Canned ACL](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl). | -
|
1126
|
+
|
855
1127
|
---
|
856
1128
|
|
857
1129
|
## Render Response Schemas
|
@@ -921,6 +1193,98 @@ data | [Shotstack::Edit](#edit) | The timeline and output data to be rendered. |
|
|
921
1193
|
created | string | The time the render task was initially queued. | Y
|
922
1194
|
updated | string | The time the render status was last updated. | Y
|
923
1195
|
|
1196
|
+
---
|
1197
|
+
|
1198
|
+
## Template Response Schemas
|
1199
|
+
|
1200
|
+
The following schemas are returned by the templates endpoint, including create, update and rendering a template.
|
1201
|
+
|
1202
|
+
### TemplateResponse
|
1203
|
+
|
1204
|
+
The response received after a [template](#create-template) is submitted. The template is saved and a unique
|
1205
|
+
template id is returned.
|
1206
|
+
|
1207
|
+
#### Arguments:
|
1208
|
+
|
1209
|
+
Argument | Type | Description | Required
|
1210
|
+
:--- | :--- | :--- | :---:
|
1211
|
+
success | bool | `true` if successfully created, else `false`. | Y
|
1212
|
+
message | string | `Created`, `Bad Request` or an error message. | Y
|
1213
|
+
response | [Shotstack::TemplateResponseData](#templateresponsedata) | `TemplateResponseData` or an error message. | Y
|
1214
|
+
|
1215
|
+
### TemplateResponseData
|
1216
|
+
|
1217
|
+
The response data returned with the [Shotstack.TemplateResponse](#templateresponse).
|
1218
|
+
|
1219
|
+
#### Arguments:
|
1220
|
+
|
1221
|
+
Argument | Type | Description | Required
|
1222
|
+
:--- | :--- | :--- | :---:
|
1223
|
+
message | string | Success response message or error details. | Y
|
1224
|
+
id | string | The unique id of the template in UUID format. | Y
|
1225
|
+
|
1226
|
+
### TemplateDataResponse
|
1227
|
+
|
1228
|
+
The template data including the template name and [Edit](#edit).
|
1229
|
+
|
1230
|
+
#### Arguments:
|
1231
|
+
|
1232
|
+
Argument | Type | Description | Required
|
1233
|
+
:--- | :--- | :--- | :---:
|
1234
|
+
success | bool | `true` if successfully returned, else `false`. | Y
|
1235
|
+
message | string | `OK`, `Bad Request` or an error message. | Y
|
1236
|
+
response | [Shotstack::TemplateDataResponseData](#templatedataresponsedata) | `TemplateDataResponseData` or an error message. | Y
|
1237
|
+
|
1238
|
+
### TemplateDataResponseData
|
1239
|
+
|
1240
|
+
The response data returned with the [TemplateDataResponse](#templatedataresponse).
|
1241
|
+
|
1242
|
+
#### Arguments:
|
1243
|
+
|
1244
|
+
Argument | Type | Description | Required
|
1245
|
+
:--- | :--- | :--- | :---:
|
1246
|
+
id | string | The unique id of the template in UUID format. | Y
|
1247
|
+
name | string | The template name. | Y
|
1248
|
+
owner | string | The owner id of the templates. | Y
|
1249
|
+
template [Shotstack::Edit](#edit) | `Edit` or an error message. | Y
|
1250
|
+
|
1251
|
+
### TemplateListResponse
|
1252
|
+
|
1253
|
+
A list of previously saved templates.
|
1254
|
+
|
1255
|
+
#### Arguments:
|
1256
|
+
|
1257
|
+
Argument | Type | Description | Required
|
1258
|
+
:--- | :--- | :--- | :---:
|
1259
|
+
success | bool | `true` if successfully returned, else `false`. | Y
|
1260
|
+
message | string | `OK`, `Bad Request` or an error message. | Y
|
1261
|
+
response | [Shotstack::TemplateListResponseData](#templatelistresponsedata) | `TemplateListResponseData` or an error message. | Y
|
1262
|
+
|
1263
|
+
### TemplateListResponseData
|
1264
|
+
|
1265
|
+
The response data returned with the [TemplateListResponse](#templatelistresponse).
|
1266
|
+
|
1267
|
+
#### Arguments:
|
1268
|
+
|
1269
|
+
Argument | Type | Description | Required
|
1270
|
+
:--- | :--- | :--- | :---:
|
1271
|
+
owner | bool | The owner id of the templates. | Y
|
1272
|
+
templates | [Shotstack::TemplateListResponseItem[]](#templatelistresponseitem) | The list of templates. | Y
|
1273
|
+
|
1274
|
+
### TemplateListResponseItem
|
1275
|
+
|
1276
|
+
The individual template item returned with the [TemplateListResponseData](#templatelistresponsedata) templates
|
1277
|
+
list.
|
1278
|
+
|
1279
|
+
#### Arguments:
|
1280
|
+
|
1281
|
+
Argument | Type | Description | Required
|
1282
|
+
:--- | :--- | :--- | :---:
|
1283
|
+
id | string | The unique id of the template in UUID format. | Y
|
1284
|
+
name | string | The template name | Y
|
1285
|
+
created | string | The time the template was created. | -
|
1286
|
+
updated | string | The time the template was last updated. | -
|
1287
|
+
|
924
1288
|
---
|
925
1289
|
## Inspecting Media
|
926
1290
|
|
@@ -1099,7 +1463,7 @@ Argument | Type | Description | Required
|
|
1099
1463
|
id | string | The unique id of the hosted asset in UUID format. | -
|
1100
1464
|
owner | string | The owner id of the render task. | -
|
1101
1465
|
region | string | The region the asset is hosted, currently only `au` (Australia). | -
|
1102
|
-
|
1466
|
+
render_id | string | The original render id that created the asset in UUID format. Multiple asset can share the same render id. | -
|
1103
1467
|
filename | string | The asset file name. | -
|
1104
1468
|
url | string | The asset file name. | -
|
1105
1469
|
status | string | The status of the asset. <ul><li>`importing` - the asset is being copied to the hosting service</li><li>`ready` - the asset is ready to be served to users</li><li>`failed` - the asset failed to copy or delete</li><li>`deleted` - the asset has been deleted</li></ul> | -
|