Skip to content

🎥 Make videos programmatically with React

remove example videos deduplication

Jonny Burgerb833f98d8002
diff --git a/packages/renderer/src/index.ts b/packages/renderer/src/index.ts
index e2988498e0..e3dcd77009 100644
--- a/packages/renderer/src/index.ts
+++ b/packages/renderer/src/index.ts
@@ -146,6 +146,7 @@ import {
supportedAudioCodecs,
} from './options/audio-codec';
import {getShouldRenderAudio} from './render-has-audio';
+import {exampleVideos} from './test/example-videos';
import {toMegabytes} from './to-megabytes';
import {validatePuppeteerTimeout} from './validate-puppeteer-timeout';
import {validateBitrate} from './validate-videobitrate';
@@ -240,6 +241,7 @@ export const RenderInternals = {
codecSupportsMedia,
toMegabytes,
internalEnsureBrowser,
+ exampleVideos,
};
// Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
diff --git a/packages/video-parser/package.json b/packages/video-parser/package.json
index bdde58829b..de5c7bb434 100644
--- a/packages/video-parser/package.json
+++ b/packages/video-parser/package.json
@@ -12,6 +12,9 @@
"test": "bun test",
"watch": "tsc -w"
},
+ "devDependencies": {
+ "@remotion/renderer": "workspace:*"
+ },
"bugs": {
"url": "https://github.com/remotion-dev/remotion/issues"
},
diff --git a/packages/video-parser/src/test/duration.test.ts b/packages/video-parser/src/test/duration.test.ts
index 793bed879f..3691c06601 100644
--- a/packages/video-parser/src/test/duration.test.ts
+++ b/packages/video-parser/src/test/duration.test.ts
@@ -1,11 +1,14 @@
+import {RenderInternals} from '@remotion/renderer';
import {expect, test} from 'bun:test';
import {getDimensions} from '../get-dimensions';
import {getDuration} from '../get-duration';
import {loadVideo, parseVideo} from '../parse-video';
-import {exampleVideos} from './example-videos';
test('Should get duration of video', async () => {
- const video = await loadVideo(exampleVideos.framer24fps, 128 * 1024);
+ const video = await loadVideo(
+ RenderInternals.exampleVideos.framer24fps,
+ 128 * 1024,
+ );
const parsed = parseVideo(video);
expect(getDuration(parsed.segments)).toBe(4.167);
@@ -13,7 +16,10 @@ test('Should get duration of video', async () => {
});
test('Should get duration of HEVC video', async () => {
- const video = await loadVideo(exampleVideos.iphonehevc, Infinity);
+ const video = await loadVideo(
+ RenderInternals.exampleVideos.iphonehevc,
+ Infinity,
+ );
const parsed = parseVideo(video);
expect(getDuration(parsed.segments)).toBe(3.4);
diff --git a/packages/video-parser/src/test/example-videos.ts b/packages/video-parser/src/test/example-videos.ts
deleted file mode 100644
index 6cfcd7813b..0000000000
--- a/packages/video-parser/src/test/example-videos.ts
+++ /dev/null
@@ -1,38 +0,0 @@
-import path from 'node:path';
-
-const examplePackage = path.join(__dirname, '..', '..', '..', 'example');
-const docsPackage = path.join(__dirname, '..', '..', '..', 'docs');
-
-export const exampleVideos = {
- bigBuckBunny: path.join(examplePackage, 'public/bigbuckbunny.mp4'),
- transparentWebm: path.join(docsPackage, '/static/img/transparent-video.webm'),
- framerWithoutFileExtension: path.join(
- examplePackage,
- 'public',
- 'framermp4withoutfileextension',
- ),
- corrupted: path.join(examplePackage, 'public', 'corrupted.mp4'),
- customDar: path.join(examplePackage, 'public', 'custom-dar.mp4'),
- screenrecording: path.join(examplePackage, 'public', 'quick.mov'),
- nofps: path.join(examplePackage, 'public', 'nofps.webm'),
- variablefps: path.join(examplePackage, 'public', 'variablefps.webm'),
- zerotimestamp: path.join(examplePackage, 'public', 'zero-timestamp.mp4'),
- webcam: path.join(examplePackage, 'public', 'webcam.webm'),
- iphonevideo: path.join(examplePackage, 'public', 'iphonevideo.mov'),
- av1: path.join(examplePackage, 'public', 'av1.webm'),
- framer24fps: path.join(
- examplePackage,
- 'src',
- 'resources',
- 'framer-24fps.mp4',
- ),
- music: path.join(examplePackage, 'public', 'music.mp3'),
- notavideo: path.join(examplePackage, 'public', 'giphy.gif'),
- notafile: path.join(examplePackage, 'public', 'doesnotexist'),
- transparentwithdar: path.join(
- examplePackage,
- 'public',
- 'transparent-with-dar.webm',
- ),
- iphonehevc: path.join(examplePackage, 'public', 'iphone-hevc.mov'),
-};
diff --git a/packages/video-parser/src/test/matroska.test.ts b/packages/video-parser/src/test/matroska.test.ts
index 2ffeecf59d..d1a4213773 100644
--- a/packages/video-parser/src/test/matroska.test.ts
+++ b/packages/video-parser/src/test/matroska.test.ts
@@ -1,10 +1,10 @@
+import {RenderInternals} from '@remotion/renderer';
import {expect, test} from 'bun:test';
import {getDuration} from '../get-duration';
import {loadVideo, parseVideo} from '../parse-video';
-import {exampleVideos} from './example-videos';
test('Should get duration of AV1 video', async () => {
- const video = await loadVideo(exampleVideos.av1, Infinity);
+ const video = await loadVideo(RenderInternals.exampleVideos.av1, Infinity);
const parsed = parseVideo(video);
expect(parsed.segments).toEqual([
{
diff --git a/packages/video-parser/src/test/parse-video.test.ts b/packages/video-parser/src/test/parse-video.test.ts
index 3b884203f7..3d91bb4fcd 100644
--- a/packages/video-parser/src/test/parse-video.test.ts
+++ b/packages/video-parser/src/test/parse-video.test.ts
@@ -1,11 +1,14 @@
+import {RenderInternals} from '@remotion/renderer';
import {expect, test} from 'bun:test';
import {loadVideo, parseVideo} from '../parse-video';
-import {exampleVideos} from './example-videos';
// If this is fixed we can unflag https://github.com/oven-sh/bun/issues/10890
if (process.platform !== 'win32') {
test('Parse Big Buck bunny', async () => {
- const video = await loadVideo(exampleVideos.bigBuckBunny, 4 * 1024);
+ const video = await loadVideo(
+ RenderInternals.exampleVideos.bigBuckBunny,
+ 4 * 1024,
+ );
const data = parseVideo(video);
expect(data.segments).toEqual([
{
@@ -27,7 +30,10 @@ if (process.platform !== 'win32') {
});
test('Parse an iPhone video', async () => {
- const video = await loadVideo(exampleVideos.iphonevideo, 4 * 1024);
+ const video = await loadVideo(
+ RenderInternals.exampleVideos.iphonevideo,
+ 4 * 1024,
+ );
const data = parseVideo(video);
expect(data.segments).toEqual([
{
@@ -50,7 +56,7 @@ if (process.platform !== 'win32') {
test('Parse framer', async () => {
const video = await loadVideo(
- exampleVideos.framerWithoutFileExtension,
+ RenderInternals.exampleVideos.framerWithoutFileExtension,
4 * 1024,
);
const parsed = parseVideo(video);
@@ -74,7 +80,10 @@ if (process.platform !== 'win32') {
});
test('Parse a full video', async () => {
- const video = await loadVideo(exampleVideos.framer24fps, Infinity);
+ const video = await loadVideo(
+ RenderInternals.exampleVideos.framer24fps,
+ Infinity,
+ );
const data = parseVideo(video);
if (!data) throw new Error('No data');
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 457d56af40..199a13134f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1554,7 +1554,11 @@ importers:
specifier: 18.3.1
version: 18.3.1([email protected])
- packages/video-parser: {}
+ packages/video-parser:
+ devDependencies:
+ '@remotion/renderer':
+ specifier: workspace:*
+ version: link:../renderer
packages/zod-types:
dependencies: