Skip to content

🎥 Make videos programmatically with React

fix not having to pass imageformat to stitcher

Jonny Burger49f7341a0721
diff --git a/packages/core/src/CompositionManager.tsx b/packages/core/src/CompositionManager.tsx
index 55d912b7ba..dbab06684c 100644
--- a/packages/core/src/CompositionManager.tsx
+++ b/packages/core/src/CompositionManager.tsx
@@ -65,13 +65,13 @@ export type TAsset = {
id: string;
frame: number;
volume: number;
- isRemote: boolean;
mediaFrame: number;
playbackRate: number;
};
export type RenderAssetInfo = {
assets: TAsset[][];
+ imageSequenceName: string;
};
export type CompositionManagerContext = {
diff --git a/packages/renderer/src/render.ts b/packages/renderer/src/render.ts
index 2cea0952bb..7c6e188f71 100644
--- a/packages/renderer/src/render.ts
+++ b/packages/renderer/src/render.ts
@@ -224,12 +224,14 @@ export const innerRenderFrames = async ({
})
);
- return {
+ const returnValue: RenderFramesOutput = {
assetsInfo: {
assets,
+ imageSequenceName: `element-%0${filePadLength}d.${imageFormat}`,
},
frameCount,
};
+ return returnValue;
};
export const renderFrames = async (
diff --git a/packages/renderer/src/stitcher.ts b/packages/renderer/src/stitcher.ts
index 4d30f26fd4..2d2adcf8c9 100644
--- a/packages/renderer/src/stitcher.ts
+++ b/packages/renderer/src/stitcher.ts
@@ -45,7 +45,6 @@ export type StitcherOptions = {
pixelFormat?: PixelFormat;
codec?: Codec;
crf?: number;
- // TODO: Do we want a parallelism flag for stitcher?
parallelism?: number | null;
onProgress?: (progress: number) => void;
onDownload?: (src: string) => void;
@@ -84,7 +83,6 @@ const getAssetsData = async (options: StitcherOptions) => {
const assetAudioDetails = await getAssetAudioDetails({
assetPaths,
- parallelism: options.parallelism,
});
const filters = calculateFfmpegFilters({
@@ -130,7 +128,6 @@ export const spawnFfmpeg = async (options: StitcherOptions) => {
codec,
});
const crf = options.crf ?? Internals.getDefaultCrfForCodec(codec);
- const imageFormat = options.imageFormat ?? DEFAULT_IMAGE_FORMAT;
const pixelFormat = options.pixelFormat ?? Internals.DEFAULT_PIXEL_FORMAT;
await validateFfmpeg(options.ffmpegExecutable ?? null);
@@ -149,7 +146,6 @@ export const spawnFfmpeg = async (options: StitcherOptions) => {
console.log('[verbose] encoder', encoderName);
console.log('[verbose] audioCodec', audioCodecName);
console.log('[verbose] pixelFormat', pixelFormat);
- console.log('[verbose] imageFormat', imageFormat);
if (supportsCrf) {
console.log('[verbose] crf', crf);
}
@@ -160,10 +156,6 @@ export const spawnFfmpeg = async (options: StitcherOptions) => {
}
Internals.validateSelectedCrfAndCodecCombination(crf, codec);
- Internals.validateSelectedPixelFormatAndImageFormatCombination(
- pixelFormat,
- imageFormat
- );
Internals.validateSelectedPixelFormatAndCodecCombination(pixelFormat, codec);
const {
@@ -183,9 +175,7 @@ export const spawnFfmpeg = async (options: StitcherOptions) => {
: ['-f', options.parallelEncoding ? 'image2pipe' : 'image2'],
isAudioOnly ? null : ['-s', `${options.width}x${options.height}`],
frameInfo ? ['-start_number', String(frameInfo.startNumber)] : null,
- frameInfo
- ? ['-i', `element-%0${frameInfo.numberLength}d.${imageFormat}`]
- : null,
+ frameInfo ? ['-i', options.assetsInfo.imageSequenceName] : null,
options.parallelEncoding ? ['-i', '-'] : null,
]),
...(assetPaths