🎥 Make videos programmatically with React
apply filter only it have assets
yuta08012802542052c5
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.tsindex 4cd98c6a38..2da8c16316 100644--- a/packages/renderer/src/stitcher.ts+++ b/packages/renderer/src/stitcher.ts@@ -75,33 +75,37 @@ export const stitchFramesToVideo = async (options: {pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,['-b:v', '1M'],['-c:a', 'aac'],- [- '-filter_complex',- [- ...options.assets.map((asset, i) => {- const duration = (asset.duration / options.fps).toFixed(3); // in secounds with millisecounds level precision- const assetTrimLeft = (asset.sequenceFrame / options.fps).toFixed(3);- const assetTrimRight = (- (asset.sequenceFrame + asset.duration) /- options.fps- ).toFixed(3);- const startInVideo = (- (asset.startInVideo / options.fps) *- 1000- ).toFixed(); // in milliseconds+ !options.assets.length+ ? null+ : [+ '-filter_complex',+ [+ ...options.assets.map((asset, i) => {+ const duration = (asset.duration / options.fps).toFixed(3); // in secounds with millisecounds level precision+ const assetTrimLeft = (asset.sequenceFrame / options.fps).toFixed(+ 3+ );+ const assetTrimRight = (+ (asset.sequenceFrame + asset.duration) /+ options.fps+ ).toFixed(3);+ const startInVideo = (+ (asset.startInVideo / options.fps) *+ 1000+ ).toFixed(); // in milliseconds- return [- `[${i + 1}:a]`,- duration ? `atrim=${assetTrimLeft}:${assetTrimRight},` : '',- `adelay=${startInVideo}`,- `[a${i + 1}]`,- ].join('');- }),- `${options.assets.map((asset, i) => `[a${i + 1}]`).join('')}amix=${- options.assets.length- },dynaudnorm`,- ].join(';'),- ],+ return [+ `[${i + 1}:a]`,+ duration ? `atrim=${assetTrimLeft}:${assetTrimRight},` : '',+ `adelay=${startInVideo}`,+ `[a${i + 1}]`,+ ].join('');+ }),+ `${options.assets.map((asset, i) => `[a${i + 1}]`).join('')}amix=${+ options.assets.length+ },dynaudnorm`,+ ].join(';'),+ ],options.force ? '-y' : null,options.outputLocation,]