Error When running npx render
Bug Report 🐛
I cannot export my video because I get an error when running npx render. The composition works flawlessly on the browser (nextjs), but I get this error in the cli as well as in Remotion Studio.
➜ my-video-next git:(main) ✗ npx remotion render --props=./public/transcription\ \(18\).json
(1/3) ╭───────────────────╮ Bundled code 1477ms
+ ╭───────────────────╮ Copying public dir 935ms
✔ Select composition: › MyComp
Composition = MyComp (Selected), Codec = h264 (default), Output = out/MyComp.mp4
(2/3) ╭─────╴ Rendering frames (7x) 1466/5031
+ ╭───────────────────╮ Downloading http://localhost:3000/public/02-merged.mp4
(3/3) ╭──── Encoding video 1102/5031
Error: Page crashed!
at Page._Page_onTargetCrashed (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/BrowserPage.js:271:24)
at /Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/BrowserPage.js:109:94
at /Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/mitt/index.js:39:17
at Array.forEach (<anonymous>)
at Object.emit (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/mitt/index.js:38:18)
at CDPSession.emit (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/EventEmitter.js:26:22)
at CDPSession._onMessage (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/Connection.js:230:18)
at Connection._Connection_onMessage (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/Connection.js:131:21)
at WebSocket.<anonymous> (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/@remotion/renderer/dist/browser/NodeWebSocketTransport.js:55:32)
at WebSocket.onMessage (/Users/youssefbenlemlih/p/workspace/my-video-next/node_modules/ws/lib/event-target.js:199:18)
➜ my-video-next git:(main) ✗
Project
I have a project where a long video is cutted to smaller bits.
This is my code
import { z } from "zod";
import {
AbsoluteFill,
Sequence,
useCurrentFrame,
useVideoConfig,
Video,
} from "remotion";
import { CompositionProps, INPUT_VIDEO } from "../../types/constants";
import React, { Fragment } from "react";
import { getSequenceStart, msToFrame } from "../../helpers/calculations";
export const Main = ({ transcription }: z.infer<typeof CompositionProps>) => {
const { fps } = useVideoConfig();
return (
<>
<AbsoluteFill style={{ background: "grey" }}>
{transcription.map((t, index) => {
const start = msToFrame(t.offsets.from, fps);
const end = msToFrame(t.offsets.to, fps);
const sequenceStart = getSequenceStart(transcription, index, fps);
const durationInFrames = end - start;
if (durationInFrames <= 0) return <Fragment key={index} />;
return (
<Sequence
key={index}
from={sequenceStart }
durationInFrames={durationInFrames}
>
<Video
src={INPUT_VIDEO}
startFrom={start}
endAt={end}
/>
</Sequence>
);
})}
</AbsoluteFill>
</>
);
};
I cannot reproduce the bug with a smaller video input, so I assume it some kind of memory leak related to puppeteer.
Any support will be very appreciated :) !
It just means that the browser runs out of resources and Chrome crashes a tab, like it sometimes also happens while browsing.
If you experience this, you can reduce the amount of simultaneous tabs that get opened during a render (this is what 7x stands for) using the --concurrency flag.