🎥 Make videos programmatically with React
Merge branch 'lambda-testing' into rendervideo
Jonny Burgera32f01ca2032
diff --cc packages/lambda/src/functions/renderer.tsindex d494e48581,9b6e20eced..09e04a5d7f--- a/packages/lambda/src/functions/renderer.ts+++ b/packages/lambda/src/functions/renderer.ts@@@ -123,23 -122,64 +123,28 @@@ const renderHandler = asynconBrowserLog: (log) => {logs.push(log);},- });- const outdir = tmpDir(RENDERER_PATH_TOKEN);-- const outputLocation = path.join(- outdir,- `localchunk-${String(params.chunk).padStart(- 8,- '0'- )}.${getFileExtensionFromCodec(params.codec, 'chunk')}`- );-- const stitchLabel = timer('stitcher');- if (!fs.existsSync(DOWNLOADS_DIR)) {- fs.mkdirSync(DOWNLOADS_DIR);- }-- const endRendered = Date.now();-- await stitchFramesToVideo({- assetsInfo: {- ...assetsInfo,- // Make all assets remote- assets: assetsInfo.assets.map((asset) => {- return asset.map((a) => {- return {- ...a,- isRemote: true,- };- });- }),- },- downloadDir: DOWNLOADS_DIR,- dir: outputPath,- force: true,- fps: params.fps,- height: params.height,- width: params.width,- outputLocation,+ absoluteOutputFile: outputLocation,codec: params.codec,- imageFormat: params.imageFormat,- crf: params.crf,+ crf: params.crf ?? null,+ ffmpegExecutable: null,pixelFormat: params.pixelFormat,proResProfile: params.proResProfile,- parallelism: 1,- verbose: false,- onProgress: () => {- // TODO: upload progress from time to time+ onDownload: (src: string) => {+ console.log('Downloading', src);+ return () => undefined;},- webpackBundle: null,++ overwrite: false,});- stitchLabel.end();++ const endRendered = Date.now();+- await RenderInternals.addSilentAudioIfNecessary(outputLocation);+ console.info('Adding silent audio, chunk', params.chunk);+ await RenderInternals.addSilentAudioIfNecessary(+ outputLocation,+ params.frameRange[1] - params.frameRange[0] + 1,+ params.fps+ );- const endStitching = Date.now();const condensedTimingData: ChunkTimingData = {...chunkTimingData,diff --cc packages/renderer/src/stitcher.tsindex e0a33c4991,65afd58830..2cd2fb453a--- a/packages/renderer/src/stitcher.ts+++ b/packages/renderer/src/stitcher.ts@@@ -20,9 -20,12 +20,10 @@@ import {calculateFfmpegFilters} from '.import {createFfmpegComplexFilter} from './create-ffmpeg-complex-filter';import {getAudioCodecName} from './get-audio-codec-name';import {getCodecName} from './get-codec-name';-import {getFrameInfo} from './get-frame-number-length';import {getProResProfileName} from './get-prores-profile-name';-import {DEFAULT_IMAGE_FORMAT} from './image-format';import {parseFfmpegProgress} from './parse-ffmpeg-progress';import {resolveAssetSrc} from './resolve-asset-src';+ import {DEFAULT_SAMPLE_RATE} from './sample-rate';import {validateEvenDimensionsWithCodec} from './validate-even-dimensions-with-codec';import {validateFfmpeg} from './validate-ffmpeg';