Skip to content

🎥 Make videos programmatically with React

Merge branch 'main' into copilot/fix-5413

Jonny Burger708cb891eca3
diff --cc packages/studio/src/components/Timeline/TimelineVideoInfo.tsx
index df6ad61d1d,dd912da543..be7ecf5060
--- a/packages/studio/src/components/Timeline/TimelineVideoInfo.tsx
+++ b/packages/studio/src/components/Timeline/TimelineVideoInfo.tsx
@@@ -1,10 -1,19 +1,19 @@@
import {hasBeenAborted, WEBCODECS_TIMESCALE} from '@remotion/media-parser';
-import {extractFrames, WebCodecsInternals} from '@remotion/webcodecs';
+import {extractFrames, rotateAndResizeVideoFrame} from '@remotion/webcodecs';
- import React, {useEffect, useMemo, useRef, useState} from 'react';
+ import React, {useEffect, useRef, useState} from 'react';
import {useVideoConfig} from 'remotion';
- import {TIMELINE_LAYER_HEIGHT} from '../../helpers/timeline-layout';
+ import type {FrameDatabaseKey} from '../../helpers/frame-database';
+ import {
+ aspectRatioCache,
+ clearOldFrames,
+ frameDatabase,
+ getAspectRatioFromCache,
+ getTimestampFromFrameDatabaseKey,
+ makeFrameDatabaseKey,
+ } from '../../helpers/frame-database';
+ import {getTimelineLayerHeight} from '../../helpers/timeline-layout';
- const HEIGHT = TIMELINE_LAYER_HEIGHT - 2;
+ const HEIGHT = getTimelineLayerHeight('video') - 2;
const containerStyle: React.CSSProperties = {
height: HEIGHT,
@@@ -243,9 -353,9 +353,9 @@@ export const TimelineVideoInfo: React.F
},
src,
onFrame: (frame) => {
- const scale = HEIGHT / frame.displayHeight;
+ const scale = (HEIGHT / frame.displayHeight) * window.devicePixelRatio;
- const transformed = WebCodecsInternals.rotateAndResizeVideoFrame({
+ const transformed = rotateAndResizeVideoFrame({
frame,
resizeOperation: {
mode: 'scale',