Spaces:
Running
Running
Commit ·
7ec5753
1
Parent(s): 29cee9f
Update render script'
Browse files- package.json +1 -1
- renderer.js +7 -9
package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
"preinstall": "cd common-utils && npm run build",
|
| 15 |
"build:utils": "cd common-utils && npm run build && cd .. && npm install ./common-utils",
|
| 16 |
"render-build:igreels": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 1 --gl=angle --browser-executable /usr/bin/chromium-browser IGReelComposition",
|
| 17 |
-
"render-build": "remotion
|
| 18 |
"render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
|
| 19 |
"render-image": "remotion still --image-format=jpeg --concurrency 1 $npm_config_composition $npm_config_output",
|
| 20 |
"render-images": "remotion render --enable-multiprocess-on-linux --sequence --image-format=jpeg $npm_config_composition $npm_config_output",
|
|
|
|
| 14 |
"preinstall": "cd common-utils && npm run build",
|
| 15 |
"build:utils": "cd common-utils && npm run build && cd .. && npm install ./common-utils",
|
| 16 |
"render-build:igreels": "remotion render --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 1 --gl=angle --browser-executable /usr/bin/chromium-browser IGReelComposition",
|
| 17 |
+
"render-build": "remotion $npm_config_target --audio-codec mp3 --image-format=jpeg --enable-multi-process-on-linux --quality=70 --concurrency 1 --gl=angle --browser-executable /usr/bin/chromium-browser $npm_config_composition",
|
| 18 |
"render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
|
| 19 |
"render-image": "remotion still --image-format=jpeg --concurrency 1 $npm_config_composition $npm_config_output",
|
| 20 |
"render-images": "remotion render --enable-multiprocess-on-linux --sequence --image-format=jpeg $npm_config_composition $npm_config_output",
|
renderer.js
CHANGED
|
@@ -37,18 +37,16 @@ export async function generateOutputBundle(jobId) {
|
|
| 37 |
|
| 38 |
export function getNpmScript(mediaType) {
|
| 39 |
if (mediaType === 'image') {
|
| 40 |
-
return '
|
| 41 |
-
} else if (mediaType === 'video') {
|
| 42 |
-
return 'render-build';
|
| 43 |
} else {
|
| 44 |
-
return 'render
|
| 45 |
}
|
| 46 |
}
|
| 47 |
|
| 48 |
-
export function doRender(jobId, composition, sendToObserver,
|
| 49 |
const renderComposition = composition || 'SemibitComposition';
|
| 50 |
let outFile = `out/${jobId}-video.mp4`;
|
| 51 |
-
let cmd = `npm run ${
|
| 52 |
const childProcess = exec(cmd);
|
| 53 |
|
| 54 |
console.log('Starting video render. ' + cmd);
|
|
@@ -72,12 +70,12 @@ export function doRender(jobId, composition, sendToObserver, npmScript = 'render
|
|
| 72 |
sendToObserver(jobId, code === 0 ? 'completed' : 'failed');
|
| 73 |
if (code === 0) {
|
| 74 |
resolve(outFile);
|
| 75 |
-
console.log(`'${
|
| 76 |
} else {
|
| 77 |
reject({
|
| 78 |
-
message: `'${
|
| 79 |
});
|
| 80 |
-
console.error(`'${
|
| 81 |
}
|
| 82 |
});
|
| 83 |
});
|
|
|
|
| 37 |
|
| 38 |
export function getNpmScript(mediaType) {
|
| 39 |
if (mediaType === 'image') {
|
| 40 |
+
return 'still';
|
|
|
|
|
|
|
| 41 |
} else {
|
| 42 |
+
return 'render';
|
| 43 |
}
|
| 44 |
}
|
| 45 |
|
| 46 |
+
export function doRender(jobId, composition, sendToObserver, target = 'render') {
|
| 47 |
const renderComposition = composition || 'SemibitComposition';
|
| 48 |
let outFile = `out/${jobId}-video.mp4`;
|
| 49 |
+
let cmd = `npm run render-build --target=${target} --composition=${renderComposition}`;
|
| 50 |
const childProcess = exec(cmd);
|
| 51 |
|
| 52 |
console.log('Starting video render. ' + cmd);
|
|
|
|
| 70 |
sendToObserver(jobId, code === 0 ? 'completed' : 'failed');
|
| 71 |
if (code === 0) {
|
| 72 |
resolve(outFile);
|
| 73 |
+
console.log(`'${target}' completed successfully.`);
|
| 74 |
} else {
|
| 75 |
reject({
|
| 76 |
+
message: `'${target}' failed with code ${code}.`,
|
| 77 |
});
|
| 78 |
+
console.error(`'${target}' failed with code ${code}.`);
|
| 79 |
}
|
| 80 |
});
|
| 81 |
});
|