Skip to content

🎥 Make videos programmatically with React

fix "Made with Remotion" video metadata on Lambda

Jonny Burger8b8606da3f9e
diff --git a/packages/renderer/src/combine-videos.ts b/packages/renderer/src/combine-videos.ts
index a798612bf9..8a66adabd4 100644
--- a/packages/renderer/src/combine-videos.ts
+++ b/packages/renderer/src/combine-videos.ts
@@ -2,6 +2,7 @@
import {rmSync, writeFileSync} from 'node:fs';
import {join} from 'node:path';
+import {VERSION} from 'remotion/version';
import type {AudioCodec} from './audio-codec';
import {
getDefaultAudioCodec,
@@ -79,6 +80,8 @@ export const combineVideos = async (options: Options) => {
audioBitrate ? audioBitrate : '320k',
codec === 'h264' ? '-movflags' : null,
codec === 'h264' ? 'faststart' : null,
+ '-map_metadata -1',
+ `-metadata comment=Made with Remotion ${VERSION}`,
'-y',
output,
].filter(truthy);
diff --git a/packages/renderer/src/stitch-frames-to-video.ts b/packages/renderer/src/stitch-frames-to-video.ts
index 71a75a205e..9629215897 100644
--- a/packages/renderer/src/stitch-frames-to-video.ts
+++ b/packages/renderer/src/stitch-frames-to-video.ts
@@ -1,7 +1,8 @@
-import fs, {promises} from 'node:fs';
+import {promises} from 'node:fs';
import path from 'node:path';
import type {TRenderAsset} from 'remotion/no-react';
import {NoReactInternals} from 'remotion/no-react';
+import {VERSION} from 'remotion/version';
import {calculateAssetPositions} from './assets/calculate-asset-positions';
import {convertAssetsToFileUrls} from './assets/convert-assets-to-file-urls';
import type {RenderMediaOnDownload} from './assets/download-and-map-assets-to-file';
@@ -46,12 +47,6 @@ import {validateEvenDimensionsWithCodec} from './validate-even-dimensions-with-c
import {validateBitrate} from './validate-videobitrate';
import type {X264Preset} from './x264-preset';
-const packageJsonPath = path.join(__dirname, '..', 'package.json');
-
-const packageJson = fs.existsSync(packageJsonPath)
- ? JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))
- : null;
-
type InternalStitchFramesToVideoOptions = {
audioBitrate: string | null;
videoBitrate: string | null;
@@ -452,13 +447,7 @@ const innerStitchFramesToVideo = async (
resolvedAudioCodec === 'aac' ? '18000' : null,
// Ignore metadata that may come from remote media
['-map_metadata', '-1'],
- [
- '-metadata',
- `comment=` +
- [`Made with Remotion`, packageJson ? packageJson.version : null].join(
- ' ',
- ),
- ],
+ ['-metadata', `comment=Made with Remotion ${VERSION}`],
force ? '-y' : null,
outputLocation ?? tempFile,
];