Skip to content

πŸŽ₯ Make videos programmatically with React

start working on seamless concatenation again

Jonny Burger2712296ec81c
diff --git a/packages/example/src/Framer/index.tsx b/packages/example/src/Framer/index.tsx
index 34046852e7..521f747e2d 100644
--- a/packages/example/src/Framer/index.tsx
+++ b/packages/example/src/Framer/index.tsx
@@ -24,7 +24,7 @@ export const Framer: React.FC = () => {
}}
>
<h1 style={{fontSize: 120}}>{frame} 😁</h1>
- <Audio src={staticFile('sine.wav')} />
+ <Audio src={staticFile('chirp.wav')} />
</div>
);
};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index aca9958510..7a41716702 100644
--- a/packages/example/src/Root.tsx
+++ b/packages/example/src/Root.tsx
@@ -354,7 +354,7 @@ export const Index: React.FC = () => {
width={1080}
height={1080}
fps={30}
- durationInFrames={100}
+ durationInFrames={500}
/>
<Composition
id="skip-zero-frame"
diff --git a/packages/lambda/src/functions/helpers/can-concat-seamlessly.ts b/packages/lambda/src/functions/helpers/can-concat-seamlessly.ts
index c9da1db357..2cfbed9c6e 100644
--- a/packages/lambda/src/functions/helpers/can-concat-seamlessly.ts
+++ b/packages/lambda/src/functions/helpers/can-concat-seamlessly.ts
@@ -3,8 +3,8 @@ import type {AudioCodec} from '@remotion/renderer';
// Temporarily disable seamless audio concat
// Cannot do WAV yet, because currently assumes AAC in+outpoint
// eslint-disable-next-line @typescript-eslint/no-unused-vars
-export const canConcatAudioSeamlessly = (_audioCodec: AudioCodec | null) => {
- return false;
+export const canConcatAudioSeamlessly = (audioCodec: AudioCodec | null) => {
+ return audioCodec === 'aac';
};
export const canConcatVideoSeamlessly = (codec: string) => {
diff --git a/packages/lambda/src/functions/helpers/concat-videos.ts b/packages/lambda/src/functions/helpers/concat-videos.ts
index 231f4c7ae1..bab3559a9a 100644
--- a/packages/lambda/src/functions/helpers/concat-videos.ts
+++ b/packages/lambda/src/functions/helpers/concat-videos.ts
@@ -218,7 +218,7 @@ export const concatVideosS3 = async ({
RenderInternals.tmpDir(REMOTION_CONCATED_TOKEN),
`concat.${RenderInternals.getFileExtensionFromCodec(codec, audioCodec)}`,
);
- const combine = timer('Combine videos', logLevel);
+ const combine = timer('Combine chunks', logLevel);
const filelistDir = RenderInternals.tmpDir(REMOTION_FILELIST_TOKEN);
const chunkDurationInSeconds = framesPerLambda / fps;
diff --git a/packages/lambda/src/functions/renderer.ts b/packages/lambda/src/functions/renderer.ts
index 70dfb5ed33..5e7fa58657 100644
--- a/packages/lambda/src/functions/renderer.ts
+++ b/packages/lambda/src/functions/renderer.ts
@@ -142,9 +142,11 @@ const renderHandler = async (
: null;
const videoOutputLocation = path.join(outdir, `${chunk}.${videoExtension}`);
- const audioOutputLocation = audioExtension
- ? path.join(outdir, `${chunk}.${audioExtension}`)
- : null;
+ const audioOutputLocation = RenderInternals.isAudioCodec(params.codec)
+ ? null
+ : audioExtension
+ ? path.join(outdir, `${chunk}.${audioExtension}`)
+ : null;
const resolvedProps = await resolvedPropsPromise;
const serializedInputPropsWithCustomSchema = await inputPropsPromise;
@@ -282,7 +284,7 @@ const renderHandler = async (
key: chunkKeyForIndex({
renderId: params.renderId,
index: params.chunk,
- type: 'video',
+ type: RenderInternals.isAudioCodec(params.codec) ? 'audio' : 'video',
}),
body: fs.createReadStream(videoOutputLocation),
region: getCurrentRegionInFunction(),
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index 134cd02f0b..5253b5d41e 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -138,6 +138,7 @@ export const combineVideos = async ({
].filter(truthy),
);
+ // Either only audio or only video
if (!(audioOutput && shouldCreateVideo)) {
rmSync(filelistDir, {recursive: true});
return;