🎥 Make videos programmatically with React
responsiveness
Jonny Burgercf31ec4c906f
diff --git a/packages/convert/app/components/Probe.tsx b/packages/convert/app/components/Probe.tsxindex 6c12d68545..9b8015936e 100644--- a/packages/convert/app/components/Probe.tsx+++ b/packages/convert/app/components/Probe.tsx@@ -8,6 +8,7 @@ import {parseMedia} from '@remotion/media-parser';import React, {useCallback, useEffect, useMemo, useState} from 'react';import {ContainerOverview} from './ContainerOverview';import {TrackSwitcher} from './TrackSwitcher';+import {VideoTrackOverview} from './VideoTrackOverview';import {Button} from './ui/button';import {Card,@@ -17,6 +18,7 @@ import {CardHeader,CardTitle,} from './ui/card';+import {ScrollArea} from './ui/scroll-area';import {Skeleton} from './ui/skeleton';export const Probe: React.FC<{@@ -108,38 +110,46 @@ export const Probe: React.FC<{}, [probeDetails, sortedTracks, trackDetails]);return (- <Card className={probeDetails ? 'w-[800px]' : 'w-[350px]'}>+ <Card+ className={+ (probeDetails ? 'w-[800px]' : 'w-[350px]') ++ ' h-5/6 max-h-[700px] flex flex-col max-w-[90vw]'+ }+ ><CardHeader><CardTitle title={name ?? undefined}>{name ? name : <Skeleton className="h-5 w-[220px] inline-block" />}</CardTitle><CardDescription>From URL</CardDescription></CardHeader>- <CardContent>- {sortedTracks.length && probeDetails ? (- <>- <TrackSwitcher- selectedTrack={trackDetails}- onTrack={(track) => {- setTrackDetails(track);- }}- sortedTracks={sortedTracks}- />- <div className="h-4" />- </>- ) : null}- {selectedTrack === null ? (- <ContainerOverview- container="MP4"- dimensions={dimensions ?? null}- videoCodec={videoCodec ?? null}- size={size ?? null}- durationInSeconds={durationInSeconds}- audioCodec={audioCodec ?? null}- fps={fps}+ {sortedTracks.length && probeDetails ? (+ <div className="pl-6 pr-6">+ <TrackSwitcher+ selectedTrack={trackDetails}+ onTrack={(track) => {+ setTrackDetails(track);+ }}+ sortedTracks={sortedTracks}/>- ) : null}- </CardContent>+ </div>+ ) : null}+ <ScrollArea className="flex-1">+ <CardContent className="flex flex-1 flex-col">+ {selectedTrack === null ? (+ <ContainerOverview+ container="MP4"+ dimensions={dimensions ?? null}+ videoCodec={videoCodec ?? null}+ size={size ?? null}+ durationInSeconds={durationInSeconds}+ audioCodec={audioCodec ?? null}+ fps={fps}+ />+ ) : selectedTrack.type === 'video' ? (+ <VideoTrackOverview track={selectedTrack} />+ ) : null}+ </CardContent>+ </ScrollArea><CardFooter className="flex justify-between"><div className="flex-1" /><Button disabled={!tracks} onClick={onClick} variant={'link'}>diff --git a/packages/convert/app/components/VideoTrackOverview.tsx b/packages/convert/app/components/VideoTrackOverview.tsxnew file mode 100644index 0000000000..adb4d1bdd1--- /dev/null+++ b/packages/convert/app/components/VideoTrackOverview.tsx@@ -0,0 +1,83 @@+import {Table, TableBody, TableCell, TableRow} from '@/components/ui/table';+import type {VideoTrack} from '@remotion/media-parser';+import React from 'react';++export const VideoTrackOverview: React.FC<{+ readonly track: VideoTrack;+}> = ({track}) => {+ return (+ <Table>+ <TableBody>+ <TableRow>+ <TableCell colSpan={3}>Type</TableCell>+ <TableCell className="text-right">Video</TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Codec</TableCell>+ <TableCell className="text-right">+ {track.codecWithoutConfig}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>WebCodecs Codec String</TableCell>+ <TableCell className="text-right">{track.codec}</TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Dimensions</TableCell>+ <TableCell className="text-right">+ {track.width}x{track.height}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Timescale</TableCell>+ <TableCell className="text-right">{track.timescale}</TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Sample Aspect Ratio</TableCell>+ <TableCell className="text-right">+ {track.sampleAspectRatio.numerator}:+ {track.sampleAspectRatio.denominator}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Rotation</TableCell>+ <TableCell className="text-right">{track.rotation}°</TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Native dimensions</TableCell>+ <TableCell className="text-right">+ {track.codedWidth}x{track.codedHeight}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Color Primaries</TableCell>+ <TableCell className="text-right">+ {track.color.primaries ?? 'N/A'}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Color Matrix</TableCell>+ <TableCell className="text-right">+ {track.color.matrixCoefficients ?? 'N/A'}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Color Transfer Characteristics</TableCell>+ <TableCell className="text-right">+ {track.color.transferCharacteristics ?? 'N/A'}+ </TableCell>+ </TableRow>+ <TableRow>+ <TableCell colSpan={3}>Color Full Range</TableCell>+ <TableCell className="text-right">+ {track.color.fullRange+ ? 'Yes'+ : track.color.fullRange === false+ ? 'No'+ : 'N/A'}+ </TableCell>+ </TableRow>+ </TableBody>+ </Table>+ );+};diff --git a/packages/convert/app/components/ui/scroll-area.tsx b/packages/convert/app/components/ui/scroll-area.tsxnew file mode 100644index 0000000000..c7372f260b--- /dev/null+++ b/packages/convert/app/components/ui/scroll-area.tsx@@ -0,0 +1,46 @@+import * as React from "react"+import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"++import { cn } from "~/lib/utils"++const ScrollArea = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.Root>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>+>(({ className, children, ...props }, ref) => (+ <ScrollAreaPrimitive.Root+ ref={ref}+ className={cn("relative overflow-hidden", className)}+ {...props}+ >+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">+ {children}+ </ScrollAreaPrimitive.Viewport>+ <ScrollBar />+ <ScrollAreaPrimitive.Corner />+ </ScrollAreaPrimitive.Root>+))+ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName++const ScrollBar = React.forwardRef<+ React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,+ React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>+>(({ className, orientation = "vertical", ...props }, ref) => (+ <ScrollAreaPrimitive.ScrollAreaScrollbar+ ref={ref}+ orientation={orientation}+ className={cn(+ "flex touch-none select-none transition-colors",+ orientation === "vertical" &&+ "h-full w-2.5 border-l border-l-transparent p-[1px]",+ orientation === "horizontal" &&+ "h-2.5 flex-col border-t border-t-transparent p-[1px]",+ className+ )}+ {...props}+ >+ <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />+ </ScrollAreaPrimitive.ScrollAreaScrollbar>+))+ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName++export { ScrollArea, ScrollBar }diff --git a/packages/convert/package.json b/packages/convert/package.jsonindex 684a8dde69..8c8bfb4a8a 100644--- a/packages/convert/package.json+++ b/packages/convert/package.json@@ -12,6 +12,7 @@},"dependencies": {"@radix-ui/react-label": "^2.1.0",+ "@radix-ui/react-scroll-area": "^1.1.0","@radix-ui/react-select": "^2.1.1","@radix-ui/react-separator": "^1.1.0","@radix-ui/react-slot": "^1.1.0",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex bdf73f6937..1c82af076f 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -333,6 +333,9 @@ importers:'@radix-ui/react-label':specifier: ^2.1.0version: 2.1.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-scroll-area':+ specifier: ^1.1.0+ version: 1.1.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])'@radix-ui/react-select':specifier: ^2.1.1version: 2.1.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])@@ -9106,6 +9109,27 @@ packages:react-dom: 18.3.1([email protected])dev: false+ /@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ resolution: {integrity: sha512-Gq6wuRN/asf9H/E/VzdKoUtT8GC9PQc9z40/vEr0VCJ4u5XvvhWIrSsCB6vD2/cH7ugTdSfYq9fLJCcM00acrQ==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@radix-ui/react-compose-refs': 1.1.0(@types/[email protected])([email protected])+ '@radix-ui/react-use-layout-effect': 1.1.0(@types/[email protected])([email protected])+ '@types/react': 18.3.1+ '@types/react-dom': 18.3.0+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ dev: false+/@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):resolution: {integrity: sha512-ZSpFm0/uHa8zTvKBDjLFWLo8dkr4MBsiDLz0g3gMUwqgLHz9rTaRRGYDgvZPtBJgYCBKXkS9fzmoySgr8CO6Cw==}peerDependencies:@@ -9126,6 +9150,34 @@ packages:react-dom: 18.3.1([email protected])dev: false+ /@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):+ resolution: {integrity: sha512-9ArIZ9HWhsrfqS765h+GZuLoxaRHD/j0ZWOWilsCvYTpYJp8XwCqNG7Dt9Nu/TItKOdgLGkOPCodQvDc+UMwYg==}+ peerDependencies:+ '@types/react': '*'+ '@types/react-dom': '*'+ react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc+ peerDependenciesMeta:+ '@types/react':+ optional: true+ '@types/react-dom':+ optional: true+ dependencies:+ '@radix-ui/number': 1.1.0+ '@radix-ui/primitive': 1.1.0+ '@radix-ui/react-compose-refs': 1.1.0(@types/[email protected])([email protected])+ '@radix-ui/react-context': 1.1.0(@types/[email protected])([email protected])+ '@radix-ui/react-direction': 1.1.0(@types/[email protected])([email protected])+ '@radix-ui/react-presence': 1.1.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-primitive': 2.0.0(@types/[email protected])(@types/[email protected])([email protected])([email protected])+ '@radix-ui/react-use-callback-ref': 1.1.0(@types/[email protected])([email protected])+ '@radix-ui/react-use-layout-effect': 1.1.0(@types/[email protected])([email protected])+ '@types/react': 18.3.1+ '@types/react-dom': 18.3.0+ react: 18.3.1+ react-dom: 18.3.1([email protected])+ dev: false+/@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):resolution: {integrity: sha512-8iRDfyLtzxlprOo9IicnzvpsO1wNCkuwzzCM+Z5Rb5tNOpCdMvcc2AkzX0Fz+Tz9v6NJ5B/7EEgyZveo4FBRfQ==}peerDependencies: