Skip to content

🎥 Make videos programmatically with React

nice!

Jonny Burger7294822ba79e
diff --git a/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx b/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
index ec0fb62d09..e031141478 100644
--- a/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
+++ b/packages/example/src/OffthreadRemoteVideo/OffthreadRemoteVideo.tsx
@@ -1,10 +1,8 @@
-import {Loop, OffthreadVideo, staticFile} from 'remotion';
+import {OffthreadVideo, staticFile} from 'remotion';
export const OffthreadRemoteVideo: React.FC = () => {
return (
- <Loop durationInFrames={15 * 30}>
- <OffthreadVideo src={staticFile('vid1.mp4')} />
- </Loop>
+ <OffthreadVideo src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
);
};
diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsx
index aca9958510..46ea413861 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 * 30}
/>
<Composition
id="skip-zero-frame"
@@ -535,7 +535,7 @@ export const Index: React.FC = () => {
width={1920}
height={1080}
fps={30}
- durationInFrames={30 * 60}
+ durationInFrames={30 * 60 * 8}
/>
<Composition
id="video-testing-webm"
diff --git a/packages/lambda/src/cli/commands/render/progress.ts b/packages/lambda/src/cli/commands/render/progress.ts
index 00fe17cd3e..09cb1dffa9 100644
--- a/packages/lambda/src/cli/commands/render/progress.ts
+++ b/packages/lambda/src/cli/commands/render/progress.ts
@@ -20,7 +20,7 @@ type ChunkProgress = {
framesRendered: number;
totalFrames: number | null;
totalChunks: number | null;
- chunksInvoked: number;
+ chunksEncoded: number;
};
type MultiRenderProgress = {
@@ -55,13 +55,13 @@ const makeRenderProgress = ({
chunkProgress: ChunkProgress;
totalSteps: number;
}) => {
- const {chunksInvoked, totalChunks, doneIn} = chunkProgress;
+ const {chunksEncoded, totalChunks, doneIn} = chunkProgress;
const renderProgress =
chunkProgress.totalFrames === null
? 0
: chunkProgress.framesRendered / chunkProgress.totalFrames;
const encodingProgress =
- totalChunks === null ? 0 : chunksInvoked / totalChunks;
+ totalChunks === null ? 0 : chunksEncoded / totalChunks;
const frames =
chunkProgress.totalFrames === null
@@ -180,7 +180,7 @@ export const makeMultiProgressFromStatus = (
): MultiRenderProgress => {
return {
chunkProgress: {
- chunksInvoked: status.chunks,
+ chunksEncoded: status.chunks,
totalChunks: status.renderMetadata?.totalChunks ?? null,
doneIn: status.timeToFinishChunks,
framesRendered: status.framesRendered,
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index 6c2213b399..08b5e5011e 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -246,7 +246,7 @@ export const getProgress = async ({
const chunkCount = outputFile
? renderMetadata?.totalChunks ?? 0
- : chunks.length * chunkMultiplier;
+ : chunks.length / chunkMultiplier;
const availableChunks = chunks.map((c) =>
parseLambdaChunkKey(c.Key as string),
diff --git a/packages/renderer/src/combine-audio.ts b/packages/renderer/src/combine-audio.ts
index ec44ae2f21..2ab7ae9290 100644
--- a/packages/renderer/src/combine-audio.ts
+++ b/packages/renderer/src/combine-audio.ts
@@ -199,14 +199,7 @@ const combineAudioSeamlessly = async ({
const utf8 = data.toString('utf8');
const parsed = parseFfmpegProgress(utf8, fps);
if (parsed === undefined) {
- if (
- !utf8.includes('Estimating duration from bitrate') &&
- !utf8.includes(
- 'Application provided invalid, non monotonically increasing',
- )
- ) {
- Log.verbose({indent, logLevel}, utf8);
- }
+ Log.verbose({indent, logLevel}, utf8);
} else {
Log.verbose({indent, logLevel}, `Encoded ${parsed} audio frames`);
}
diff --git a/packages/renderer/src/combine-video-streams.ts b/packages/renderer/src/combine-video-streams.ts
index 862af7821c..e5586d0c32 100644
--- a/packages/renderer/src/combine-video-streams.ts
+++ b/packages/renderer/src/combine-video-streams.ts
@@ -43,6 +43,7 @@ export const combineVideoStreams = async ({
writeFileSync(fileListTxt, fileList);
const command = [
+ '-hide_banner',
'-r',
String(fps),
'-f',
@@ -66,6 +67,12 @@ export const combineVideoStreams = async ({
output,
].filter(truthy);
+ const startTime = Date.now();
+ Log.verbose(
+ {indent, logLevel},
+ `Combining video without re-encoding, command: ${command.join(' ')}`,
+ );
+
try {
const task = callFf({
args: command,
@@ -85,6 +92,10 @@ export const combineVideoStreams = async ({
}
});
await task;
+ Log.verbose(
+ {indent, logLevel},
+ `Finished combining video in ${Date.now() - startTime}ms`,
+ );
return output;
} catch (e) {
rmSync(fileListTxt, {recursive: true});