🎥 Make videos programmatically with React
rip out keyframe functionality
JonnyBurgera516e4b599ab
diff --git a/packages/convert/app/components/KeyframesInfo.tsx b/packages/convert/app/components/KeyframesInfo.tsxdeleted file mode 100644index f6e2a9f238..0000000000--- a/packages/convert/app/components/KeyframesInfo.tsx+++ /dev/null@@ -1,84 +0,0 @@-import type {MediaParserKeyframe} from '@remotion/media-parser';-import React from 'react';-import {TableCell, TableRow} from './ui/table';--const KeyframesChart: React.FC<{- readonly keyframes: MediaParserKeyframe[];- readonly durationInSeconds: number;-}> = ({keyframes, durationInSeconds}) => {- const averageEverySeconds = durationInSeconds / keyframes.length;-- return (- <div>- <div className="rounded-lg border-2 border-black h-10 p-[2px] px-2">- <div className="relative w-full h-full rounded ">- {keyframes.map((k) => {- const left =- (k.presentationTimeInSeconds / durationInSeconds) * 100;- return (- <div- key={k.presentationTimeInSeconds}- className="absolute h-full bg-black"- style={{- left: `${left}%`,- width: keyframes.length > 50 ? '1px' : '2px',- }}- />- );- })}- </div>- </div>- <div className="flex flex-row mt-1">- <div className="text-muted-foreground text-xs pl-2">0s</div>- <div className="flex-1" />- <div className="text-muted-foreground text-xs pr-2">- {durationInSeconds.toFixed(0)}s- </div>- </div>- <div className="text-muted-foreground text-xs mt-2">- On average, a keyframe appears every {averageEverySeconds.toFixed(2)}{' '}- seconds.- </div>- </div>- );-};--export const KeyframesInfo: React.FC<{- readonly keyframes: MediaParserKeyframe[];- readonly trackId: number;- readonly durationInSeconds: number | null;-}> = ({keyframes, trackId, durationInSeconds}) => {- const trackKeyframes = React.useMemo(- () => keyframes.filter((k) => k.trackId === trackId),- [keyframes, trackId],- );-- if (trackKeyframes.length === 0) {- return null;- }-- if (durationInSeconds === null) {- return null;- }-- return (- <>- <TableRow- style={{- borderBottom: 0,- }}- >- <TableCell className="font-brand">Keyframes</TableCell>- <TableCell className="text-right">{trackKeyframes.length}</TableCell>- </TableRow>- <TableRow>- <TableCell colSpan={2} className="pt-0">- <KeyframesChart- keyframes={trackKeyframes}- durationInSeconds={durationInSeconds}- />- </TableCell>- </TableRow>- </>- );-};diff --git a/packages/convert/app/components/VideoTrackOverview.tsx b/packages/convert/app/components/VideoTrackOverview.tsxindex 0d12f13f83..259add1d41 100644--- a/packages/convert/app/components/VideoTrackOverview.tsx+++ b/packages/convert/app/components/VideoTrackOverview.tsx@@ -1,15 +1,11 @@import {Table, TableBody, TableCell, TableRow} from '@/components/ui/table';-import type {MediaParserKeyframe} from '@remotion/media-parser';import type {InputVideoTrack} from 'mediabunny';import React, {useEffect, useState} from 'react';import {renderHumanReadableVideoCodec} from '~/lib/render-codec-label';-import {KeyframesInfo} from './KeyframesInfo';export const VideoTrackOverview: React.FC<{readonly track: InputVideoTrack;- readonly keyframes: MediaParserKeyframe[] | null;- readonly durationInSeconds: number | null;-}> = ({track, keyframes, durationInSeconds}) => {+}> = ({track}) => {const [colorSpace, setColorSpace] = useState<VideoColorSpaceInit | null>(null,);@@ -46,13 +42,6 @@ export const VideoTrackOverview: React.FC<{<TableCell className="font-brand">Timescale</TableCell><TableCell className="text-right">{track.timeResolution}</TableCell></TableRow>- {keyframes !== null ? (- <KeyframesInfo- durationInSeconds={durationInSeconds}- keyframes={keyframes}- trackId={track.id}- />- ) : null}<TableRow><TableCell className="font-brand">Rotation</TableCell><TableCell className="text-right">{track.rotation}°</TableCell>diff --git a/packages/convert/app/components/use-probe.ts b/packages/convert/app/components/use-probe.tsindex c7502b707d..0c2abcc0c5 100644--- a/packages/convert/app/components/use-probe.ts+++ b/packages/convert/app/components/use-probe.ts@@ -1,4 +1,3 @@-import type {MediaParserKeyframe} from '@remotion/media-parser';import type {InputAudioTrack,InputFormat,@@ -39,14 +38,12 @@ export const useProbe = ({src}: {src: Source}) => {const [metadata, setMetadata] = useState<MetadataTags | null>(null);const [tracks, setTracks] = useState<InputTrack[] | null>(null);const [container, setContainer] = useState<InputFormat | null>(null);- const [keyframes] = useState<MediaParserKeyframe[] | null>(null);const [sampleRate, setSampleRate] = useState<number | null>(null);const [done, setDone] = useState(false);const [error, setError] = useState<Error | null>(null);const getStart = useCallback(() => {- // TODO: Keyframes-+ // TODO: Reuse inputconst input = new Input({formats: ALL_FORMATS,source:@@ -123,7 +120,6 @@ export const useProbe = ({src}: {src: Source}) => {error,rotation,metadata,- keyframes,unrotatedDimensions,sampleRate,};@@ -142,7 +138,6 @@ export const useProbe = ({src}: {src: Source}) => {error,rotation,metadata,- keyframes,unrotatedDimensions,sampleRate,]);