Skip to content

🎥 Make videos programmatically with React

all kind of things

JonnyBurgerde6ab79678fb
diff --git a/packages/convert/app/components/ConversionDone.tsx b/packages/convert/app/components/ConversionDone.tsx
index 51b7493c95..6058d0fb17 100644
--- a/packages/convert/app/components/ConversionDone.tsx
+++ b/packages/convert/app/components/ConversionDone.tsx
@@ -1,8 +1,8 @@
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import React, {useCallback} from 'react';
import {canUseOutputAsInput} from '~/lib/can-use-output-as-input';
import type {ConvertState, Source} from '~/lib/convert-state';
import {getNewName} from '~/lib/generate-new-name';
+import type {OutputContainer} from '~/seo';
import {CloneIcon} from './icons/clone';
import {UndoIcon} from './icons/undo';
import {Button} from './ui/button';
@@ -11,7 +11,7 @@ export const ConversionDone: React.FC<{
readonly state: ConvertState;
readonly setState: React.Dispatch<React.SetStateAction<ConvertState>>;
readonly name: string | null;
- readonly container: ConvertMediaContainer;
+ readonly container: OutputContainer;
readonly setSrc: React.Dispatch<React.SetStateAction<Source | null>>;
}> = ({state, name, container, setState, setSrc}) => {
if (state.type !== 'done') {
diff --git a/packages/convert/app/components/ConvertForm.tsx b/packages/convert/app/components/ConvertForm.tsx
index 875a829723..90fa6de784 100644
--- a/packages/convert/app/components/ConvertForm.tsx
+++ b/packages/convert/app/components/ConvertForm.tsx
@@ -2,7 +2,6 @@ import type {
MediaParserAudioCodec,
MediaParserVideoCodec,
} from '@remotion/media-parser';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {getAvailableContainers} from '@remotion/webcodecs';
import React from 'react';
import {
@@ -11,6 +10,7 @@ import {
} from '~/lib/get-audio-video-config-index';
import {getAudioOperationId, getVideoOperationId} from '~/lib/operation-key';
import {renderHumanReadableContainer} from '~/lib/render-codec-label';
+import type {OutputContainer} from '~/seo';
import {AudioCodecSelection} from './AudioCodecSelection';
import type {SupportedConfigs} from './get-supported-configs';
import {SelectionSkeleton} from './SelectionSkeleton';
@@ -27,10 +27,8 @@ import {
import {VideoCodecSelection} from './VideoCodecSelection';
export const ConvertForm: React.FC<{
- readonly container: ConvertMediaContainer;
- readonly setContainer: React.Dispatch<
- React.SetStateAction<ConvertMediaContainer>
- >;
+ readonly container: OutputContainer;
+ readonly setContainer: React.Dispatch<React.SetStateAction<OutputContainer>>;
readonly supportedConfigs: SupportedConfigs | null;
readonly videoConfigIndexSelection: Record<number, string>;
readonly audioConfigIndexSelection: Record<number, string>;
@@ -55,7 +53,7 @@ export const ConvertForm: React.FC<{
<Label htmlFor="container">Container</Label>
<Select
value={container}
- onValueChange={(v) => setContainer(v as ConvertMediaContainer)}
+ onValueChange={(v) => setContainer(v as OutputContainer)}
>
<SelectTrigger id="container">
<SelectValue placeholder="Select a container" />
diff --git a/packages/convert/app/components/ConvertProgress.tsx b/packages/convert/app/components/ConvertProgress.tsx
index ab8d4268e4..bde7dd6439 100644
--- a/packages/convert/app/components/ConvertProgress.tsx
+++ b/packages/convert/app/components/ConvertProgress.tsx
@@ -1,4 +1,3 @@
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import React, {createRef} from 'react';
import {formatBytes} from '~/lib/format-bytes';
import {formatElapsedTime} from '~/lib/format-elapsed-time';
@@ -9,6 +8,7 @@ import {
useAddOutputFilenameToTitle,
useAddProgressToTitle,
} from '~/lib/title-context';
+import type {OutputContainer} from '~/seo';
import {AudioWaveForm, AudioWaveformContainer} from './AudioWaveform';
import {Card} from './ui/card';
import {Skeleton} from './ui/skeleton';
@@ -20,7 +20,7 @@ export const convertProgressRef = createRef<VideoThumbnailRef>();
export const ConvertProgress: React.FC<{
readonly state: ConvertProgressType;
readonly name: string | null;
- readonly container: ConvertMediaContainer;
+ readonly container: OutputContainer;
readonly done: boolean;
readonly duration: number | null;
readonly isReencoding: boolean;
diff --git a/packages/convert/app/components/ConvertUi.tsx b/packages/convert/app/components/ConvertUi.tsx
index 179172f297..8567785220 100644
--- a/packages/convert/app/components/ConvertUi.tsx
+++ b/packages/convert/app/components/ConvertUi.tsx
@@ -6,7 +6,7 @@ import type {
MediaParserTrack,
MediaParserVideoCodec,
} from '@remotion/media-parser';
-import type {ResizeOperation, WebCodecsController} from '@remotion/webcodecs';
+import type {WebCodecsController} from '@remotion/webcodecs';
import {webcodecsController, WebCodecsInternals} from '@remotion/webcodecs';
import type {Rotation} from 'mediabunny';
import {
@@ -28,6 +28,8 @@ import {getInitialResizeSuggestion} from '~/lib/get-initial-resize-suggestion';
import {isReencoding} from '~/lib/is-reencoding';
import {isSubmitDisabled} from '~/lib/is-submit-enabled';
import {generateOutputFilename} from '~/lib/make-output-filename';
+import type {MediabunnyResize} from '~/lib/mediabunny-calculate-resize-option';
+import {calculateMediabunnyResizeOption} from '~/lib/mediabunny-calculate-resize-option';
import {getMediabunnyOutput} from '~/lib/output-container';
import type {ConvertProgressType} from '~/lib/progress';
import {makeWaveformVisualizer} from '~/lib/waveform-visualizer';
@@ -113,7 +115,7 @@ const ConvertUI = ({
isConvertEnabledByDefault(action),
);
const [resizeOperation, setResizeOperation] =
- useState<ResizeOperation | null>(() => {
+ useState<MediabunnyResize | null>(() => {
return (action.type === 'resize-format' ||
action.type === 'generic-resize') &&
dimensions
@@ -233,26 +235,38 @@ const ConvertUI = ({
const conversion = await Conversion.init({
input,
output,
- video: {
- process(sample) {
- const flipped = flipVideoFrame({
- frame: sample.toVideoFrame(),
- horizontal: flipHorizontal && enableRotateOrMirror === 'mirror',
- vertical: flipVertical && enableRotateOrMirror === 'mirror',
- });
- if (videoFrames % 15 === 0) {
- convertProgressRef.current?.draw(flipped);
- }
-
- progress.millisecondsWritten = sample.timestamp * 1000;
+ video: (videoTrack, n) => {
+ if (n > 1) {
+ // TODO: Discard any other than first video tracks?
+ // Keep only the first video track
+ return {discard: true};
+ }
- videoFrames++;
- return flipped;
- },
- rotate: userRotation as Rotation,
- // TODO: Support resize
- // TODO: Support discard
- // TODO: Support force transcode
+ return {
+ height: Math.min(videoTrack.displayHeight, 1080),
+ process(sample) {
+ const flipped = flipVideoFrame({
+ frame: sample.toVideoFrame(),
+ horizontal: flipHorizontal && enableRotateOrMirror === 'mirror',
+ vertical: flipVertical && enableRotateOrMirror === 'mirror',
+ });
+ if (videoFrames % 15 === 0) {
+ convertProgressRef.current?.draw(flipped);
+ }
+
+ progress.millisecondsWritten = sample.timestamp * 1000;
+
+ videoFrames++;
+ return flipped;
+ },
+ rotate: userRotation as Rotation,
+ ...calculateMediabunnyResizeOption(
+ resizeOperation,
+ dimensions ?? null,
+ ),
+ // TODO: Support discard
+ // TODO: Support force transcode
+ };
},
audio: {
process(sample) {
@@ -313,6 +327,8 @@ const ConvertUI = ({
enableRotateOrMirror,
flipHorizontal,
flipVertical,
+ dimensions,
+ resizeOperation,
onWaveformBars,
outputContainer,
src,
diff --git a/packages/convert/app/components/GlobalApis.tsx b/packages/convert/app/components/GlobalApis.tsx
deleted file mode 100644
index 0251bae105..0000000000
--- a/packages/convert/app/components/GlobalApis.tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import {MediaParserInternals} from '@remotion/media-parser';
-import {useEffect} from 'react';
-
-export const GlobalApisInConsole = () => {
- useEffect(() => {
- Promise.all([
- import('@remotion/media-parser').then(({parseMedia}) => {
- // @ts-expect-error
- window.parseMedia = parseMedia;
- }),
-
- import('@remotion/webcodecs').then(({convertMedia}) => {
- // @ts-expect-error
- window.convertMedia = convertMedia;
- }),
- ]).then(() => {
- MediaParserInternals.Log.info(
- 'info',
- 'Tip: You can use parseMedia() and convertMedia() in this console!',
- );
- });
- }, []);
-
- return <div />;
-};
diff --git a/packages/convert/app/components/Main.tsx b/packages/convert/app/components/Main.tsx
index f290a2b7bf..c966ac5029 100644
--- a/packages/convert/app/components/Main.tsx
+++ b/packages/convert/app/components/Main.tsx
@@ -5,7 +5,6 @@ import {TitleProvider} from '~/lib/title-context';
import type {RouteAction} from '~/seo';
import {getHeaderTitle} from '~/seo';
import {FileAvailable} from './FileAvailable';
-import {GlobalApisInConsole} from './GlobalApis';
import {PickFile} from './PickFile';
export const Main: React.FC<{
@@ -42,7 +41,6 @@ export const Main: React.FC<{
/>
)}
</div>
- <GlobalApisInConsole />
</TitleProvider>
);
};
diff --git a/packages/convert/app/components/ResizeCorner.tsx b/packages/convert/app/components/ResizeCorner.tsx
index 4f4cba04c6..8f57d755f4 100644
--- a/packages/convert/app/components/ResizeCorner.tsx
+++ b/packages/convert/app/components/ResizeCorner.tsx
@@ -1,13 +1,13 @@
import type {MediaParserDimensions} from '@remotion/media-parser';
-import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback} from 'react';
+import type {MediabunnyResize} from '~/lib/mediabunny-calculate-resize-option';
export const ResizeCorner: React.FC<{
readonly innerDimensions: MediaParserDimensions;
readonly outerDimensions: MediaParserDimensions;
readonly videoDimensions: MediaParserDimensions;
readonly setResizeMode: React.Dispatch<
- React.SetStateAction<ResizeOperation | null>
+ React.SetStateAction<MediabunnyResize | null>
>;
readonly onStart: () => void;
readonly onEnd: () => void;
@@ -52,7 +52,7 @@ export const ResizeCorner: React.FC<{
const snapPoint = isCloseToSnapPoint ?? newSmallerSide;
const scale = (snapPoint / newSmallerSide) * newScaleX;
- const newResizeMode: ResizeOperation = {
+ const newResizeMode: MediabunnyResize = {
mode: 'scale',
scale,
};
diff --git a/packages/convert/app/components/ResizeShortcuts.tsx b/packages/convert/app/components/ResizeShortcuts.tsx
index 68a8a84e20..7febd08a20 100644
--- a/packages/convert/app/components/ResizeShortcuts.tsx
+++ b/packages/convert/app/components/ResizeShortcuts.tsx
@@ -1,12 +1,12 @@
import type {MediaParserDimensions} from '@remotion/media-parser';
-import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo} from 'react';
+import type {MediabunnyResize} from '~/lib/mediabunny-calculate-resize-option';
export const ResizeOption: React.FC<{
readonly max: number;
readonly selected: boolean;
readonly setResizeMode: React.Dispatch<
- React.SetStateAction<ResizeOperation | null>
+ React.SetStateAction<MediabunnyResize | null>
>;
readonly portrait: boolean;
}> = ({max, selected, setResizeMode, portrait}) => {
@@ -41,7 +41,7 @@ export const ResizeShortcuts: React.FC<{
readonly originalDimensions: MediaParserDimensions;
readonly resolvedDimensions: MediaParserDimensions;
readonly setResizeMode: React.Dispatch<
- React.SetStateAction<ResizeOperation | null>
+ React.SetStateAction<MediabunnyResize | null>
>;
}> = ({originalDimensions, resolvedDimensions, setResizeMode}) => {
const options = useMemo(() => {
diff --git a/packages/convert/app/components/ResizeThumbnail.tsx b/packages/convert/app/components/ResizeThumbnail.tsx
index b0546c50b5..b8b29dba3e 100644
--- a/packages/convert/app/components/ResizeThumbnail.tsx
+++ b/packages/convert/app/components/ResizeThumbnail.tsx
@@ -1,6 +1,6 @@
import type {MediaParserDimensions} from '@remotion/media-parser';
-import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo, useRef, useState} from 'react';
+import type {MediabunnyResize} from '~/lib/mediabunny-calculate-resize-option';
import {useThumbnailCopy} from '~/lib/use-thumbnail-copy';
import {ResizeCorner} from './ResizeCorner';
import type {VideoThumbnailRef} from './VideoThumbnail';
@@ -32,7 +32,7 @@ export const ResizeThumbnail: React.FC<{
readonly rotation: number;
readonly scale: number;
readonly setResizeMode: React.Dispatch<
- React.SetStateAction<ResizeOperation | null>
+ React.SetStateAction<MediabunnyResize | null>
>;
readonly inputFocused: boolean;
}> = ({
diff --git a/packages/convert/app/components/ResizeUi.tsx b/packages/convert/app/components/ResizeUi.tsx
index afc37303a1..6b9cac44e1 100644
--- a/packages/convert/app/components/ResizeUi.tsx
+++ b/packages/convert/app/components/ResizeUi.tsx
@@ -1,6 +1,6 @@
import type {MediaParserDimensions} from '@remotion/media-parser';
-import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo} from 'react';
+import type {MediabunnyResize} from '~/lib/mediabunny-calculate-resize-option';
import {ResizeShortcuts} from './ResizeShortcuts';
import {getThumbnailDimensions, ResizeThumbnail} from './ResizeThumbnail';
import type {VideoThumbnailRef} from './VideoThumbnail';
@@ -41,7 +41,7 @@ export const ResizeUi: React.FC<{
readonly thumbnailRef: React.RefObject<VideoThumbnailRef | null>;
readonly rotation: number;
readonly setResizeMode: React.Dispatch<
- React.SetStateAction<ResizeOperation | null>
+ React.SetStateAction<MediabunnyResize | null>
>;
readonly requireTwoStep: boolean;
}> = ({
diff --git a/packages/convert/app/components/guess-codec-from-source.ts b/packages/convert/app/components/guess-codec-from-source.ts
index e8b7cf5d47..697753b919 100644
--- a/packages/convert/app/components/guess-codec-from-source.ts
+++ b/packages/convert/app/components/guess-codec-from-source.ts
@@ -1,7 +1,6 @@
import type {MediaParserContainer} from '@remotion/media-parser';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import type {Source} from '~/lib/convert-state';
-import type {RouteAction} from '~/seo';
+import type {OutputContainer, RouteAction} from '~/seo';
const guessFromExtension = (src: string): MediaParserContainer => {
if (src.endsWith('.webm')) {
@@ -110,7 +109,7 @@ const shouldKeepSameContainerByDefault = (action: RouteAction) => {
export const getDefaultContainerForConversion = (
source: Source,
action: RouteAction,
-): ConvertMediaContainer => {
+): OutputContainer => {
const guessed = guessContainerFromSource(source);
const keepSame = shouldKeepSameContainerByDefault(action);
diff --git a/packages/convert/app/components/use-supported-configs.ts b/packages/convert/app/components/use-supported-configs.ts
index 9e7efc5ec6..50357bc351 100644
--- a/packages/convert/app/components/use-supported-configs.ts
+++ b/packages/convert/app/components/use-supported-configs.ts
@@ -2,9 +2,9 @@ import type {
MediaParserContainer,
MediaParserTrack,
} from '@remotion/media-parser';
-import type {ConvertMediaContainer, ResizeOperation} from '@remotion/webcodecs';
+import type {ResizeOperation} from '@remotion/webcodecs';
import {useEffect, useState} from 'react';
-import type {RouteAction} from '~/seo';
+import type {OutputContainer, RouteAction} from '~/seo';
import type {SupportedConfigs} from './get-supported-configs';
import {getSupportedConfigs} from './get-supported-configs';
@@ -17,7 +17,7 @@ export const useSupportedConfigs = ({
resizeOperation,
sampleRate,
}: {
- outputContainer: ConvertMediaContainer;
+ outputContainer: OutputContainer;
tracks: MediaParserTrack[] | null;
action: RouteAction;
userRotation: number;
@@ -26,7 +26,7 @@ export const useSupportedConfigs = ({
sampleRate: number | null;
}) => {
const [state, setState] = useState<
- Record<ConvertMediaContainer, SupportedConfigs | null>
+ Record<OutputContainer, SupportedConfigs | null>
>({mp4: null, webm: null, wav: null});
useEffect(() => {
diff --git a/packages/convert/app/lib/can-use-output-as-input.ts b/packages/convert/app/lib/can-use-output-as-input.ts
index a5dee74c5a..e67584839b 100644
--- a/packages/convert/app/lib/can-use-output-as-input.ts
+++ b/packages/convert/app/lib/can-use-output-as-input.ts
@@ -1,6 +1,6 @@
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {OutputContainer} from '~/seo';
-export const canUseOutputAsInput = (container: ConvertMediaContainer) => {
+export const canUseOutputAsInput = (container: OutputContainer) => {
if (container === 'wav') {
return true;
}
diff --git a/packages/convert/app/lib/generate-new-name.ts b/packages/convert/app/lib/generate-new-name.ts
index b46fc9da85..be192fadc4 100644
--- a/packages/convert/app/lib/generate-new-name.ts
+++ b/packages/convert/app/lib/generate-new-name.ts
@@ -1,9 +1,6 @@
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {OutputContainer} from '~/seo';
-export const getNewName = (
- name: string,
- newContainer: ConvertMediaContainer,
-) => {
+export const getNewName = (name: string, newContainer: OutputContainer) => {
const parts = name.split('.');
parts.pop();
diff --git a/packages/convert/app/lib/get-initial-resize-suggestion.ts b/packages/convert/app/lib/get-initial-resize-suggestion.ts
index 19712dcf76..59a9aff1f8 100644
--- a/packages/convert/app/lib/get-initial-resize-suggestion.ts
+++ b/packages/convert/app/lib/get-initial-resize-suggestion.ts
@@ -1,9 +1,9 @@
import type {MediaParserDimensions} from '@remotion/media-parser';
-import type {ResizeOperation} from '@remotion/webcodecs';
+import type {MediabunnyResize} from './mediabunny-calculate-resize-option';
export const getInitialResizeSuggestion = (
rotatedDimensions: MediaParserDimensions | null,
-): ResizeOperation => {
+): MediabunnyResize => {
if (rotatedDimensions === null) {
return {
mode: 'scale',
diff --git a/packages/convert/app/lib/mediabunny-calculate-resize-option.ts b/packages/convert/app/lib/mediabunny-calculate-resize-option.ts
new file mode 100644
index 0000000000..b9bb7dc990
--- /dev/null
+++ b/packages/convert/app/lib/mediabunny-calculate-resize-option.ts
@@ -0,0 +1,49 @@
+import type {MediaParserDimensions} from '@remotion/media-parser';
+import type {ConversionVideoOptions} from 'mediabunny';
+
+export type MediabunnyResize =
+ | {
+ mode: 'scale';
+ scale: number;
+ }
+ | {
+ mode: 'max-height';
+ maxHeight: number;
+ }
+ | {
+ mode: 'max-width';
+ maxWidth: number;
+ };
+
+export const calculateMediabunnyResizeOption = (
+ resizeOperation: MediabunnyResize | null,
+ rotatedDimensions: MediaParserDimensions | null,
+): ConversionVideoOptions => {
+ if (resizeOperation === null) {
+ return {};
+ }
+
+ if (rotatedDimensions === null) {
+ return {};
+ }
+
+ if (resizeOperation.mode === 'scale') {
+ return {
+ height: rotatedDimensions.height * resizeOperation.scale,
+ };
+ }
+
+ if (resizeOperation.mode === 'max-height') {
+ return {
+ height: Math.min(rotatedDimensions.height, resizeOperation.maxHeight),
+ };
+ }
+
+ if (resizeOperation.mode === 'max-width') {
+ return {
+ width: Math.min(rotatedDimensions.width, resizeOperation.maxWidth),
+ };
+ }
+
+ throw new Error('Unexpected resize operation ');
+};
diff --git a/packages/convert/app/lib/render-codec-label.ts b/packages/convert/app/lib/render-codec-label.ts
index f414e2d5d1..af2f4c44a7 100644
--- a/packages/convert/app/lib/render-codec-label.ts
+++ b/packages/convert/app/lib/render-codec-label.ts
@@ -3,10 +3,8 @@ import type {
MediaParserContainer,
MediaParserVideoCodec,
} from '@remotion/media-parser';
-import type {
- ConvertMediaAudioCodec,
- ConvertMediaContainer,
-} from '@remotion/webcodecs';
+import type {ConvertMediaAudioCodec} from '@remotion/webcodecs';
+import type {OutputContainer} from '~/seo';
export const renderHumanReadableAudioCodec = (
codec: MediaParserAudioCodec | ConvertMediaAudioCodec,
@@ -95,7 +93,7 @@ export const renderHumanReadableVideoCodec = (codec: MediaParserVideoCodec) => {
};
export const renderHumanReadableContainer = (
- container: MediaParserContainer | ConvertMediaContainer,
+ container: MediaParserContainer | OutputContainer,
) => {
if (container === 'webm') {
return '.webm';
diff --git a/packages/convert/app/lib/title-context.tsx b/packages/convert/app/lib/title-context.tsx
index 3c5badeb70..e362b9a563 100644
--- a/packages/convert/app/lib/title-context.tsx
+++ b/packages/convert/app/lib/title-context.tsx
@@ -1,4 +1,3 @@
-import type {WebCodecsController} from '@remotion/webcodecs';
import React, {useEffect, useLayoutEffect, useMemo} from 'react';
import type {VideoThumbnailRef} from '~/components/VideoThumbnail';
import type {RouteAction} from '~/seo';
@@ -132,28 +131,6 @@ export const useAddProgressToTitle = (progress: number | null) => {
}, [progress, setProgress]);
};
-export const useAddPausedToTitle = (controller: WebCodecsController) => {
- const {setPaused} = useTitle();
-
- useEffect(() => {
- const onPause = () => {
- setPaused(true);
- };
-
- const onResume = () => {
- setPaused(false);
- };
-
- controller.addEventListener('pause', onPause);
- controller.addEventListener('resume', onResume);
-
- return () => {
- controller.removeEventListener('pause', onPause);
- controller.removeEventListener('resume', onResume);
- };
- }, [controller, setPaused]);
-};
-
export const useCopyThumbnailToFavicon = (
sourceRef: React.RefObject<VideoThumbnailRef | null>,
) => {
diff --git a/packages/convert/app/routes/mirror.$format.tsx b/packages/convert/app/routes/mirror.$format.tsx
index 15071de4c6..a84b783444 100644
--- a/packages/convert/app/routes/mirror.$format.tsx
+++ b/packages/convert/app/routes/mirror.$format.tsx
@@ -1,11 +1,10 @@
import {useParams} from '@remix-run/react';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import type {RouteAction} from '~/seo';
+import type {OutputContainer, RouteAction} from '~/seo';
const Index = () => {
- const format = useParams().format as ConvertMediaContainer;
+ const format = useParams().format as OutputContainer;
const routeAction: RouteAction = useMemo(() => {
return {
diff --git a/packages/convert/app/routes/resize.$format.tsx b/packages/convert/app/routes/resize.$format.tsx
index 75a57c8332..540774acac 100644
--- a/packages/convert/app/routes/resize.$format.tsx
+++ b/packages/convert/app/routes/resize.$format.tsx
@@ -1,11 +1,10 @@
import {useParams} from '@remix-run/react';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import type {RouteAction} from '~/seo';
+import type {OutputContainer, RouteAction} from '~/seo';
const Index = () => {
- const format = useParams().format as ConvertMediaContainer;
+ const format = useParams().format as OutputContainer;
const routeAction: RouteAction = useMemo(() => {
return {
diff --git a/packages/convert/app/routes/rotate.$format.tsx b/packages/convert/app/routes/rotate.$format.tsx
index 5ad3868a33..6b17bd80ef 100644
--- a/packages/convert/app/routes/rotate.$format.tsx
+++ b/packages/convert/app/routes/rotate.$format.tsx
@@ -1,11 +1,10 @@
import {useParams} from '@remix-run/react';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import type {RouteAction} from '~/seo';
+import type {OutputContainer, RouteAction} from '~/seo';
const Index = () => {
- const format = useParams().format as ConvertMediaContainer;
+ const format = useParams().format as OutputContainer;
const routeAction: RouteAction = useMemo(() => {
return {
diff --git a/packages/convert/app/seo.ts b/packages/convert/app/seo.ts
index cde089f94e..5e4bd3eb42 100644
--- a/packages/convert/app/seo.ts
+++ b/packages/convert/app/seo.ts
@@ -1,5 +1,4 @@
import type {MediaParserContainer} from '@remotion/media-parser';
-import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {renderHumanReadableContainer} from './lib/render-codec-label';
export const inputContainers: MediaParserContainer[] = ['mp4', 'webm', 'avi'];
@@ -18,16 +17,16 @@ export const parseConvertRouteAction = (action: string) => {
}
return {
- input: split[0] as ConvertMediaContainer,
- output: split[1] as ConvertMediaContainer,
+ input: split[0] as OutputContainer,
+ output: split[1] as OutputContainer,
};
};
export type RouteAction =
| {
type: 'convert';
- input: ConvertMediaContainer | MediaParserContainer;
- output: ConvertMediaContainer;
+ input: OutputContainer | MediaParserContainer;
+ output: OutputContainer;
}
| {
type: 'generic-convert';
@@ -37,14 +36,14 @@ export type RouteAction =
}
| {
type: 'rotate-format';
- format: MediaParserContainer | ConvertMediaContainer;
+ format: MediaParserContainer | OutputContainer;
}
| {
type: 'generic-mirror';
}
| {
type: 'mirror-format';
- format: MediaParserContainer | ConvertMediaContainer;
+ format: MediaParserContainer | OutputContainer;
}
| {
type: 'generic-resize';
@@ -54,7 +53,7 @@ export type RouteAction =
}
| {
type: 'resize-format';
- format: MediaParserContainer | ConvertMediaContainer;
+ format: MediaParserContainer | OutputContainer;
}
| {
type: 'generic-probe';