Skip to content

Commit 803df49

Browse files
committed
fix schema
1 parent b5c0841 commit 803df49

File tree

21 files changed

+289
-46
lines changed

21 files changed

+289
-46
lines changed

go.work.sum

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
2+
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
3+
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
4+
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
5+
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=

packages/it-tests/src/monorepo/package-metadata.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ test('All packages should have a README.md file', () => {
7575
const webcodecsLicenseDisclaimer = [
7676
'',
7777
'## License',
78-
'This package is licensed under the [/docs/license](Remotion License).',
78+
'This package is licensed under the [Remotion License](/docs/license).',
7979
'We consider a team of 4 or more people a "company".',
8080
'',
8181
'**For "companies"**: A Remotion Company license needs to be obtained to use this package.',
8282
'In a future version of `@remotion/webcodecs`, this package will also require the purchase of a newly created "WebCodecs Conversion Seat". [Get in touch](https://remotion.dev/contact) with us if you are planning to use this package.',
8383
'',
8484
'**For individuals and teams up to 3**: You can use this package for free.',
8585
'',
86-
'This is a short, non-binding explanation of our license. See the [https://remotion.dev/docs/license](License) itself for more details.',
86+
'This is a short, non-binding explanation of our license. See the [License](https://remotion.dev/docs/license) itself for more details.',
8787
].join('\n');
8888

8989
const readme =

packages/it-tests/src/monorepo/php-package.test.ts

+4-10
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,10 @@ class Semantic
120120
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
121121
const parsedJson = JSON.parse(jsonOutput);
122122

123-
expect(
124-
removeUndefined({
125-
...parsedJson,
126-
type: 'start',
127-
}),
128-
).toEqual(removeUndefined(nativeVersion));
123+
expect({
124+
...parsedJson,
125+
type: 'start',
126+
}).toEqual(nativeVersion);
129127
});
130128

131129
test('PHP package should create the same progress payload as normal Lambda package', async () => {
@@ -148,8 +146,4 @@ class Semantic
148146
const parsedJson = JSON.parse(jsonOutput);
149147
expect(parsedJson).toEqual({...nativeVersion, s3OutputProvider: null});
150148
});
151-
152-
const removeUndefined = (data: unknown) => {
153-
return JSON.parse(JSON.stringify(data));
154-
};
155149
});

packages/it-tests/src/monorepo/python-package.test.ts

+5-11
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,10 @@ test('Python package should create the same renderMedia payload as normal Lambda
104104
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
105105
const parsedJson = JSON.parse(jsonOutput);
106106

107-
expect(
108-
removeUndefined({
109-
...parsedJson,
110-
type: 'start',
111-
}),
112-
).toEqual(removeUndefined(nativeVersion));
107+
expect({
108+
...parsedJson,
109+
type: 'start',
110+
}).toEqual(nativeVersion);
113111
});
114112

115113
test('Python package should create the same progress payload as normal Lambda package', async () => {
@@ -192,11 +190,7 @@ test('Python package should create the same renderStill payload as normal Lambda
192190
...newObject,
193191
forceBucketName: nativeVersion.bucketName,
194192
};
195-
expect(
196-
removeUndefined({
197-
...parsedJson,
198-
}),
199-
).toEqual(removeUndefined(assertValue));
193+
expect(removeUndefined(parsedJson)).toEqual(removeUndefined(assertValue));
200194
});
201195
const removeUndefined = (data: unknown) => {
202196
return JSON.parse(JSON.stringify(data));

packages/it-tests/src/monorepo/ruby-package.test.ts

+71-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ test('Set the right version for Ruby', () => {
1212
fs.writeFileSync(versionPath, `VERSION = "${VERSION}"`);
1313
});
1414

15-
test('Ruby package', () => {
16-
const output = execSync('ruby lib/sdk_spec.rb', {
15+
test('Render progress payload', () => {
16+
const output = execSync('ruby lib/render_progress_payload_spec.rb', {
1717
cwd: rubySdk,
1818
}).toString();
1919
const nativeVersion = LambdaInternals.getRenderProgressPayload({
@@ -31,3 +31,72 @@ test('Ruby package', () => {
3131
});
3232
expect(JSON.parse(output)).toEqual(nativeVersion);
3333
});
34+
35+
test('Render Media payload', async () => {
36+
const output = execSync('ruby lib/render_media_on_lambda_payload_spec.rb', {
37+
cwd: rubySdk,
38+
}).toString();
39+
40+
const nativeVersion = await LambdaInternals.makeLambdaRenderMediaPayload({
41+
region: 'us-east-1',
42+
composition: 'react-svg',
43+
functionName: 'remotion-render',
44+
serveUrl: 'testbed',
45+
codec: 'h264',
46+
inputProps: {
47+
hi: 'there',
48+
},
49+
audioBitrate: null,
50+
audioCodec: null,
51+
chromiumOptions: {},
52+
colorSpace: null,
53+
concurrencyPerLambda: 1,
54+
crf: undefined,
55+
deleteAfter: null,
56+
downloadBehavior: {
57+
fileName: 'hi',
58+
type: 'download',
59+
},
60+
envVariables: {},
61+
everyNthFrame: 1,
62+
forceBucketName: null,
63+
forceHeight: null,
64+
forceWidth: null,
65+
frameRange: null,
66+
framesPerLambda: null,
67+
imageFormat: 'jpeg',
68+
jpegQuality: 80,
69+
logLevel: 'info',
70+
maxRetries: 1,
71+
muted: false,
72+
numberOfGifLoops: 0,
73+
offthreadVideoCacheSizeInBytes: null,
74+
outName: null,
75+
overwrite: false,
76+
pixelFormat: undefined,
77+
privacy: 'public',
78+
proResProfile: undefined,
79+
rendererFunctionName: null,
80+
scale: 1,
81+
timeoutInMilliseconds: 30000,
82+
videoBitrate: null,
83+
encodingMaxRate: null,
84+
encodingBufferSize: null,
85+
webhook: {
86+
secret: 'abc',
87+
url: 'https://example.com',
88+
customData: {
89+
hi: 'there',
90+
},
91+
},
92+
x264Preset: null,
93+
preferLossless: false,
94+
indent: false,
95+
forcePathStyle: false,
96+
metadata: {
97+
Author: 'Lunar',
98+
},
99+
});
100+
101+
expect(JSON.parse(output)).toEqual(nativeVersion);
102+
});

packages/lambda-go/internalops.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,
7171
} else {
7272
internalParams.ImageFormat = options.ImageFormat
7373
}
74-
internalParams.Crf = options.Crf
74+
if options.Crf == 0 {
75+
internalParams.Crf = nil
76+
} else {
77+
internalParams.Crf = options.Crf
78+
}
7579
if options.Privacy == "" {
7680
internalParams.Privacy = "public"
7781
} else {

packages/lambda-go/models.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ type renderInternalOptions struct {
5454
InputProps interface{} `json:"inputProps"`
5555
Type string `json:"type,omitempty"`
5656
Codec string `json:"codec"`
57+
ProResProfile interface{} `json:"proResProfile"`
58+
PixelFormat interface{} `json:"pixelFormat"`
5759
ImageFormat string `json:"imageFormat"`
58-
Crf int `json:"crf,omitempty"`
60+
Crf interface{} `json:"crf"`
5961
EnvVariables interface{} `json:"envVariables,omitempty"`
6062
Metadata interface{} `json:"metadata,omitempty"`
6163
JpegQuality int `json:"jpegQuality"`

packages/lambda-php/src/RenderParams.php

+14
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,20 @@ public function serializeParams()
217217

218218
if ($this->getProResProfile() !== null) {
219219
$parameters['proResProfile'] = $this->getProResProfile();
220+
} else {
221+
$parameters['proResProfile'] = null;
222+
}
223+
224+
if ($this->getPixelFormat() !== null) {
225+
$parameters['pixelFormat'] = $this->getPixelFormat();
226+
} else {
227+
$parameters['pixelFormat'] = null;
228+
}
229+
230+
if ($this->getCrf() !== null) {
231+
$parameters['crf'] = $this->getCrf();
232+
} else {
233+
$parameters['crf'] = null;
220234
}
221235

222236
return $parameters;

packages/lambda-python/remotion_lambda/models.py

+6
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,8 @@ def serialize_params(self) -> Dict:
369369

370370
if self.crf is not None:
371371
parameters['crf'] = self.crf
372+
else:
373+
parameters['crf'] = None
372374

373375
if self.env_variables is None:
374376
parameters['envVariables'] = {}
@@ -378,9 +380,13 @@ def serialize_params(self) -> Dict:
378380

379381
if self.pixel_format is not None:
380382
parameters['pixelFormat'] = self.pixel_format
383+
else:
384+
parameters['pixelFormat'] = None
381385

382386
if self.pro_res_profile is not None:
383387
parameters['proResProfile'] = self.pro_res_profile
388+
else:
389+
parameters['proResProfile'] = None
384390

385391
if self.x264_preset is not None:
386392
parameters['x264Preset'] = self.x264_preset

packages/lambda-ruby/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# @remotion/lambda-ruby
2+
3+
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/lambda-ruby.svg?style=flat&color=black&label=Downloads)](https://npmcharts.com/compare/@remotion/lambda-ruby?minimal=true)
4+
5+
## Installation
6+
7+
```bash
8+
npm install @remotion/lambda-ruby --save-exact
9+
```
10+
11+
When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.
12+
Remove the `^` character from the version number to use the exact version.
13+
14+
## Usage
15+
16+
See the [documentation](https://www.remotion.dev/docs/lambda/ruby) for more information.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
require_relative 'sdk'
2+
require_relative 's3_output_provider'
3+
require 'json'
4+
5+
# Create a test instance of the RemotionLambda::Client
6+
client = RemotionLambda::Client.new(
7+
function_name: 'test-function',
8+
serve_url: 'https://example.com',
9+
region: 'us-east-1'
10+
)
11+
12+
# Call get_render_media_on_lambda with sample data
13+
payload = client.get_render_media_on_lambda_payload(
14+
codec: "h264",
15+
metadata: {
16+
Author: "Lunar"
17+
},
18+
bucket_name: nil,
19+
composition: "react-svg",
20+
webhook: {
21+
customData: {
22+
hi: "there",
23+
},
24+
secret: "abc",
25+
url: "https://example.com",
26+
},
27+
download_behavior: {
28+
fileName: "hi",
29+
type: "download",
30+
},
31+
input_props: {
32+
hi: "there",
33+
}
34+
)
35+
36+
# Print as JSON
37+
puts JSON.generate(payload)

packages/lambda-ruby/lib/sdk.rb

+98
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,104 @@ def get_render_progress(render_id, bucket_name)
4646
body
4747
end
4848

49+
def get_render_media_on_lambda_payload(
50+
bucket_name: nil,
51+
codec:,
52+
audio_bitrate: nil,
53+
audio_codec: nil,
54+
color_space: nil,
55+
composition: nil,
56+
concurrency_per_lambda: 1,
57+
crf: nil,
58+
delete_after: nil,
59+
download_behavior: nil,
60+
encoding_buffer_size: nil,
61+
encoding_max_rate: nil,
62+
env_variables: {},
63+
every_nth_frame: 1,
64+
force_height: nil,
65+
force_path_style: false,
66+
force_width: nil,
67+
frame_range: nil,
68+
frames_per_lambda: nil,
69+
image_format: "jpeg",
70+
input_props: {},
71+
jpeg_quality: 80,
72+
log_level: "info",
73+
max_retries: 1,
74+
metadata: {},
75+
muted: false,
76+
number_of_gif_loops: 0,
77+
offthread_video_cache_size_in_bytes: nil,
78+
out_name: nil,
79+
overwrite: false,
80+
pixel_format: nil,
81+
prefer_lossless: false,
82+
privacy: "public",
83+
pro_res_profile: nil,
84+
renderer_function_name: nil,
85+
scale: 1,
86+
serve_url: "testbed",
87+
timeout_in_milliseconds: 30000,
88+
type: "start",
89+
video_bitrate: nil,
90+
webhook: nil,
91+
x264_preset: nil,
92+
chromium_options: {}
93+
)
94+
95+
payload = {
96+
audioBitrate: audio_bitrate,
97+
audioCodec: audio_codec,
98+
codec: codec,
99+
colorSpace: color_space,
100+
composition: composition,
101+
concurrencyPerLambda: concurrency_per_lambda,
102+
chromiumOptions: chromium_options,
103+
crf: crf,
104+
deleteAfter: delete_after,
105+
downloadBehavior: download_behavior,
106+
encodingBufferSize: encoding_buffer_size,
107+
encodingMaxRate: encoding_max_rate,
108+
envVariables: env_variables,
109+
everyNthFrame: every_nth_frame,
110+
forceHeight: force_height,
111+
forcePathStyle: force_path_style,
112+
forceWidth: force_width,
113+
frameRange: frame_range,
114+
framesPerLambda: frames_per_lambda,
115+
imageFormat: image_format,
116+
inputProps: {
117+
type: "payload",
118+
payload: JSON.generate(input_props)
119+
},
120+
jpegQuality: jpeg_quality,
121+
logLevel: log_level,
122+
maxRetries: max_retries,
123+
metadata: metadata,
124+
muted: muted,
125+
numberOfGifLoops: number_of_gif_loops,
126+
offthreadVideoCacheSizeInBytes: offthread_video_cache_size_in_bytes,
127+
outName: out_name,
128+
overwrite: overwrite,
129+
pixelFormat: pixel_format,
130+
preferLossless: prefer_lossless,
131+
privacy: privacy,
132+
proResProfile: pro_res_profile,
133+
rendererFunctionName: renderer_function_name,
134+
scale: scale,
135+
serveUrl: serve_url,
136+
timeoutInMilliseconds: timeout_in_milliseconds,
137+
type: "start",
138+
version: VERSION,
139+
videoBitrate: video_bitrate,
140+
webhook: webhook,
141+
x264Preset: x264_preset,
142+
bucketName: bucket_name
143+
}
144+
payload
145+
end
146+
49147
def get_render_progress_payload(
50148
render_id:,
51149
bucket_name:,

0 commit comments

Comments
 (0)