Skip to content

🎥 Make videos programmatically with React

nice

Jonny Burgere0ab3aafc867
diff --git a/packages/convert/app/components/AudioCodecSelection.tsx b/packages/convert/app/components/AudioCodecSelection.tsx
index dd6caaa3c8..4171ba5b0b 100644
--- a/packages/convert/app/components/AudioCodecSelection.tsx
+++ b/packages/convert/app/components/AudioCodecSelection.tsx
@@ -1,5 +1,5 @@
-import {MediaParserAudioCodec} from '@remotion/media-parser';
-import {AudioOperation} from '@remotion/webcodecs';
+import type {MediaParserAudioCodec} from '@remotion/media-parser';
+import type {AudioOperation} from '@remotion/webcodecs';
import React from 'react';
import {getAudioOperationId} from '~/lib/operation-key';
import {AudioCodecDropWarning} from './AudioCodecDropWarning';
diff --git a/packages/convert/app/components/AudioOperationOption.tsx b/packages/convert/app/components/AudioOperationOption.tsx
index d2b3cbe8b9..89ebe747a5 100644
--- a/packages/convert/app/components/AudioOperationOption.tsx
+++ b/packages/convert/app/components/AudioOperationOption.tsx
@@ -1,5 +1,5 @@
-import {MediaParserAudioCodec} from '@remotion/media-parser';
-import {AudioOperation} from '@remotion/webcodecs';
+import type {MediaParserAudioCodec} from '@remotion/media-parser';
+import type {AudioOperation} from '@remotion/webcodecs';
import {renderHumanReadableAudioCodec} from '~/lib/render-codec-label';
export const AudioOperationOption: React.FC<{
diff --git a/packages/convert/app/components/BackButton.tsx b/packages/convert/app/components/BackButton.tsx
index 1599b39924..1aae880c1d 100644
--- a/packages/convert/app/components/BackButton.tsx
+++ b/packages/convert/app/components/BackButton.tsx
@@ -1,5 +1,5 @@
import React, {useCallback} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {Button} from './ui/button';
export const BackButton: React.FC<{
diff --git a/packages/convert/app/components/ConversionDone.tsx b/packages/convert/app/components/ConversionDone.tsx
index cac3e0531b..51b7493c95 100644
--- a/packages/convert/app/components/ConversionDone.tsx
+++ b/packages/convert/app/components/ConversionDone.tsx
@@ -1,7 +1,7 @@
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
import React, {useCallback} from 'react';
import {canUseOutputAsInput} from '~/lib/can-use-output-as-input';
-import {ConvertState, Source} from '~/lib/convert-state';
+import type {ConvertState, Source} from '~/lib/convert-state';
import {getNewName} from '~/lib/generate-new-name';
import {CloneIcon} from './icons/clone';
import {UndoIcon} from './icons/undo';
@@ -31,6 +31,7 @@ export const ConversionDone: React.FC<{
a.click();
URL.revokeObjectURL(a.href);
} catch (e) {
+ // eslint-disable-next-line no-console
console.error(e);
setState({type: 'error', error: e as Error});
}
diff --git a/packages/convert/app/components/ConvertForm.tsx b/packages/convert/app/components/ConvertForm.tsx
index a046f2c0ea..fdefae7b56 100644
--- a/packages/convert/app/components/ConvertForm.tsx
+++ b/packages/convert/app/components/ConvertForm.tsx
@@ -1,16 +1,14 @@
-import {
+import type {
MediaParserAudioCodec,
MediaParserVideoCodec,
} from '@remotion/media-parser';
-import {
- ConvertMediaContainer,
- getAvailableContainers,
-} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
+import {getAvailableContainers} from '@remotion/webcodecs';
import React from 'react';
import {getAudioOperationId, getVideoOperationId} from '~/lib/operation-key';
import {renderHumanReadableContainer} from '~/lib/render-codec-label';
import {AudioCodecSelection} from './AudioCodecSelection';
-import {SupportedConfigs} from './get-supported-configs';
+import type {SupportedConfigs} from './get-supported-configs';
import {SelectionSkeleton} from './SelectionSkeleton';
import {AudioTrackLabel, VideoTrackLabel} from './TrackSelectionLabels';
import {Label} from './ui/label';
@@ -59,11 +57,11 @@ export const ConvertForm: React.FC<{
<SelectValue placeholder="Select a container" />
</SelectTrigger>
<SelectContent>
- {getAvailableContainers().map((container) => {
+ {getAvailableContainers().map((availableContainer) => {
return (
- <SelectGroup key={container}>
- <SelectItem value={container}>
- {renderHumanReadableContainer(container)}
+ <SelectGroup key={availableContainer}>
+ <SelectItem value={availableContainer}>
+ {renderHumanReadableContainer(availableContainer)}
</SelectItem>
</SelectGroup>
);
diff --git a/packages/convert/app/components/ConvertProgress.tsx b/packages/convert/app/components/ConvertProgress.tsx
index 4c90cb600d..a74b6edf0c 100644
--- a/packages/convert/app/components/ConvertProgress.tsx
+++ b/packages/convert/app/components/ConvertProgress.tsx
@@ -1,4 +1,4 @@
-import {ConvertMediaContainer, ConvertMediaProgress} from '@remotion/webcodecs';
+import type {ConvertMediaContainer, ConvertMediaProgress} from '@remotion/webcodecs';
import React, {createRef} from 'react';
import {formatBytes} from '~/lib/format-bytes';
import {formatSeconds} from '~/lib/format-seconds';
@@ -9,7 +9,8 @@ import {
} from '~/lib/title-context';
import {Card} from './ui/card';
import {Skeleton} from './ui/skeleton';
-import {VideoThumbnail, VideoThumbnailRef} from './VideoThumbnail';
+import type { VideoThumbnailRef} from './VideoThumbnail';
+import {VideoThumbnail} from './VideoThumbnail';
export const convertProgressRef = createRef<VideoThumbnailRef>();
diff --git a/packages/convert/app/components/ConvertUi.tsx b/packages/convert/app/components/ConvertUi.tsx
index 905ee04899..e3ef3f98ed 100644
--- a/packages/convert/app/components/ConvertUi.tsx
+++ b/packages/convert/app/components/ConvertUi.tsx
@@ -1,30 +1,22 @@
import {Button} from '@/components/ui/button';
-import {
+import type {
Dimensions,
LogLevel,
MediaParserAudioCodec,
- MediaParserInternals,
MediaParserVideoCodec,
ParseMediaContainer,
TracksField,
} from '@remotion/media-parser';
+import {MediaParserInternals} from '@remotion/media-parser';
import {fetchReader} from '@remotion/media-parser/fetch';
import {webFileReader} from '@remotion/media-parser/web-file';
-import {
- convertMedia,
- ConvertMediaContainer,
- ResizeOperation,
- WebCodecsInternals,
-} from '@remotion/webcodecs';
+import type {ConvertMediaContainer, ResizeOperation} from '@remotion/webcodecs';
+import {convertMedia, WebCodecsInternals} from '@remotion/webcodecs';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
import {canRotateOrMirror} from '~/lib/can-rotate-or-mirror';
-import {ConvertState, Source} from '~/lib/convert-state';
-import {
- ConvertSections,
- getOrderOfSections,
- isConvertEnabledByDefault,
- RotateOrMirrorState,
-} from '~/lib/default-ui';
+import type {ConvertState, Source} from '~/lib/convert-state';
+import type {ConvertSections, RotateOrMirrorState} from '~/lib/default-ui';
+import {getOrderOfSections, isConvertEnabledByDefault} from '~/lib/default-ui';
import {
getActualAudioConfigIndex,
getActualVideoOperation,
@@ -32,7 +24,7 @@ import {
import {getInitialResizeSuggestion} from '~/lib/get-initial-resize-suggestion';
import {isReencoding} from '~/lib/is-reencoding';
import {isSubmitDisabled} from '~/lib/is-submit-enabled';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
import {ConversionDone} from './ConversionDone';
import {ConvertForm} from './ConvertForm';
import {ConvertProgress, convertProgressRef} from './ConvertProgress';
@@ -44,7 +36,7 @@ import {MirrorComponents} from './MirrorComponents';
import {ResizeUi} from './ResizeUi';
import {RotateComponents} from './RotateComponents';
import {useSupportedConfigs} from './use-supported-configs';
-import {VideoThumbnailRef} from './VideoThumbnail';
+import type {VideoThumbnailRef} from './VideoThumbnail';
export default function ConvertUI({
src,
@@ -260,6 +252,7 @@ export default function ConvertUI({
return;
}
+ // eslint-disable-next-line no-console
console.error(e);
setState({type: 'error', error: e as Error});
});
@@ -307,6 +300,7 @@ export default function ConvertUI({
if (m !== 'mirror') {
return 'mirror';
}
+
return null;
});
}, [setEnableRotateOrMirror]);
@@ -316,6 +310,7 @@ export default function ConvertUI({
if (m !== 'rotate') {
return 'rotate';
}
+
return null;
});
}, [setEnableRotateOrMirror]);
diff --git a/packages/convert/app/components/DropFileBox.tsx b/packages/convert/app/components/DropFileBox.tsx
index 9f4ff7f179..eda314e584 100644
--- a/packages/convert/app/components/DropFileBox.tsx
+++ b/packages/convert/app/components/DropFileBox.tsx
@@ -1,5 +1,5 @@
import React, {useCallback, useRef} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {Button} from './ui/button';
export const DropFileBox: React.FC<{
@@ -12,6 +12,7 @@ export const DropFileBox: React.FC<{
const file = event.target.files?.[0];
if (file) {
setSrc({type: 'file', file});
+ // eslint-disable-next-line no-console
console.log('File selected:', file.name);
// Add your file handling logic here
}
diff --git a/packages/convert/app/components/FileAvailable.tsx b/packages/convert/app/components/FileAvailable.tsx
index ea19d7578e..e3b420e156 100644
--- a/packages/convert/app/components/FileAvailable.tsx
+++ b/packages/convert/app/components/FileAvailable.tsx
@@ -1,17 +1,18 @@
-import {ParseMediaOnProgress} from '@remotion/media-parser';
+import type {ParseMediaOnProgress} from '@remotion/media-parser';
import {WebCodecsInternals} from '@remotion/webcodecs';
import React, {useCallback, useMemo, useRef, useState} from 'react';
-import {Source} from '~/lib/convert-state';
-import {defaultRotateOrMirorState, RotateOrMirrorState} from '~/lib/default-ui';
+import type {Source} from '~/lib/convert-state';
+import type { RotateOrMirrorState} from '~/lib/default-ui';
+import {defaultRotateOrMirorState} from '~/lib/default-ui';
import {formatBytes} from '~/lib/format-bytes';
import {useThumbnail} from '~/lib/use-thumbnail';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
import {BackButton} from './BackButton';
import ConvertUI from './ConvertUi';
import {Footer} from './Footer';
import {Probe} from './Probe';
import {ReplaceVideo} from './ReplaceVideo';
-import {VideoThumbnailRef} from './VideoThumbnail';
+import type {VideoThumbnailRef} from './VideoThumbnail';
import {getBrightnessOfFrame} from './get-brightness-of-frame';
import {useProbe} from './use-probe';
diff --git a/packages/convert/app/components/KeyframesInfo.tsx b/packages/convert/app/components/KeyframesInfo.tsx
index bc5ba3e835..f6e2a9f238 100644
--- a/packages/convert/app/components/KeyframesInfo.tsx
+++ b/packages/convert/app/components/KeyframesInfo.tsx
@@ -1,4 +1,4 @@
-import {MediaParserKeyframe} from '@remotion/media-parser';
+import type {MediaParserKeyframe} from '@remotion/media-parser';
import React from 'react';
import {TableCell, TableRow} from './ui/table';
diff --git a/packages/convert/app/components/Main.tsx b/packages/convert/app/components/Main.tsx
index d573ce5907..b0e2fdbe11 100644
--- a/packages/convert/app/components/Main.tsx
+++ b/packages/convert/app/components/Main.tsx
@@ -1,8 +1,9 @@
import {useLocation} from '@remix-run/react';
import React, {useState} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {TitleProvider} from '~/lib/title-context';
-import {getHeaderTitle, RouteAction} from '~/seo';
+import type { RouteAction} from '~/seo';
+import {getHeaderTitle} from '~/seo';
import {FileAvailable} from './FileAvailable';
import {PickFile} from './PickFile';
diff --git a/packages/convert/app/components/MetadataTable.tsx b/packages/convert/app/components/MetadataTable.tsx
index 0acf5f31d5..3762a4fa80 100644
--- a/packages/convert/app/components/MetadataTable.tsx
+++ b/packages/convert/app/components/MetadataTable.tsx
@@ -1,4 +1,4 @@
-import {MediaParserLocation, MetadataEntry} from '@remotion/media-parser';
+import type {MediaParserLocation, MetadataEntry} from '@remotion/media-parser';
import React, {useMemo} from 'react';
import {
renderMetadataLabel,
diff --git a/packages/convert/app/components/PickFile.tsx b/packages/convert/app/components/PickFile.tsx
index d382c5cb3b..84001bb1cd 100644
--- a/packages/convert/app/components/PickFile.tsx
+++ b/packages/convert/app/components/PickFile.tsx
@@ -1,6 +1,6 @@
import React, {useCallback} from 'react';
import {SAMPLE_FILE} from '~/lib/config';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {DropFileBox} from './DropFileBox';
import {TextMarkLogo} from './TextMarkLogo';
import {WhyRemotionConvert} from './WhyRemotionConvert';
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsx
index 771ecf027c..f28aa4fec3 100644
--- a/packages/convert/app/components/Probe.tsx
+++ b/packages/convert/app/components/Probe.tsx
@@ -1,7 +1,7 @@
/* eslint-disable complexity */
import clsx from 'clsx';
import React, {useCallback, useMemo, useState} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {useIsNarrow} from '~/lib/is-narrow';
import {
useAddFilenameToTitle,
@@ -11,7 +11,8 @@ import {AudioTrackOverview} from './AudioTrackOverview';
import {ContainerOverview} from './ContainerOverview';
import {SourceLabel} from './SourceLabel';
import {TrackSwitcher} from './TrackSwitcher';
-import {VideoThumbnail, VideoThumbnailRef} from './VideoThumbnail';
+import type { VideoThumbnailRef} from './VideoThumbnail';
+import {VideoThumbnail} from './VideoThumbnail';
import {VideoTrackOverview} from './VideoTrackOverview';
import styles from './probe.module.css';
import {Button} from './ui/button';
@@ -19,7 +20,7 @@ import {Card, CardDescription, CardHeader, CardTitle} from './ui/card';
import {ScrollArea} from './ui/scroll-area';
import {Separator} from './ui/separator';
import {Skeleton} from './ui/skeleton';
-import {ProbeResult} from './use-probe';
+import type {ProbeResult} from './use-probe';
export const Probe: React.FC<{
readonly src: Source;
diff --git a/packages/convert/app/components/ReplaceVideo.tsx b/packages/convert/app/components/ReplaceVideo.tsx
index 48d2e5572d..bb3a36a9a6 100644
--- a/packages/convert/app/components/ReplaceVideo.tsx
+++ b/packages/convert/app/components/ReplaceVideo.tsx
@@ -1,5 +1,5 @@
import React, {useCallback, useEffect, useState} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
import {DragOverOverlay} from './DragOverOverlay';
import {Button} from './ui/button';
import {
diff --git a/packages/convert/app/components/ResizeCorner.tsx b/packages/convert/app/components/ResizeCorner.tsx
index df06e6dc75..922b28dc3a 100644
--- a/packages/convert/app/components/ResizeCorner.tsx
+++ b/packages/convert/app/components/ResizeCorner.tsx
@@ -1,5 +1,5 @@
-import {Dimensions} from '@remotion/media-parser';
-import {ResizeOperation} from '@remotion/webcodecs';
+import type {Dimensions} from '@remotion/media-parser';
+import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback} from 'react';
export const ResizeCorner: React.FC<{
@@ -25,14 +25,15 @@ export const ResizeCorner: React.FC<{
// right-click
return;
}
+
onStart();
e.preventDefault();
const originalX = e.clientX;
const currentScale = innerDimensions.width / outerDimensions.width;
- const getScale = (e: PointerEvent) => {
- const dx = e.clientX - originalX;
+ const getScale = (event: PointerEvent) => {
+ const dx = event.clientX - originalX;
const newScaleX = Math.max(
0.2,
@@ -58,12 +59,12 @@ export const ResizeCorner: React.FC<{
setResizeMode(newResizeMode);
};
- const onPointerMove = (e: PointerEvent) => {
- getScale(e);
+ const onPointerMove = (event: PointerEvent) => {
+ getScale(event);
};
- const onPointerRelease = (e: PointerEvent) => {
- getScale(e);
+ const onPointerRelease = (event: PointerEvent) => {
+ getScale(event);
onEnd();
window.removeEventListener('pointermove', onPointerMove);
window.removeEventListener('pointerup', onPointerRelease);
diff --git a/packages/convert/app/components/ResizeShortcuts.tsx b/packages/convert/app/components/ResizeShortcuts.tsx
index 5cfe60e296..6c699fa0f0 100644
--- a/packages/convert/app/components/ResizeShortcuts.tsx
+++ b/packages/convert/app/components/ResizeShortcuts.tsx
@@ -1,5 +1,5 @@
-import {Dimensions} from '@remotion/media-parser';
-import {ResizeOperation} from '@remotion/webcodecs';
+import type {Dimensions} from '@remotion/media-parser';
+import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo} from 'react';
export const ResizeOption: React.FC<{
@@ -18,6 +18,7 @@ export const ResizeOption: React.FC<{
maxWidth: max,
};
}
+
return {
mode: 'max-height',
maxHeight: max,
diff --git a/packages/convert/app/components/ResizeThumbnail.tsx b/packages/convert/app/components/ResizeThumbnail.tsx
index 7a13f66e58..a7d0bd43d8 100644
--- a/packages/convert/app/components/ResizeThumbnail.tsx
+++ b/packages/convert/app/components/ResizeThumbnail.tsx
@@ -1,9 +1,9 @@
-import {Dimensions} from '@remotion/media-parser';
-import {ResizeOperation} from '@remotion/webcodecs';
+import type {Dimensions} from '@remotion/media-parser';
+import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo, useRef, useState} from 'react';
import {useThumbnailCopy} from '~/lib/use-thumbnail-copy';
import {ResizeCorner} from './ResizeCorner';
-import {VideoThumbnailRef} from './VideoThumbnail';
+import type {VideoThumbnailRef} from './VideoThumbnail';
const MAX_THUMBNAIL_SIZE = 150;
diff --git a/packages/convert/app/components/ResizeUi.tsx b/packages/convert/app/components/ResizeUi.tsx
index cb494b6b90..49155100ad 100644
--- a/packages/convert/app/components/ResizeUi.tsx
+++ b/packages/convert/app/components/ResizeUi.tsx
@@ -1,9 +1,9 @@
-import {Dimensions} from '@remotion/media-parser';
-import {ResizeOperation} from '@remotion/webcodecs';
+import type {Dimensions} from '@remotion/media-parser';
+import type {ResizeOperation} from '@remotion/webcodecs';
import React, {useCallback, useMemo} from 'react';
import {ResizeShortcuts} from './ResizeShortcuts';
import {getThumbnailDimensions, ResizeThumbnail} from './ResizeThumbnail';
-import {VideoThumbnailRef} from './VideoThumbnail';
+import type {VideoThumbnailRef} from './VideoThumbnail';
const NumberInput: React.FC<{
readonly value: number;
diff --git a/packages/convert/app/components/SourceLabel.tsx b/packages/convert/app/components/SourceLabel.tsx
index c76877a9bf..69b7a00570 100644
--- a/packages/convert/app/components/SourceLabel.tsx
+++ b/packages/convert/app/components/SourceLabel.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
export const SourceLabel: React.FC<{
readonly src: Source;
diff --git a/packages/convert/app/components/VideoCodecSelection.tsx b/packages/convert/app/components/VideoCodecSelection.tsx
index 6873bcf720..2fb9e8867b 100644
--- a/packages/convert/app/components/VideoCodecSelection.tsx
+++ b/packages/convert/app/components/VideoCodecSelection.tsx
@@ -1,5 +1,5 @@
-import {MediaParserVideoCodec} from '@remotion/media-parser';
-import {VideoOperation} from '@remotion/webcodecs';
+import type {MediaParserVideoCodec} from '@remotion/media-parser';
+import type {VideoOperation} from '@remotion/webcodecs';
import React from 'react';
import {getVideoOperationId} from '~/lib/operation-key';
import {
diff --git a/packages/convert/app/components/VideoOperationOption.tsx b/packages/convert/app/components/VideoOperationOption.tsx
index 0d117d7b47..15edf2e9e4 100644
--- a/packages/convert/app/components/VideoOperationOption.tsx
+++ b/packages/convert/app/components/VideoOperationOption.tsx
@@ -1,5 +1,5 @@
-import {MediaParserVideoCodec} from '@remotion/media-parser';
-import {VideoOperation} from '@remotion/webcodecs';
+import type {MediaParserVideoCodec} from '@remotion/media-parser';
+import type {VideoOperation} from '@remotion/webcodecs';
import {renderHumanReadableVideoCodec} from '~/lib/render-codec-label';
export const VideoOperationOption: React.FC<{
@@ -14,6 +14,7 @@ export const VideoOperationOption: React.FC<{
if (!currentVideoCodec) {
throw new Error('No current video codec');
}
+
return `Copy ${renderHumanReadableVideoCodec(currentVideoCodec)} without re-encoding`;
}
diff --git a/packages/convert/app/components/VideoThumbnail.tsx b/packages/convert/app/components/VideoThumbnail.tsx
index ed9d609b13..a577b38498 100644
--- a/packages/convert/app/components/VideoThumbnail.tsx
+++ b/packages/convert/app/components/VideoThumbnail.tsx
@@ -52,6 +52,7 @@ const VideoThumbnailRefForward: React.ForwardRefRenderFunction<
if (!canvas) {
return;
}
+
canvas.width = w;
const twoDContext = canvas.getContext('2d');
if (!twoDContext) {
@@ -82,6 +83,7 @@ const VideoThumbnailRefForward: React.ForwardRefRenderFunction<
if (!canvas) {
throw new Error('Canvas not ready');
}
+
return createImageBitmap(canvas);
},
addOnChangeListener(listener) {
diff --git a/packages/convert/app/components/flip-video.ts b/packages/convert/app/components/flip-video.ts
index bf2093f9cf..9c663ac915 100644
--- a/packages/convert/app/components/flip-video.ts
+++ b/packages/convert/app/components/flip-video.ts
@@ -16,6 +16,7 @@ export const flipVideoFrame = ({
if (!ctx) {
throw new Error('Could not get 2d context');
}
+
canvas.width = frame.displayWidth;
canvas.height = frame.displayHeight;
ctx.translate(
diff --git a/packages/convert/app/components/get-brightness-of-frame.ts b/packages/convert/app/components/get-brightness-of-frame.ts
index 8e92eb751c..97c94c372c 100644
--- a/packages/convert/app/components/get-brightness-of-frame.ts
+++ b/packages/convert/app/components/get-brightness-of-frame.ts
@@ -7,6 +7,7 @@ export const getBrightnessOfFrame = async (frame: VideoFrame) => {
if (context === null) {
throw new Error('Could not get 2d context');
}
+
context.drawImage(bitmap, 0, 0);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height);
let sum = 0;
@@ -16,5 +17,6 @@ export const getBrightnessOfFrame = async (frame: VideoFrame) => {
imageData.data[i + 1] * 0.587 +
imageData.data[i + 2] * 0.114;
}
+
return sum / (imageData.data.length / 4) / 255;
};
diff --git a/packages/convert/app/components/get-supported-configs.tsx b/packages/convert/app/components/get-supported-configs.tsx
index 660ce9fefd..a7db02ef39 100644
--- a/packages/convert/app/components/get-supported-configs.tsx
+++ b/packages/convert/app/components/get-supported-configs.tsx
@@ -1,17 +1,18 @@
-import {ParseMediaContainer, TracksField} from '@remotion/media-parser';
-import {
+import type {ParseMediaContainer, TracksField} from '@remotion/media-parser';
+import type {
AudioOperation,
+ ConvertMediaContainer,
+ ResizeOperation,
+ VideoOperation} from '@remotion/webcodecs';
+import {
canCopyAudioTrack,
canCopyVideoTrack,
canReencodeAudioTrack,
canReencodeVideoTrack,
- ConvertMediaContainer,
getAvailableAudioCodecs,
- getAvailableVideoCodecs,
- ResizeOperation,
- VideoOperation,
+ getAvailableVideoCodecs
} from '@remotion/webcodecs';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
export type VideoTrackOption = {
trackId: number;
@@ -32,27 +33,35 @@ const shouldPrioritizeVideoCopyOverReencode = (routeAction: RouteAction) => {
if (routeAction.type === 'mirror-format') {
return false;
}
+
if (routeAction.type === 'rotate-format') {
return false;
}
+
if (routeAction.type === 'generic-mirror') {
return false;
}
+
if (routeAction.type === 'generic-rotate') {
return false;
}
+
if (routeAction.type === 'convert') {
return true;
}
+
if (routeAction.type === 'generic-convert') {
return true;
}
+
if (routeAction.type === 'generic-probe') {
return true;
}
+
if (routeAction.type === 'generic-resize') {
return false;
}
+
if (routeAction.type === 'resize-format') {
return false;
}
@@ -98,6 +107,7 @@ export const getSupportedConfigs = async ({
type: 'copy',
});
}
+
for (const outputCodec of availableVideoCodecs) {
const canReencode = await canReencodeVideoTrack({
videoCodec: outputCodec,
@@ -111,11 +121,13 @@ export const getSupportedConfigs = async ({
});
}
}
+
if (canCopy && !prioritizeCopyOverReencode) {
options.push({
type: 'copy',
});
}
+
options.push({
type: 'drop',
});
@@ -156,6 +168,7 @@ export const getSupportedConfigs = async ({
});
}
}
+
audioTrackOperations.push({
type: 'drop',
});
diff --git a/packages/convert/app/components/guess-codec-from-source.ts b/packages/convert/app/components/guess-codec-from-source.ts
index 46252e9a7b..58461b68cd 100644
--- a/packages/convert/app/components/guess-codec-from-source.ts
+++ b/packages/convert/app/components/guess-codec-from-source.ts
@@ -1,7 +1,7 @@
-import {ParseMediaContainer} from '@remotion/media-parser';
-import {ConvertMediaContainer} from '@remotion/webcodecs';
-import {Source} from '~/lib/convert-state';
-import {RouteAction} from '~/seo';
+import type {ParseMediaContainer} from '@remotion/media-parser';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {Source} from '~/lib/convert-state';
+import type {RouteAction} from '~/seo';
const guessFromExtension = (src: string): ParseMediaContainer => {
if (src.endsWith('.webm')) {
@@ -41,27 +41,35 @@ const shouldKeepSameContainerByDefault = (action: RouteAction) => {
if (action.type === 'generic-convert') {
return false;
}
+
if (action.type === 'generic-mirror') {
return true;
}
+
if (action.type === 'generic-rotate') {
return true;
}
+
if (action.type === 'mirror-format') {
return true;
}
+
if (action.type === 'rotate-format') {
return true;
}
+
if (action.type === 'convert') {
return false;
}
+
if (action.type === 'generic-probe') {
return false;
}
+
if (action.type === 'resize-format') {
return true;
}
+
if (action.type === 'generic-resize') {
return true;
}
diff --git a/packages/convert/app/components/icons/clone.tsx b/packages/convert/app/components/icons/clone.tsx
index 2a1d1712f9..ae13975bee 100644
--- a/packages/convert/app/components/icons/clone.tsx
+++ b/packages/convert/app/components/icons/clone.tsx
@@ -1,4 +1,4 @@
-import {SVGProps} from 'react';
+import type {SVGProps} from 'react';
export const CloneIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => (
<svg {...props} viewBox="0 0 512 512">
diff --git a/packages/convert/app/components/icons/undo.tsx b/packages/convert/app/components/icons/undo.tsx
index 0bcaa60248..c6488d15f5 100644
--- a/packages/convert/app/components/icons/undo.tsx
+++ b/packages/convert/app/components/icons/undo.tsx
@@ -1,4 +1,5 @@
-import React, {SVGProps} from 'react';
+import type {SVGProps} from 'react';
+import React from 'react';
export const UndoIcon: React.FC<SVGProps<SVGSVGElement>> = (props) => (
<svg viewBox="0 0 512 512" {...props}>
diff --git a/packages/convert/app/components/tests/RunAll.tsx b/packages/convert/app/components/tests/RunAll.tsx
index abad9291e0..ee83da5f53 100644
--- a/packages/convert/app/components/tests/RunAll.tsx
+++ b/packages/convert/app/components/tests/RunAll.tsx
@@ -1,5 +1,5 @@
import {useCallback} from 'react';
-import {TestStructure} from '~/tests/test-structure';
+import type {TestStructure} from '~/tests/test-structure';
import {Button} from '../ui/button';
export const RunAll: React.FC<{
diff --git a/packages/convert/app/components/tests/TestStateDisplay.tsx b/packages/convert/app/components/tests/TestStateDisplay.tsx
index cd784048cc..d7676b76eb 100644
--- a/packages/convert/app/components/tests/TestStateDisplay.tsx
+++ b/packages/convert/app/components/tests/TestStateDisplay.tsx
@@ -1,5 +1,5 @@
import {formatSeconds} from '~/lib/format-seconds';
-import {TestState} from '~/tests/test-structure';
+import type {TestState} from '~/tests/test-structure';
import {ErrorState} from '../ErrorState';
export const TestStateDisplay: React.FC<{
@@ -12,6 +12,7 @@ export const TestStateDisplay: React.FC<{
</div>
);
}
+
if (testState.type === 'failed') {
return (
<div className="text-red-500 text-sm w-full font-bold overflow-x-hidden">
@@ -28,7 +29,9 @@ export const TestStateDisplay: React.FC<{
</div>
);
}
+
return <div className="text-sm">Running...</div>;
}
+
return null;
};
diff --git a/packages/convert/app/components/ui/button.tsx b/packages/convert/app/components/ui/button.tsx
index 260a300e76..2fcfa697ee 100644
--- a/packages/convert/app/components/ui/button.tsx
+++ b/packages/convert/app/components/ui/button.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/require-default-props */
import {Slot} from '@radix-ui/react-slot';
import {cva, type VariantProps} from 'class-variance-authority';
import * as React from 'react';
diff --git a/packages/convert/app/components/use-probe.ts b/packages/convert/app/components/use-probe.ts
index c089270914..b1e5f6b48a 100644
--- a/packages/convert/app/components/use-probe.ts
+++ b/packages/convert/app/components/use-probe.ts
@@ -1,4 +1,4 @@
-import {
+import type {
Dimensions,
LogLevel,
MediaParserAudioCodec,
@@ -6,15 +6,15 @@ import {
MediaParserLocation,
MediaParserVideoCodec,
MetadataEntry,
- parseMedia,
ParseMediaContainer,
ParseMediaOnProgress,
TracksField,
} from '@remotion/media-parser';
+import {parseMedia} from '@remotion/media-parser';
import {fetchReader} from '@remotion/media-parser/fetch';
import {webFileReader} from '@remotion/media-parser/web-file';
import {useCallback, useEffect, useMemo, useState} from 'react';
-import {Source} from '~/lib/convert-state';
+import type {Source} from '~/lib/convert-state';
export type ProbeResult = ReturnType<typeof useProbe>;
@@ -63,8 +63,8 @@ export const useProbe = ({
onParseProgress: onProgress,
reader: src.type === 'file' ? webFileReader : fetchReader,
signal: controller.signal,
- onMetadata: (metadata) => {
- setMetadata(metadata);
+ onMetadata: (newMetadata) => {
+ setMetadata(newMetadata);
},
onContainer(c) {
setContainer(c);
@@ -81,8 +81,8 @@ export const useProbe = ({
onDurationInSeconds: (d) => {
setDurationInSeconds(d);
},
- onRotation(rotation) {
- setRotation(rotation);
+ onRotation(newRotation) {
+ setRotation(newRotation);
},
onName: (n) => {
setName(n);
@@ -114,9 +114,11 @@ export const useProbe = ({
if ((err as Error).stack?.includes('Cancelled')) {
return;
}
+
if ((err as Error).stack?.toLowerCase()?.includes('aborted')) {
return;
}
+
// firefox
if ((err as Error).message?.toLowerCase()?.includes('aborted')) {
return;
diff --git a/packages/convert/app/components/use-supported-configs.ts b/packages/convert/app/components/use-supported-configs.ts
index 7b36d7ff0a..cf07be4684 100644
--- a/packages/convert/app/components/use-supported-configs.ts
+++ b/packages/convert/app/components/use-supported-configs.ts
@@ -1,8 +1,9 @@
-import {ParseMediaContainer, TracksField} from '@remotion/media-parser';
-import {ConvertMediaContainer, ResizeOperation} from '@remotion/webcodecs';
+import type {ParseMediaContainer, TracksField} from '@remotion/media-parser';
+import type {ConvertMediaContainer, ResizeOperation} from '@remotion/webcodecs';
import {useEffect, useState} from 'react';
-import {RouteAction} from '~/seo';
-import {getSupportedConfigs, SupportedConfigs} from './get-supported-configs';
+import type {RouteAction} from '~/seo';
+import type { SupportedConfigs} from './get-supported-configs';
+import {getSupportedConfigs} from './get-supported-configs';
export const useSupportedConfigs = ({
outputContainer,
diff --git a/packages/convert/app/entry.client.tsx b/packages/convert/app/entry.client.tsx
index baabe461ef..b2370de060 100644
--- a/packages/convert/app/entry.client.tsx
+++ b/packages/convert/app/entry.client.tsx
@@ -8,12 +8,14 @@ const registerServiceWorker = () => {
navigator.serviceWorker
.register('/convert-service-worker.js', {})
.then((registration) => {
+ // eslint-disable-next-line no-console
console.log(
'Service worker registered, site is now available offline',
);
registration.update();
})
.catch((error) => {
+ // eslint-disable-next-line no-console
console.log('SW registration failed:', error);
});
});
diff --git a/packages/convert/app/lib/can-rotate-or-mirror.ts b/packages/convert/app/lib/can-rotate-or-mirror.ts
index b6f8b14546..7d2c7105f9 100644
--- a/packages/convert/app/lib/can-rotate-or-mirror.ts
+++ b/packages/convert/app/lib/can-rotate-or-mirror.ts
@@ -1,4 +1,4 @@
-import {SupportedConfigs} from '~/components/get-supported-configs';
+import type {SupportedConfigs} from '~/components/get-supported-configs';
import {isReencoding} from './is-reencoding';
export const canRotateOrMirror = ({
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 1aa6e512cb..4c11d797e5 100644
--- a/packages/convert/app/lib/can-use-output-as-input.ts
+++ b/packages/convert/app/lib/can-use-output-as-input.ts
@@ -1,12 +1,14 @@
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
export const canUseOutputAsInput = (container: ConvertMediaContainer) => {
if (container === 'wav') {
return false;
}
+
if (container === 'mp4') {
return true;
}
+
if (container === 'webm') {
return true;
}
diff --git a/packages/convert/app/lib/convert-state.ts b/packages/convert/app/lib/convert-state.ts
index 7775915198..c700b476c3 100644
--- a/packages/convert/app/lib/convert-state.ts
+++ b/packages/convert/app/lib/convert-state.ts
@@ -1,4 +1,4 @@
-import {ConvertMediaProgress} from '@remotion/webcodecs';
+import type {ConvertMediaProgress} from '@remotion/webcodecs';
export type Source =
| {
diff --git a/packages/convert/app/lib/default-ui.ts b/packages/convert/app/lib/default-ui.ts
index f8d4fcca56..30b0b49540 100644
--- a/packages/convert/app/lib/default-ui.ts
+++ b/packages/convert/app/lib/default-ui.ts
@@ -1,4 +1,4 @@
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
export type RotateOrMirrorState = 'rotate' | 'mirror' | null;
@@ -8,6 +8,7 @@ export const defaultRotateOrMirorState = (
if (action.type === 'convert') {
return null;
}
+
if (action.type === 'generic-probe') {
return null;
}
@@ -31,9 +32,11 @@ export const defaultRotateOrMirorState = (
if (action.type === 'generic-mirror') {
return 'mirror';
}
+
if (action.type === 'generic-resize') {
return null;
}
+
if (action.type === 'resize-format') {
return null;
}
@@ -47,6 +50,7 @@ export const isConvertEnabledByDefault = (action: RouteAction) => {
if (action.type === 'convert') {
return true;
}
+
if (action.type === 'generic-probe') {
return true;
}
@@ -97,6 +101,7 @@ export const getOrderOfSections = (
convert: 3,
};
}
+
if (action.type === 'convert' || action.type === 'generic-convert') {
return {
convert: 0,
@@ -105,6 +110,7 @@ export const getOrderOfSections = (
mirror: 3,
};
}
+
if (action.type === 'generic-probe') {
return {
convert: 0,
@@ -113,6 +119,7 @@ export const getOrderOfSections = (
mirror: 3,
};
}
+
if (action.type === 'generic-mirror' || action.type === 'mirror-format') {
return {
mirror: 0,
@@ -121,6 +128,7 @@ export const getOrderOfSections = (
convert: 3,
};
}
+
if (action.type === 'generic-resize' || action.type === 'resize-format') {
return {
resize: 0,
diff --git a/packages/convert/app/lib/generate-new-name.ts b/packages/convert/app/lib/generate-new-name.ts
index 0c151b72a5..b46fc9da85 100644
--- a/packages/convert/app/lib/generate-new-name.ts
+++ b/packages/convert/app/lib/generate-new-name.ts
@@ -1,4 +1,4 @@
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
export const getNewName = (
name: string,
diff --git a/packages/convert/app/lib/get-audio-video-config-index.ts b/packages/convert/app/lib/get-audio-video-config-index.ts
index b1348e9020..90b78b9ed8 100644
--- a/packages/convert/app/lib/get-audio-video-config-index.ts
+++ b/packages/convert/app/lib/get-audio-video-config-index.ts
@@ -1,4 +1,4 @@
-import {AudioOperation, VideoOperation} from '@remotion/webcodecs';
+import type {AudioOperation, VideoOperation} from '@remotion/webcodecs';
import {getAudioOperationId, getVideoOperationId} from './operation-key';
export const getActualAudioConfigIndex = ({
diff --git a/packages/convert/app/lib/get-initial-resize-suggestion.ts b/packages/convert/app/lib/get-initial-resize-suggestion.ts
index 8e95edb187..4fc30a56fd 100644
--- a/packages/convert/app/lib/get-initial-resize-suggestion.ts
+++ b/packages/convert/app/lib/get-initial-resize-suggestion.ts
@@ -1,5 +1,5 @@
-import {Dimensions} from '@remotion/media-parser';
-import {ResizeOperation} from '@remotion/webcodecs';
+import type {Dimensions} from '@remotion/media-parser';
+import type {ResizeOperation} from '@remotion/webcodecs';
export const getInitialResizeSuggestion = (
rotatedDimensions: Dimensions | null,
@@ -10,6 +10,7 @@ export const getInitialResizeSuggestion = (
scale: 0.5,
};
}
+
const smallerSide = Math.min(
rotatedDimensions.width,
rotatedDimensions.height,
diff --git a/packages/convert/app/lib/is-narrow.ts b/packages/convert/app/lib/is-narrow.ts
index cd6269350e..82ad23b774 100644
--- a/packages/convert/app/lib/is-narrow.ts
+++ b/packages/convert/app/lib/is-narrow.ts
@@ -13,6 +13,7 @@ export function useIsNarrow() {
const handler = (event: MediaQueryListEvent) => {
return setMatches(event.matches);
};
+
mediaQuery.addEventListener('change', handler);
return () => mediaQuery.removeEventListener('change', handler);
}, []);
diff --git a/packages/convert/app/lib/is-reencoding.ts b/packages/convert/app/lib/is-reencoding.ts
index 0672d2cdc0..0145d847cd 100644
--- a/packages/convert/app/lib/is-reencoding.ts
+++ b/packages/convert/app/lib/is-reencoding.ts
@@ -1,4 +1,4 @@
-import {SupportedConfigs} from '~/components/get-supported-configs';
+import type {SupportedConfigs} from '~/components/get-supported-configs';
import {
getActualAudioConfigIndex,
getActualVideoOperation,
diff --git a/packages/convert/app/lib/is-submit-enabled.ts b/packages/convert/app/lib/is-submit-enabled.ts
index 6a992367cf..ce5ac963a8 100644
--- a/packages/convert/app/lib/is-submit-enabled.ts
+++ b/packages/convert/app/lib/is-submit-enabled.ts
@@ -1,6 +1,6 @@
-import {SupportedConfigs} from '~/components/get-supported-configs';
+import type {SupportedConfigs} from '~/components/get-supported-configs';
import {canRotateOrMirror} from './can-rotate-or-mirror';
-import {RotateOrMirrorState} from './default-ui';
+import type {RotateOrMirrorState} from './default-ui';
import {isDroppingEverything} from './is-reencoding';
export const isSubmitDisabled = ({
diff --git a/packages/convert/app/lib/operation-key.ts b/packages/convert/app/lib/operation-key.ts
index b27a48bf76..8ee5a81b62 100644
--- a/packages/convert/app/lib/operation-key.ts
+++ b/packages/convert/app/lib/operation-key.ts
@@ -1,4 +1,4 @@
-import {AudioOperation, VideoOperation} from '@remotion/webcodecs';
+import type {AudioOperation, VideoOperation} from '@remotion/webcodecs';
export const getVideoOperationId = (operation: VideoOperation) => {
if (operation.type === 'copy') {
diff --git a/packages/convert/app/lib/render-codec-label.ts b/packages/convert/app/lib/render-codec-label.ts
index 220196f5ed..3609ff944d 100644
--- a/packages/convert/app/lib/render-codec-label.ts
+++ b/packages/convert/app/lib/render-codec-label.ts
@@ -1,9 +1,9 @@
-import {
+import type {
MediaParserAudioCodec,
MediaParserVideoCodec,
ParseMediaContainer,
} from '@remotion/media-parser';
-import {
+import type {
ConvertMediaAudioCodec,
ConvertMediaContainer,
} from '@remotion/webcodecs';
diff --git a/packages/convert/app/lib/render-metadata-label.ts b/packages/convert/app/lib/render-metadata-label.ts
index 8fc3b10131..3aaf2001a7 100644
--- a/packages/convert/app/lib/render-metadata-label.ts
+++ b/packages/convert/app/lib/render-metadata-label.ts
@@ -1,4 +1,4 @@
-import {MediaParserLocation, MetadataEntry} from '@remotion/media-parser';
+import type {MediaParserLocation, MetadataEntry} from '@remotion/media-parser';
/* eslint-disable complexity */
export const renderMetadataLabel = (key: string) => {
@@ -239,11 +239,14 @@ export const renderMetadataValue = ({
if (location) {
return displayLocationData(location);
}
+
return String(value);
}
+
if (key === 'com.apple.quicktime.creationdate') {
return formatDateString(String(value));
}
+
if (key === 'com.apple.quicktime.camera.focal_length.35mm_equivalent') {
return String(value) + 'mm';
}
diff --git a/packages/convert/app/lib/title-context.tsx b/packages/convert/app/lib/title-context.tsx
index 9feeb3a5f0..e3d8f3629f 100644
--- a/packages/convert/app/lib/title-context.tsx
+++ b/packages/convert/app/lib/title-context.tsx
@@ -1,6 +1,7 @@
import React, {useEffect, useLayoutEffect, useMemo} from 'react';
-import {VideoThumbnailRef} from '~/components/VideoThumbnail';
-import {getPageTitle, RouteAction} from '~/seo';
+import type {VideoThumbnailRef} from '~/components/VideoThumbnail';
+import type {RouteAction} from '~/seo';
+import {getPageTitle} from '~/seo';
import {DEFAULT_FAVICON} from './default-favicon';
import {useThumbnailAsFavicon} from './use-thumbnail-as-favicon';
@@ -133,18 +134,19 @@ export const useCopyThumbnailToFavicon = (
});
useEffect(() => {
- const favicon = document.querySelector('link[rel="icon"]');
- if (!favicon) {
+ const newFavicon = document.querySelector('link[rel="icon"]');
+ if (!newFavicon) {
throw new Error('No favicon found');
}
if (thumbnail) {
- favicon.setAttribute('href', thumbnail);
+ newFavicon.setAttribute('href', thumbnail);
} else {
- favicon.setAttribute('href', DEFAULT_FAVICON);
+ newFavicon.setAttribute('href', DEFAULT_FAVICON);
}
+
return () => {
- favicon.setAttribute('href', DEFAULT_FAVICON);
+ newFavicon.setAttribute('href', DEFAULT_FAVICON);
};
}, [thumbnail]);
};
diff --git a/packages/convert/app/lib/use-thumbnail-as-favicon.ts b/packages/convert/app/lib/use-thumbnail-as-favicon.ts
index e4803bb3cc..7338c3bbad 100644
--- a/packages/convert/app/lib/use-thumbnail-as-favicon.ts
+++ b/packages/convert/app/lib/use-thumbnail-as-favicon.ts
@@ -1,5 +1,5 @@
import {useCallback, useEffect, useState} from 'react';
-import {VideoThumbnailRef} from '~/components/VideoThumbnail';
+import type {VideoThumbnailRef} from '~/components/VideoThumbnail';
const blobToDataURL = (blob: Blob) => {
return new Promise<string>((resolve, reject) => {
@@ -28,6 +28,7 @@ export const useThumbnailAsFavicon = ({
if (!sourceRef.current) {
return;
}
+
if (!sourceRef.current.hasBitmap) {
return;
}
diff --git a/packages/convert/app/lib/use-thumbnail-copy.ts b/packages/convert/app/lib/use-thumbnail-copy.ts
index 4cf8c7295e..8628988018 100644
--- a/packages/convert/app/lib/use-thumbnail-copy.ts
+++ b/packages/convert/app/lib/use-thumbnail-copy.ts
@@ -1,6 +1,6 @@
-import {Dimensions} from '@remotion/media-parser';
+import type {Dimensions} from '@remotion/media-parser';
import {useCallback, useEffect, useState} from 'react';
-import {VideoThumbnailRef} from '~/components/VideoThumbnail';
+import type {VideoThumbnailRef} from '~/components/VideoThumbnail';
export const useThumbnailCopy = ({
sourceRef,
diff --git a/packages/convert/app/lib/use-thumbnail.ts b/packages/convert/app/lib/use-thumbnail.ts
index 4046609169..66a2a5efab 100644
--- a/packages/convert/app/lib/use-thumbnail.ts
+++ b/packages/convert/app/lib/use-thumbnail.ts
@@ -1,8 +1,9 @@
-import {LogLevel, parseMedia} from '@remotion/media-parser';
+import type {LogLevel} from '@remotion/media-parser';
+import {parseMedia} from '@remotion/media-parser';
import {fetchReader} from '@remotion/media-parser/fetch';
import {webFileReader} from '@remotion/media-parser/web-file';
import {useCallback, useEffect, useMemo, useState} from 'react';
-import {Source} from './convert-state';
+import type {Source} from './convert-state';
export const useThumbnail = ({
src,
@@ -48,6 +49,7 @@ export const useThumbnail = ({
onDone();
return;
}
+
frames++;
onVideoThumbnail(frame).then(() => {
@@ -76,20 +78,23 @@ export const useThumbnail = ({
decoder.decode(new EncodedVideoChunk(sample));
};
},
- }).catch((err) => {
- if ((err as Error).stack?.includes('Cancelled')) {
+ }).catch((err2) => {
+ if ((err2 as Error).stack?.includes('Cancelled')) {
return;
}
- if ((err as Error).stack?.toLowerCase()?.includes('aborted')) {
+
+ if ((err2 as Error).stack?.toLowerCase()?.includes('aborted')) {
return;
}
+
// firefox
- if ((err as Error).message?.toLowerCase()?.includes('aborted')) {
+ if ((err2 as Error).message?.toLowerCase()?.includes('aborted')) {
return;
}
- console.log(err);
- setError(err as Error);
+ // eslint-disable-next-line no-console
+ console.log(err2);
+ setError(err2 as Error);
});
return abortController;
diff --git a/packages/convert/app/routes/_index.tsx b/packages/convert/app/routes/_index.tsx
index bf58e9901f..27353d205b 100644
--- a/packages/convert/app/routes/_index.tsx
+++ b/packages/convert/app/routes/_index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-convert',
diff --git a/packages/convert/app/routes/convert.$action.tsx b/packages/convert/app/routes/convert.$action.tsx
index f059ec0bbc..25fe3b4505 100644
--- a/packages/convert/app/routes/convert.$action.tsx
+++ b/packages/convert/app/routes/convert.$action.tsx
@@ -1,7 +1,8 @@
import {useParams} from '@remix-run/react';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import {parseConvertRouteAction, RouteAction} from '~/seo';
+import type { RouteAction} from '~/seo';
+import {parseConvertRouteAction} from '~/seo';
const Index = () => {
const action = useParams().action as string;
diff --git a/packages/convert/app/routes/convert._index.tsx b/packages/convert/app/routes/convert._index.tsx
index bf58e9901f..27353d205b 100644
--- a/packages/convert/app/routes/convert._index.tsx
+++ b/packages/convert/app/routes/convert._index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-convert',
diff --git a/packages/convert/app/routes/mirror.$format.tsx b/packages/convert/app/routes/mirror.$format.tsx
index a2ad48c08e..15071de4c6 100644
--- a/packages/convert/app/routes/mirror.$format.tsx
+++ b/packages/convert/app/routes/mirror.$format.tsx
@@ -1,8 +1,8 @@
import {useParams} from '@remix-run/react';
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const Index = () => {
const format = useParams().format as ConvertMediaContainer;
diff --git a/packages/convert/app/routes/mirror._index.tsx b/packages/convert/app/routes/mirror._index.tsx
index 8aa87b3e8e..da5b96e8f2 100644
--- a/packages/convert/app/routes/mirror._index.tsx
+++ b/packages/convert/app/routes/mirror._index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-mirror',
diff --git a/packages/convert/app/routes/probe._index.tsx b/packages/convert/app/routes/probe._index.tsx
index a2778db652..d56422ce69 100644
--- a/packages/convert/app/routes/probe._index.tsx
+++ b/packages/convert/app/routes/probe._index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-probe',
diff --git a/packages/convert/app/routes/resize.$format.tsx b/packages/convert/app/routes/resize.$format.tsx
index 6d0e0b1973..75a57c8332 100644
--- a/packages/convert/app/routes/resize.$format.tsx
+++ b/packages/convert/app/routes/resize.$format.tsx
@@ -1,8 +1,8 @@
import {useParams} from '@remix-run/react';
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const Index = () => {
const format = useParams().format as ConvertMediaContainer;
diff --git a/packages/convert/app/routes/resize._index.tsx b/packages/convert/app/routes/resize._index.tsx
index d07bef1b5e..f30602511d 100644
--- a/packages/convert/app/routes/resize._index.tsx
+++ b/packages/convert/app/routes/resize._index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-resize',
diff --git a/packages/convert/app/routes/rotate.$format.tsx b/packages/convert/app/routes/rotate.$format.tsx
index 1e91ff4ce5..5ad3868a33 100644
--- a/packages/convert/app/routes/rotate.$format.tsx
+++ b/packages/convert/app/routes/rotate.$format.tsx
@@ -1,8 +1,8 @@
import {useParams} from '@remix-run/react';
-import {ConvertMediaContainer} from '@remotion/webcodecs';
+import type {ConvertMediaContainer} from '@remotion/webcodecs';
import {useMemo} from 'react';
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const Index = () => {
const format = useParams().format as ConvertMediaContainer;
diff --git a/packages/convert/app/routes/rotate._index.tsx b/packages/convert/app/routes/rotate._index.tsx
index c710eaa298..a13826f136 100644
--- a/packages/convert/app/routes/rotate._index.tsx
+++ b/packages/convert/app/routes/rotate._index.tsx
@@ -1,5 +1,5 @@
import {Main} from '~/components/Main';
-import {RouteAction} from '~/seo';
+import type {RouteAction} from '~/seo';
const action: RouteAction = {
type: 'generic-rotate',
diff --git a/packages/convert/app/seo.ts b/packages/convert/app/seo.ts
index 5594b86a56..38a8ddb37a 100644
--- a/packages/convert/app/seo.ts
+++ b/packages/convert/app/seo.ts
@@ -1,6 +1,7 @@
-import {ParseMediaContainer} from '@remotion/media-parser';
+import type {ParseMediaContainer} from '@remotion/media-parser';
+import type {
+ ConvertMediaContainer} from '@remotion/webcodecs';
import {
- ConvertMediaContainer,
getAvailableContainers,
} from '@remotion/webcodecs';
import {renderHumanReadableContainer} from './lib/render-codec-label';
diff --git a/packages/convert/app/service-worker.ts b/packages/convert/app/service-worker.ts
index 31ab32ce92..37ba061836 100644
--- a/packages/convert/app/service-worker.ts
+++ b/packages/convert/app/service-worker.ts
@@ -77,6 +77,7 @@ self.addEventListener('fetch', (event) => {
return cachedResponse;
}
+ // eslint-disable-next-line no-console
console.log(error);
return new Response('You are offline', {
status: 408,
diff --git a/packages/convert/app/tests/TestComponent.tsx b/packages/convert/app/tests/TestComponent.tsx
index c002d5817c..c149e85350 100644
--- a/packages/convert/app/tests/TestComponent.tsx
+++ b/packages/convert/app/tests/TestComponent.tsx
@@ -2,7 +2,8 @@ import {Link} from '@remix-run/react';
import React from 'react';
import {TestStateDisplay} from '~/components/tests/TestStateDisplay';
import {Button} from '~/components/ui/button';
-import {TestStructure, useTest} from './test-structure';
+import type {TestStructure} from './test-structure';
+import { useTest} from './test-structure';
export const TestComponent: React.FC<{
readonly test: TestStructure;
diff --git a/packages/convert/app/tests/test-list.tsx b/packages/convert/app/tests/test-list.tsx
index e8983314c7..780ea02e4a 100644
--- a/packages/convert/app/tests/test-list.tsx
+++ b/packages/convert/app/tests/test-list.tsx
@@ -1,11 +1,12 @@
import {convertMedia} from '@remotion/webcodecs';
import {flipVideoFrame} from '~/components/flip-video';
+import type {
+ TestStructure} from './test-structure';
import {
addTestWatcher,
allowSafariAudioDrop,
isSafari,
- makeProgressReporter,
- TestStructure,
+ makeProgressReporter
} from './test-structure';
const basicMp4ToWebM = (): TestStructure => {
@@ -118,6 +119,7 @@ const aviToMp4ReEncode = (): TestStructure => {
type: 'drop',
};
}
+
return {type: 'reencode', audioCodec: 'aac', bitrate: 128000};
},
});
diff --git a/packages/convert/app/tests/test-structure.ts b/packages/convert/app/tests/test-structure.ts
index b99ed1cc42..b8c024db04 100644
--- a/packages/convert/app/tests/test-structure.ts
+++ b/packages/convert/app/tests/test-structure.ts
@@ -1,9 +1,10 @@
-import {
+import type {
AudioOperation,
- canReencodeAudioTrack,
ConvertMediaOnAudioTrackHandler,
ConvertMediaOnProgress,
- ConvertMediaProgress,
+ ConvertMediaProgress} from '@remotion/webcodecs';
+import {
+ canReencodeAudioTrack
} from '@remotion/webcodecs';
import React from 'react';
@@ -136,5 +137,6 @@ export const allowSafariAudioDrop: ConvertMediaOnAudioTrackHandler = async ({
if (isSafari()) {
return Promise.resolve({type: 'drop'});
}
+
return Promise.resolve({type: 'fail'});
};
diff --git a/turbo.json b/turbo.json
index d272a4cf72..84bad15db4 100644
--- a/turbo.json
+++ b/turbo.json
@@ -2,7 +2,6 @@
"$schema": "https://turbo.build/schema.json",
"ui": "stream",
"globalEnv": ["ENABLE_EXPERIMENTAL_COREPACK"],
- "daemon": false,
"tasks": {
"formatting": {
"dependsOn": [],