@contractspec/lib.video-gen 2.7.17 → 2.7.18
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.
- package/dist/browser/compositions/api-overview.js +1 -645
- package/dist/browser/compositions/index.js +1 -1133
- package/dist/browser/compositions/primitives/animated-text.js +1 -144
- package/dist/browser/compositions/primitives/brand-frame.js +1 -181
- package/dist/browser/compositions/primitives/code-block.js +1 -226
- package/dist/browser/compositions/primitives/index.js +1 -656
- package/dist/browser/compositions/primitives/progress-bar.js +1 -59
- package/dist/browser/compositions/primitives/terminal.js +1 -265
- package/dist/browser/compositions/primitives/transition.js +1 -98
- package/dist/browser/compositions/social-clip.js +1 -500
- package/dist/browser/compositions/terminal-demo.js +1 -558
- package/dist/browser/design/index.js +1 -155
- package/dist/browser/design/layouts.js +1 -50
- package/dist/browser/design/motion.js +1 -43
- package/dist/browser/design/tokens.js +1 -28
- package/dist/browser/design/typography.js +1 -61
- package/dist/browser/docs/compositions.docblock.js +1 -182
- package/dist/browser/docs/design.docblock.js +2 -17
- package/dist/browser/docs/generators.docblock.js +2 -24
- package/dist/browser/docs/rendering.docblock.js +2 -24
- package/dist/browser/docs/video-gen.docblock.js +2 -17
- package/dist/browser/generators/index.js +7 -769
- package/dist/browser/generators/scene-planner.js +7 -651
- package/dist/browser/generators/script-generator.js +7 -599
- package/dist/browser/generators/video-generator.js +7 -768
- package/dist/browser/i18n/catalogs/en.js +3 -135
- package/dist/browser/i18n/catalogs/es.js +3 -135
- package/dist/browser/i18n/catalogs/fr.js +3 -135
- package/dist/browser/i18n/catalogs/index.js +7 -387
- package/dist/browser/i18n/index.js +7 -459
- package/dist/browser/i18n/keys.js +1 -54
- package/dist/browser/i18n/locale.js +1 -21
- package/dist/browser/i18n/messages.js +7 -399
- package/dist/browser/index.js +7 -1903
- package/dist/browser/player/demo-player.js +1 -1136
- package/dist/browser/player/index.js +1 -1136
- package/dist/browser/remotion/Root.js +2 -1172
- package/dist/browser/remotion/index.js +2 -1173
- package/dist/browser/renderers/config.js +1 -40
- package/dist/browser/renderers/index.js +1 -160
- package/dist/browser/renderers/local.js +1 -156
- package/dist/browser/types.js +1 -13
- package/dist/compositions/api-overview.js +1 -639
- package/dist/compositions/index.js +1 -1127
- package/dist/compositions/primitives/animated-text.js +1 -138
- package/dist/compositions/primitives/brand-frame.js +1 -175
- package/dist/compositions/primitives/code-block.js +1 -220
- package/dist/compositions/primitives/index.js +1 -650
- package/dist/compositions/primitives/progress-bar.js +1 -53
- package/dist/compositions/primitives/terminal.js +1 -259
- package/dist/compositions/primitives/transition.js +1 -92
- package/dist/compositions/social-clip.js +1 -494
- package/dist/compositions/terminal-demo.js +1 -552
- package/dist/design/index.js +1 -149
- package/dist/design/layouts.js +1 -44
- package/dist/design/motion.js +1 -37
- package/dist/design/tokens.js +1 -22
- package/dist/design/typography.js +1 -55
- package/dist/docs/compositions.docblock.js +1 -182
- package/dist/docs/design.docblock.js +2 -17
- package/dist/docs/generators.docblock.js +2 -24
- package/dist/docs/rendering.docblock.js +2 -24
- package/dist/docs/video-gen.docblock.js +2 -17
- package/dist/generators/index.js +7 -763
- package/dist/generators/scene-planner.js +7 -645
- package/dist/generators/script-generator.js +7 -593
- package/dist/generators/video-generator.js +7 -762
- package/dist/i18n/catalogs/en.js +3 -129
- package/dist/i18n/catalogs/es.js +3 -129
- package/dist/i18n/catalogs/fr.js +3 -129
- package/dist/i18n/catalogs/index.js +7 -381
- package/dist/i18n/index.js +7 -453
- package/dist/i18n/keys.js +1 -48
- package/dist/i18n/locale.js +1 -15
- package/dist/i18n/messages.js +7 -393
- package/dist/index.js +7 -1897
- package/dist/node/compositions/api-overview.js +1 -640
- package/dist/node/compositions/index.js +1 -1128
- package/dist/node/compositions/primitives/animated-text.js +1 -139
- package/dist/node/compositions/primitives/brand-frame.js +1 -176
- package/dist/node/compositions/primitives/code-block.js +1 -221
- package/dist/node/compositions/primitives/index.js +1 -651
- package/dist/node/compositions/primitives/progress-bar.js +1 -54
- package/dist/node/compositions/primitives/terminal.js +1 -260
- package/dist/node/compositions/primitives/transition.js +1 -93
- package/dist/node/compositions/social-clip.js +1 -495
- package/dist/node/compositions/terminal-demo.js +1 -553
- package/dist/node/design/index.js +1 -150
- package/dist/node/design/layouts.js +1 -45
- package/dist/node/design/motion.js +1 -38
- package/dist/node/design/tokens.js +1 -23
- package/dist/node/design/typography.js +1 -56
- package/dist/node/docs/compositions.docblock.js +1 -182
- package/dist/node/docs/design.docblock.js +2 -17
- package/dist/node/docs/generators.docblock.js +2 -24
- package/dist/node/docs/rendering.docblock.js +2 -24
- package/dist/node/docs/video-gen.docblock.js +2 -17
- package/dist/node/generators/index.js +7 -764
- package/dist/node/generators/scene-planner.js +7 -646
- package/dist/node/generators/script-generator.js +7 -594
- package/dist/node/generators/video-generator.js +7 -763
- package/dist/node/i18n/catalogs/en.js +3 -130
- package/dist/node/i18n/catalogs/es.js +3 -130
- package/dist/node/i18n/catalogs/fr.js +3 -130
- package/dist/node/i18n/catalogs/index.js +7 -382
- package/dist/node/i18n/index.js +7 -454
- package/dist/node/i18n/keys.js +1 -49
- package/dist/node/i18n/locale.js +1 -16
- package/dist/node/i18n/messages.js +7 -394
- package/dist/node/index.js +7 -1898
- package/dist/node/player/demo-player.js +1 -1131
- package/dist/node/player/index.js +1 -1131
- package/dist/node/remotion/Root.js +2 -1167
- package/dist/node/remotion/index.js +2 -1168
- package/dist/node/renderers/config.js +1 -35
- package/dist/node/renderers/index.js +1 -155
- package/dist/node/renderers/local.js +1 -151
- package/dist/node/types.js +1 -8
- package/dist/player/demo-player.js +1 -1130
- package/dist/player/index.js +1 -1130
- package/dist/remotion/Root.js +2 -1166
- package/dist/remotion/index.js +2 -1167
- package/dist/renderers/config.js +1 -34
- package/dist/renderers/index.js +1 -154
- package/dist/renderers/local.js +1 -150
- package/dist/types.js +1 -7
- package/package.json +16 -16
|
@@ -1,40 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/renderers/config.ts
|
|
10
|
-
var defaultRenderConfig = {
|
|
11
|
-
codec: "h264",
|
|
12
|
-
outputFormat: "mp4",
|
|
13
|
-
crf: 18,
|
|
14
|
-
pixelFormat: "yuv420p"
|
|
15
|
-
};
|
|
16
|
-
var codecFormatMap = {
|
|
17
|
-
h264: "mp4",
|
|
18
|
-
h265: "mp4",
|
|
19
|
-
vp8: "webm",
|
|
20
|
-
vp9: "webm"
|
|
21
|
-
};
|
|
22
|
-
var qualityPresets = {
|
|
23
|
-
draft: { crf: 28, concurrency: 1 },
|
|
24
|
-
standard: { crf: 18, concurrency: undefined },
|
|
25
|
-
high: { crf: 12, concurrency: undefined }
|
|
26
|
-
};
|
|
27
|
-
function resolveRenderConfig(userConfig, preset) {
|
|
28
|
-
const presetValues = preset ? qualityPresets[preset] : {};
|
|
29
|
-
return {
|
|
30
|
-
...defaultRenderConfig,
|
|
31
|
-
...presetValues,
|
|
32
|
-
...userConfig
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export {
|
|
36
|
-
resolveRenderConfig,
|
|
37
|
-
qualityPresets,
|
|
38
|
-
defaultRenderConfig,
|
|
39
|
-
codecFormatMap
|
|
40
|
-
};
|
|
1
|
+
var x=((b)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(j,k)=>(typeof require<"u"?require:j)[k]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var m={codec:"h264",outputFormat:"mp4",crf:18,pixelFormat:"yuv420p"},A={h264:"mp4",h265:"mp4",vp8:"webm",vp9:"webm"},v={draft:{crf:28,concurrency:1},standard:{crf:18,concurrency:void 0},high:{crf:12,concurrency:void 0}};function B(b,j){let k=j?v[j]:{};return{...m,...k,...b}}export{B as resolveRenderConfig,v as qualityPresets,m as defaultRenderConfig,A as codecFormatMap};
|
|
@@ -1,160 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/design/layouts.ts
|
|
10
|
-
import { VIDEO_FORMATS } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
|
|
11
|
-
var DEFAULT_FPS = 30;
|
|
12
|
-
var videoSafeZone = {
|
|
13
|
-
horizontal: 120,
|
|
14
|
-
vertical: 80,
|
|
15
|
-
contentWidth: 1680,
|
|
16
|
-
contentHeight: 920
|
|
17
|
-
};
|
|
18
|
-
function scaleSafeZone(format) {
|
|
19
|
-
const scaleX = format.width / 1920;
|
|
20
|
-
const scaleY = format.height / 1080;
|
|
21
|
-
return {
|
|
22
|
-
horizontal: Math.round(videoSafeZone.horizontal * scaleX),
|
|
23
|
-
vertical: Math.round(videoSafeZone.vertical * scaleY),
|
|
24
|
-
contentWidth: Math.round(videoSafeZone.contentWidth * scaleX),
|
|
25
|
-
contentHeight: Math.round(videoSafeZone.contentHeight * scaleY)
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var videoPositions = {
|
|
29
|
-
center: { x: 960, y: 540 },
|
|
30
|
-
topLeft: { x: 120, y: 80 },
|
|
31
|
-
topRight: { x: 1800, y: 80 },
|
|
32
|
-
bottomLeft: { x: 120, y: 1000 },
|
|
33
|
-
bottomRight: { x: 1800, y: 1000 },
|
|
34
|
-
bottomCenter: { x: 960, y: 960 }
|
|
35
|
-
};
|
|
36
|
-
function getAllFormatVariants() {
|
|
37
|
-
return [
|
|
38
|
-
VIDEO_FORMATS.landscape,
|
|
39
|
-
VIDEO_FORMATS.square,
|
|
40
|
-
VIDEO_FORMATS.portrait
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/renderers/config.ts
|
|
45
|
-
var defaultRenderConfig = {
|
|
46
|
-
codec: "h264",
|
|
47
|
-
outputFormat: "mp4",
|
|
48
|
-
crf: 18,
|
|
49
|
-
pixelFormat: "yuv420p"
|
|
50
|
-
};
|
|
51
|
-
var codecFormatMap = {
|
|
52
|
-
h264: "mp4",
|
|
53
|
-
h265: "mp4",
|
|
54
|
-
vp8: "webm",
|
|
55
|
-
vp9: "webm"
|
|
56
|
-
};
|
|
57
|
-
var qualityPresets = {
|
|
58
|
-
draft: { crf: 28, concurrency: 1 },
|
|
59
|
-
standard: { crf: 18, concurrency: undefined },
|
|
60
|
-
high: { crf: 12, concurrency: undefined }
|
|
61
|
-
};
|
|
62
|
-
function resolveRenderConfig(userConfig, preset) {
|
|
63
|
-
const presetValues = preset ? qualityPresets[preset] : {};
|
|
64
|
-
return {
|
|
65
|
-
...defaultRenderConfig,
|
|
66
|
-
...presetValues,
|
|
67
|
-
...userConfig
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// src/renderers/local.ts
|
|
72
|
-
class LocalRenderer {
|
|
73
|
-
entryPoint;
|
|
74
|
-
constructor(options) {
|
|
75
|
-
this.entryPoint = options.entryPoint;
|
|
76
|
-
}
|
|
77
|
-
async render(project, config) {
|
|
78
|
-
const resolved = resolveRenderConfig(config);
|
|
79
|
-
const { bundle } = await import("@remotion/bundler");
|
|
80
|
-
const { renderMedia, selectComposition } = await import("@remotion/renderer");
|
|
81
|
-
const bundleLocation = await bundle({
|
|
82
|
-
entryPoint: this.entryPoint
|
|
83
|
-
});
|
|
84
|
-
const firstScene = project.scenes[0];
|
|
85
|
-
const mainCompositionId = project.scenes.length === 1 && firstScene ? firstScene.compositionId : "Master";
|
|
86
|
-
const composition = await selectComposition({
|
|
87
|
-
serveUrl: bundleLocation,
|
|
88
|
-
id: mainCompositionId,
|
|
89
|
-
inputProps: {
|
|
90
|
-
project
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
await renderMedia({
|
|
94
|
-
composition,
|
|
95
|
-
serveUrl: bundleLocation,
|
|
96
|
-
codec: resolved.codec,
|
|
97
|
-
outputLocation: resolved.outputPath,
|
|
98
|
-
inputProps: { project },
|
|
99
|
-
...resolved.crf && { crf: resolved.crf },
|
|
100
|
-
...resolved.concurrency && {
|
|
101
|
-
concurrency: resolved.concurrency
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
const result = {
|
|
105
|
-
outputPath: resolved.outputPath,
|
|
106
|
-
format: resolved.outputFormat ?? defaultRenderConfig.outputFormat,
|
|
107
|
-
codec: resolved.codec ?? defaultRenderConfig.codec,
|
|
108
|
-
durationSeconds: project.totalDurationInFrames / project.fps,
|
|
109
|
-
fileSizeBytes: 0,
|
|
110
|
-
dimensions: {
|
|
111
|
-
width: project.format.width,
|
|
112
|
-
height: project.format.height
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
if (config.autoVariants) {
|
|
116
|
-
const variants = getAllFormatVariants().filter((f) => f.type !== project.format.type);
|
|
117
|
-
const variantResults = [];
|
|
118
|
-
for (const variantFormat of variants) {
|
|
119
|
-
const variantPath = resolved.outputPath.replace(/(\.[^.]+)$/, `-${variantFormat.type}$1`);
|
|
120
|
-
const variantProject = {
|
|
121
|
-
...project,
|
|
122
|
-
format: variantFormat
|
|
123
|
-
};
|
|
124
|
-
const variantComposition = await selectComposition({
|
|
125
|
-
serveUrl: bundleLocation,
|
|
126
|
-
id: mainCompositionId,
|
|
127
|
-
inputProps: { project: variantProject }
|
|
128
|
-
});
|
|
129
|
-
await renderMedia({
|
|
130
|
-
composition: variantComposition,
|
|
131
|
-
serveUrl: bundleLocation,
|
|
132
|
-
codec: resolved.codec,
|
|
133
|
-
outputLocation: variantPath,
|
|
134
|
-
inputProps: { project: variantProject },
|
|
135
|
-
...resolved.crf && { crf: resolved.crf }
|
|
136
|
-
});
|
|
137
|
-
variantResults.push({
|
|
138
|
-
outputPath: variantPath,
|
|
139
|
-
format: resolved.outputFormat ?? defaultRenderConfig.outputFormat,
|
|
140
|
-
codec: resolved.codec ?? defaultRenderConfig.codec,
|
|
141
|
-
durationSeconds: project.totalDurationInFrames / project.fps,
|
|
142
|
-
fileSizeBytes: 0,
|
|
143
|
-
dimensions: {
|
|
144
|
-
width: variantFormat.width,
|
|
145
|
-
height: variantFormat.height
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
result.variants = variantResults;
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
resolveRenderConfig,
|
|
156
|
-
qualityPresets,
|
|
157
|
-
defaultRenderConfig,
|
|
158
|
-
codecFormatMap,
|
|
159
|
-
LocalRenderer
|
|
160
|
-
};
|
|
1
|
+
var Y=((x)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(x,{get:(Q,y)=>(typeof require<"u"?require:Q)[y]}):x)(function(x){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+x+'" is not supported')});import{VIDEO_FORMATS as H}from"@contractspec/lib.contracts-integrations/integrations/providers/video";var M=30,G={horizontal:120,vertical:80,contentWidth:1680,contentHeight:920};function V(x){let Q=x.width/1920,y=x.height/1080;return{horizontal:Math.round(G.horizontal*Q),vertical:Math.round(G.vertical*y),contentWidth:Math.round(G.contentWidth*Q),contentHeight:Math.round(G.contentHeight*y)}}var b={center:{x:960,y:540},topLeft:{x:120,y:80},topRight:{x:1800,y:80},bottomLeft:{x:120,y:1000},bottomRight:{x:1800,y:1000},bottomCenter:{x:960,y:960}};function h(){return[H.landscape,H.square,H.portrait]}var k={codec:"h264",outputFormat:"mp4",crf:18,pixelFormat:"yuv420p"},_={h264:"mp4",h265:"mp4",vp8:"webm",vp9:"webm"},L={draft:{crf:28,concurrency:1},standard:{crf:18,concurrency:void 0},high:{crf:12,concurrency:void 0}};function J(x,Q){let y=Q?L[Q]:{};return{...k,...y,...x}}class P{entryPoint;constructor(x){this.entryPoint=x.entryPoint}async render(x,Q){let y=J(Q),{bundle:D}=await import("@remotion/bundler"),{renderMedia:K,selectComposition:N}=await import("@remotion/renderer"),B=await D({entryPoint:this.entryPoint}),U=x.scenes[0],W=x.scenes.length===1&&U?U.compositionId:"Master",E=await N({serveUrl:B,id:W,inputProps:{project:x}});await K({composition:E,serveUrl:B,codec:y.codec,outputLocation:y.outputPath,inputProps:{project:x},...y.crf&&{crf:y.crf},...y.concurrency&&{concurrency:y.concurrency}});let $={outputPath:y.outputPath,format:y.outputFormat??k.outputFormat,codec:y.codec??k.codec,durationSeconds:x.totalDurationInFrames/x.fps,fileSizeBytes:0,dimensions:{width:x.format.width,height:x.format.height}};if(Q.autoVariants){let T=h().filter((z)=>z.type!==x.format.type),q=[];for(let z of T){let w=y.outputPath.replace(/(\.[^.]+)$/,`-${z.type}$1`),X={...x,format:z},Z=await N({serveUrl:B,id:W,inputProps:{project:X}});await K({composition:Z,serveUrl:B,codec:y.codec,outputLocation:w,inputProps:{project:X},...y.crf&&{crf:y.crf}}),q.push({outputPath:w,format:y.outputFormat??k.outputFormat,codec:y.codec??k.codec,durationSeconds:x.totalDurationInFrames/x.fps,fileSizeBytes:0,dimensions:{width:z.width,height:z.height}})}$.variants=q}return $}}export{J as resolveRenderConfig,L as qualityPresets,k as defaultRenderConfig,_ as codecFormatMap,P as LocalRenderer};
|
|
@@ -1,156 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/design/layouts.ts
|
|
10
|
-
import { VIDEO_FORMATS } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
|
|
11
|
-
var DEFAULT_FPS = 30;
|
|
12
|
-
var videoSafeZone = {
|
|
13
|
-
horizontal: 120,
|
|
14
|
-
vertical: 80,
|
|
15
|
-
contentWidth: 1680,
|
|
16
|
-
contentHeight: 920
|
|
17
|
-
};
|
|
18
|
-
function scaleSafeZone(format) {
|
|
19
|
-
const scaleX = format.width / 1920;
|
|
20
|
-
const scaleY = format.height / 1080;
|
|
21
|
-
return {
|
|
22
|
-
horizontal: Math.round(videoSafeZone.horizontal * scaleX),
|
|
23
|
-
vertical: Math.round(videoSafeZone.vertical * scaleY),
|
|
24
|
-
contentWidth: Math.round(videoSafeZone.contentWidth * scaleX),
|
|
25
|
-
contentHeight: Math.round(videoSafeZone.contentHeight * scaleY)
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var videoPositions = {
|
|
29
|
-
center: { x: 960, y: 540 },
|
|
30
|
-
topLeft: { x: 120, y: 80 },
|
|
31
|
-
topRight: { x: 1800, y: 80 },
|
|
32
|
-
bottomLeft: { x: 120, y: 1000 },
|
|
33
|
-
bottomRight: { x: 1800, y: 1000 },
|
|
34
|
-
bottomCenter: { x: 960, y: 960 }
|
|
35
|
-
};
|
|
36
|
-
function getAllFormatVariants() {
|
|
37
|
-
return [
|
|
38
|
-
VIDEO_FORMATS.landscape,
|
|
39
|
-
VIDEO_FORMATS.square,
|
|
40
|
-
VIDEO_FORMATS.portrait
|
|
41
|
-
];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/renderers/config.ts
|
|
45
|
-
var defaultRenderConfig = {
|
|
46
|
-
codec: "h264",
|
|
47
|
-
outputFormat: "mp4",
|
|
48
|
-
crf: 18,
|
|
49
|
-
pixelFormat: "yuv420p"
|
|
50
|
-
};
|
|
51
|
-
var codecFormatMap = {
|
|
52
|
-
h264: "mp4",
|
|
53
|
-
h265: "mp4",
|
|
54
|
-
vp8: "webm",
|
|
55
|
-
vp9: "webm"
|
|
56
|
-
};
|
|
57
|
-
var qualityPresets = {
|
|
58
|
-
draft: { crf: 28, concurrency: 1 },
|
|
59
|
-
standard: { crf: 18, concurrency: undefined },
|
|
60
|
-
high: { crf: 12, concurrency: undefined }
|
|
61
|
-
};
|
|
62
|
-
function resolveRenderConfig(userConfig, preset) {
|
|
63
|
-
const presetValues = preset ? qualityPresets[preset] : {};
|
|
64
|
-
return {
|
|
65
|
-
...defaultRenderConfig,
|
|
66
|
-
...presetValues,
|
|
67
|
-
...userConfig
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// src/renderers/local.ts
|
|
72
|
-
class LocalRenderer {
|
|
73
|
-
entryPoint;
|
|
74
|
-
constructor(options) {
|
|
75
|
-
this.entryPoint = options.entryPoint;
|
|
76
|
-
}
|
|
77
|
-
async render(project, config) {
|
|
78
|
-
const resolved = resolveRenderConfig(config);
|
|
79
|
-
const { bundle } = await import("@remotion/bundler");
|
|
80
|
-
const { renderMedia, selectComposition } = await import("@remotion/renderer");
|
|
81
|
-
const bundleLocation = await bundle({
|
|
82
|
-
entryPoint: this.entryPoint
|
|
83
|
-
});
|
|
84
|
-
const firstScene = project.scenes[0];
|
|
85
|
-
const mainCompositionId = project.scenes.length === 1 && firstScene ? firstScene.compositionId : "Master";
|
|
86
|
-
const composition = await selectComposition({
|
|
87
|
-
serveUrl: bundleLocation,
|
|
88
|
-
id: mainCompositionId,
|
|
89
|
-
inputProps: {
|
|
90
|
-
project
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
await renderMedia({
|
|
94
|
-
composition,
|
|
95
|
-
serveUrl: bundleLocation,
|
|
96
|
-
codec: resolved.codec,
|
|
97
|
-
outputLocation: resolved.outputPath,
|
|
98
|
-
inputProps: { project },
|
|
99
|
-
...resolved.crf && { crf: resolved.crf },
|
|
100
|
-
...resolved.concurrency && {
|
|
101
|
-
concurrency: resolved.concurrency
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
const result = {
|
|
105
|
-
outputPath: resolved.outputPath,
|
|
106
|
-
format: resolved.outputFormat ?? defaultRenderConfig.outputFormat,
|
|
107
|
-
codec: resolved.codec ?? defaultRenderConfig.codec,
|
|
108
|
-
durationSeconds: project.totalDurationInFrames / project.fps,
|
|
109
|
-
fileSizeBytes: 0,
|
|
110
|
-
dimensions: {
|
|
111
|
-
width: project.format.width,
|
|
112
|
-
height: project.format.height
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
if (config.autoVariants) {
|
|
116
|
-
const variants = getAllFormatVariants().filter((f) => f.type !== project.format.type);
|
|
117
|
-
const variantResults = [];
|
|
118
|
-
for (const variantFormat of variants) {
|
|
119
|
-
const variantPath = resolved.outputPath.replace(/(\.[^.]+)$/, `-${variantFormat.type}$1`);
|
|
120
|
-
const variantProject = {
|
|
121
|
-
...project,
|
|
122
|
-
format: variantFormat
|
|
123
|
-
};
|
|
124
|
-
const variantComposition = await selectComposition({
|
|
125
|
-
serveUrl: bundleLocation,
|
|
126
|
-
id: mainCompositionId,
|
|
127
|
-
inputProps: { project: variantProject }
|
|
128
|
-
});
|
|
129
|
-
await renderMedia({
|
|
130
|
-
composition: variantComposition,
|
|
131
|
-
serveUrl: bundleLocation,
|
|
132
|
-
codec: resolved.codec,
|
|
133
|
-
outputLocation: variantPath,
|
|
134
|
-
inputProps: { project: variantProject },
|
|
135
|
-
...resolved.crf && { crf: resolved.crf }
|
|
136
|
-
});
|
|
137
|
-
variantResults.push({
|
|
138
|
-
outputPath: variantPath,
|
|
139
|
-
format: resolved.outputFormat ?? defaultRenderConfig.outputFormat,
|
|
140
|
-
codec: resolved.codec ?? defaultRenderConfig.codec,
|
|
141
|
-
durationSeconds: project.totalDurationInFrames / project.fps,
|
|
142
|
-
fileSizeBytes: 0,
|
|
143
|
-
dimensions: {
|
|
144
|
-
width: variantFormat.width,
|
|
145
|
-
height: variantFormat.height
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
result.variants = variantResults;
|
|
150
|
-
}
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
LocalRenderer
|
|
156
|
-
};
|
|
1
|
+
var X=((k)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(k,{get:(z,x)=>(typeof require<"u"?require:z)[x]}):k)(function(k){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+k+'" is not supported')});import{VIDEO_FORMATS as K}from"@contractspec/lib.contracts-integrations/integrations/providers/video";var I=30,J={horizontal:120,vertical:80,contentWidth:1680,contentHeight:920};function V(k){let z=k.width/1920,x=k.height/1080;return{horizontal:Math.round(J.horizontal*z),vertical:Math.round(J.vertical*x),contentWidth:Math.round(J.contentWidth*z),contentHeight:Math.round(J.contentHeight*x)}}var b={center:{x:960,y:540},topLeft:{x:120,y:80},topRight:{x:1800,y:80},bottomLeft:{x:120,y:1000},bottomRight:{x:1800,y:1000},bottomCenter:{x:960,y:960}};function Y(){return[K.landscape,K.square,K.portrait]}var G={codec:"h264",outputFormat:"mp4",crf:18,pixelFormat:"yuv420p"},O={h264:"mp4",h265:"mp4",vp8:"webm",vp9:"webm"},Z={draft:{crf:28,concurrency:1},standard:{crf:18,concurrency:void 0},high:{crf:12,concurrency:void 0}};function h(k,z){let x=z?Z[z]:{};return{...G,...x,...k}}class _{entryPoint;constructor(k){this.entryPoint=k.entryPoint}async render(k,z){let x=h(z),{bundle:D}=await import("@remotion/bundler"),{renderMedia:N,selectComposition:Q}=await import("@remotion/renderer"),H=await D({entryPoint:this.entryPoint}),U=k.scenes[0],W=k.scenes.length===1&&U?U.compositionId:"Master",E=await Q({serveUrl:H,id:W,inputProps:{project:k}});await N({composition:E,serveUrl:H,codec:x.codec,outputLocation:x.outputPath,inputProps:{project:k},...x.crf&&{crf:x.crf},...x.concurrency&&{concurrency:x.concurrency}});let $={outputPath:x.outputPath,format:x.outputFormat??G.outputFormat,codec:x.codec??G.codec,durationSeconds:k.totalDurationInFrames/k.fps,fileSizeBytes:0,dimensions:{width:k.format.width,height:k.format.height}};if(z.autoVariants){let L=Y().filter((B)=>B.type!==k.format.type),w=[];for(let B of L){let q=x.outputPath.replace(/(\.[^.]+)$/,`-${B.type}$1`),y={...k,format:B},T=await Q({serveUrl:H,id:W,inputProps:{project:y}});await N({composition:T,serveUrl:H,codec:x.codec,outputLocation:q,inputProps:{project:y},...x.crf&&{crf:x.crf}}),w.push({outputPath:q,format:x.outputFormat??G.outputFormat,codec:x.codec??G.codec,durationSeconds:k.totalDurationInFrames/k.fps,fileSizeBytes:0,dimensions:{width:B.width,height:B.height}})}$.variants=w}return $}}export{_ as LocalRenderer};
|
package/dist/browser/types.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
var
|
|
2
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
-
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
6
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/types.ts
|
|
10
|
-
import { VIDEO_FORMATS } from "@contractspec/lib.contracts-integrations/integrations/providers/video";
|
|
11
|
-
export {
|
|
12
|
-
VIDEO_FORMATS
|
|
13
|
-
};
|
|
1
|
+
var k=((f)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(f,{get:(h,j)=>(typeof require<"u"?require:h)[j]}):f)(function(f){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+f+'" is not supported')});import{VIDEO_FORMATS as w}from"@contractspec/lib.contracts-integrations/integrations/providers/video";export{w as VIDEO_FORMATS};
|