Skip to content

Create professional demos and 3D mockups in seconds, directly in your browser

custom bitrate selection

Dhananjay Borseef2a12c6e662
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsx
index c22c53e..eebd72a 100644
--- a/app/[locale]/(editor)/editor/page.tsx
+++ b/app/[locale]/(editor)/editor/page.tsx
@@ -1041,7 +1041,7 @@ export default function Editor() {
const pathname = usePathname();
const router = useRouter();
- const handleExport = useCallback((quality: ExportQuality, fps?: number) => {
+ const handleExport = useCallback((quality: ExportQuality, fps?: number, bitrate?: number) => {
if (!EDITOR_WITHOUT_AUTH && !authUser) {
savePendingExport(quality);
router.replace({
@@ -1065,6 +1065,7 @@ export default function Editor() {
exportVideo({
quality,
fps,
+ bitrate,
videoBlob: videoBlob ?? undefined,
transparentBackground: selectedWallpaper === -1,
trim: trimRange.end > trimRange.start ? { start: trimRange.start, end: trimRange.end } : undefined,
diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx
index 48139f9..270a59a 100644
--- a/app/[locale]/layout.tsx
+++ b/app/[locale]/layout.tsx
@@ -191,6 +191,7 @@ export default async function LocaleLayout({
/>
</head>
<body
+ suppressHydrationWarning
className={`${inter.variable} ${roboto.variable} ${inter.className} antialiased`}
>
<SuppressScriptWarning />
diff --git a/app/components/ui/ExportDropdown.tsx b/app/components/ui/ExportDropdown.tsx
index 504581d..5d4da1f 100644
--- a/app/components/ui/ExportDropdown.tsx
+++ b/app/components/ui/ExportDropdown.tsx
@@ -4,7 +4,7 @@ import { Button } from "@/components/ui/button";
import { Icon } from "@iconify/react";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import type { ExportQuality } from "@/types";
-import { useState } from "react";
+import { useState, useMemo } from "react";
import { useTranslations } from "next-intl";
interface ExportProgress {
@@ -14,12 +14,13 @@ interface ExportProgress {
}
interface ExportDropdownProps {
- onExport: (quality: ExportQuality, fps?: number) => void;
+ onExport: (quality: ExportQuality, fps?: number, bitrate?: number) => void;
exportProgress: ExportProgress;
hasTransparentBackground?: boolean;
}
type VideoFormat = "mp4" | "webm" | "gif";
+type BitratePreset = "whatsapp" | "balanced" | "youtube" | "custom";
interface QualityOption {
id: ExportQuality;
@@ -49,6 +50,8 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro
const [selectedFormat, setSelectedFormat] = useState<VideoFormat>("mp4");
const [selectedQuality, setSelectedQuality] = useState<ExportQuality>("1080p");
const [selectedFps, setSelectedFps] = useState<number>(60);
+ const [bitrateMode, setBitrateMode] = useState<BitratePreset>("balanced");
+ const [customBitrateMbps, setCustomBitrateMbps] = useState<number>(12);
const isExporting = exportProgress.status !== "idle" &&
exportProgress.status !== "complete" &&
@@ -56,23 +59,37 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro
const isTransparent = !!hasTransparentBackground;
+ // Calculate effective bitrate in bits/sec based on preset or resolution
+ const effectiveBitrateBps = useMemo(() => {
+ switch (bitrateMode) {
+ case "whatsapp":
+ return 3_000_000; // 3 Mbps (~22MB/min, easily fits WhatsApp/Discord limits)
+ case "balanced":
+ return selectedQuality === "4k" ? 25_000_000 : selectedQuality === "2k" ? 16_000_000 : 10_000_000;
+ case "youtube":
+ return selectedQuality === "4k" ? 45_000_000 : selectedQuality === "2k" ? 24_000_000 : 18_000_000;
+ case "custom":
+ return customBitrateMbps * 1_000_000;
+ default:
+ return 10_000_000;
+ }
+ }, [bitrateMode, selectedQuality, customBitrateMbps]);
+
+ const estimatedMbPerMin = useMemo(() => {
+ return Math.round((effectiveBitrateBps / 8 / 1_000_000) * 60);
+ }, [effectiveBitrateBps]);
+
const handleStartExport = () => {
setIsOpen(false);
if (selectedFormat === "gif") {
onExport("gif", 24);
} else if (selectedFormat === "webm" || isTransparent) {
- onExport("webm-alpha", selectedFps);
+ onExport("webm-alpha", selectedFps, effectiveBitrateBps);
} else {
- onExport(selectedQuality, selectedFps);
+ onExport(selectedQuality, selectedFps, effectiveBitrateBps);
}
};
- const handleDirectExport = (quality: ExportQuality) => {
- setIsOpen(false);
- const fpsToUse = quality === "gif" ? 24 : selectedFps;
- onExport(quality, fpsToUse);
- };
-
return (
<Popover open={isOpen} onOpenChange={setIsOpen}>
<PopoverTrigger asChild>
@@ -89,192 +106,288 @@ export function ExportDropdown({ onExport, exportProgress, hasTransparentBackgro
</PopoverTrigger>
<PopoverContent
align="end"
- className="w-[370px] p-0 bg-background/95 backdrop-blur-xl border border-border/80 text-foreground shadow-2xl rounded-xl overflow-hidden z-999999"
+ className="w-[390px] p-0 bg-background/95 backdrop-blur-xl border border-border/80 text-foreground shadow-2xl rounded-xl overflow-hidden z-999999 max-h-[85vh] flex flex-col"
>
- <div className="flex flex-col">
- {/* Header */}
- <div className="px-4 py-3 border-b border-border/60 bg-muted/40 flex items-center justify-between">
- <div className="flex items-center gap-2">
- <div className="w-6 h-6 rounded-md bg-blue-500/10 text-blue-500 flex items-center justify-center border border-blue-500/20">
- <Icon icon="lucide:video" width="14" />
- </div>
- <span className="text-xs font-semibold uppercase tracking-wider text-foreground">
- Export Video
- </span>
+ {/* Header */}
+ <div className="px-4 py-3 border-b border-border/60 bg-muted/40 flex items-center justify-between shrink-0">
+ <div className="flex items-center gap-2">
+ <div className="w-6 h-6 rounded-md bg-blue-500/10 text-blue-500 flex items-center justify-center border border-blue-500/20">
+ <Icon icon="lucide:video" width="14" />
</div>
+ <span className="text-xs font-semibold uppercase tracking-wider text-foreground">
+ Export Video
+ </span>
+ </div>
+ <div className="flex items-center gap-1.5">
+ <span className="text-[10px] font-mono font-medium px-2 py-0.5 rounded-full bg-blue-500/10 text-blue-400 border border-blue-500/20">
+ ~{estimatedMbPerMin} MB/min
+ </span>
{isTransparent && (
<span className="text-[10px] font-medium px-2 py-0.5 rounded-full bg-cyan-500/10 text-cyan-400 border border-cyan-500/20">
- Transparent
+ Alpha
</span>
)}
</div>
+ </div>
+
+ <div className="p-4 space-y-4 overflow-y-auto custom-scrollbar flex-1">
+ {/* Format Switcher */}
+ <div>
+ <div className="flex items-center justify-between mb-1.5">
+ <span className="text-xs font-medium text-muted-foreground">Format</span>
+ <span className="text-[10px] text-muted-foreground/70 font-mono">
+ {selectedFormat === "mp4" ? "H.264 · WebCodecs" : selectedFormat === "webm" ? "VP9 · Alpha" : "Animated Loop"}
+ </span>
+ </div>
+ <div className="grid grid-cols-3 gap-1.5 p-1 bg-muted/50 rounded-lg border border-border/50">
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("mp4")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "mp4"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:video" width="14" className={selectedFormat === "mp4" ? "text-blue-500" : ""} />
+ MP4
+ </button>
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("webm")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "webm"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:web" width="14" className={selectedFormat === "webm" ? "text-cyan-500" : ""} />
+ WebM
+ </button>
+ <button
+ type="button"
+ onClick={() => setSelectedFormat("gif")}
+ className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
+ selectedFormat === "gif"
+ ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="mdi:file-gif-box" width="14" className={selectedFormat === "gif" ? "text-orange-500" : ""} />
+ GIF
+ </button>
+ </div>
+ </div>
- <div className="p-4 space-y-4">
- {/* Format Switcher */}
+ {/* Target Preset / Bitrate Mode */}
+ {selectedFormat !== "gif" && (
<div>
- <div className="flex items-center justify-between mb-2">
- <span className="text-xs font-medium text-muted-foreground">Format</span>
- <span className="text-[10px] text-muted-foreground/70 font-mono">
- {selectedFormat === "mp4" ? "H.264 · WebCodecs" : selectedFormat === "webm" ? "VP9 · Alpha" : "Animated"}
+ <div className="flex items-center justify-between mb-1.5">
+ <span className="text-xs font-medium text-muted-foreground">Target Bitrate & Size</span>
+ <span className="text-[10px] font-mono text-muted-foreground">
+ {Math.round(effectiveBitrateBps / 1_000_000)} Mbps
</span>
</div>
- <div className="grid grid-cols-3 gap-1.5 p-1 bg-muted/50 rounded-lg border border-border/50">
+ <div className="grid grid-cols-4 gap-1 p-1 bg-muted/40 rounded-lg border border-border/50">
<button
type="button"
- onClick={() => setSelectedFormat("mp4")}
- className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
- selectedFormat === "mp4"
- ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ onClick={() => setBitrateMode("whatsapp")}
+ className={`py-1.5 px-1 text-[11px] font-medium rounded transition-all flex flex-col items-center gap-0.5 ${
+ bitrateMode === "whatsapp"
+ ? "bg-emerald-500/15 text-emerald-400 border border-emerald-500/30 font-semibold"
: "text-muted-foreground hover:text-foreground"
}`}
>
- <Icon icon="mdi:video" width="14" className={selectedFormat === "mp4" ? "text-blue-500" : ""} />
- MP4
+ <Icon icon="ic:baseline-whatsapp" width="14" className="text-emerald-500" />
+ <span>WhatsApp</span>
+ <span className="text-[9px] opacity-75 font-mono">3 Mbps</span>
</button>
+
<button
type="button"
- onClick={() => setSelectedFormat("webm")}
- className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
- selectedFormat === "webm"
- ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ onClick={() => setBitrateMode("balanced")}
+ className={`py-1.5 px-1 text-[11px] font-medium rounded transition-all flex flex-col items-center gap-0.5 ${
+ bitrateMode === "balanced"
+ ? "bg-blue-500/15 text-blue-400 border border-blue-500/30 font-semibold"
: "text-muted-foreground hover:text-foreground"
}`}
>
- <Icon icon="mdi:web" width="14" className={selectedFormat === "webm" ? "text-cyan-500" : ""} />
- WebM
+ <Icon icon="lucide:share-2" width="14" className="text-blue-500" />
+ <span>Social</span>
+ <span className="text-[9px] opacity-75 font-mono">Balanced</span>
</button>
+
<button
type="button"
- onClick={() => setSelectedFormat("gif")}
- className={`py-1.5 px-2 text-xs font-medium rounded-md transition-all flex items-center justify-center gap-1.5 ${
- selectedFormat === "gif"
- ? "bg-background text-foreground shadow-sm font-semibold border border-border/40"
+ onClick={() => setBitrateMode("youtube")}
+ className={`py-1.5 px-1 text-[11px] font-medium rounded transition-all flex flex-col items-center gap-0.5 ${
+ bitrateMode === "youtube"
+ ? "bg-red-500/15 text-red-400 border border-red-500/30 font-semibold"
: "text-muted-foreground hover:text-foreground"
}`}
>
- <Icon icon="mdi:file-gif-box" width="14" className={selectedFormat === "gif" ? "text-orange-500" : ""} />
- GIF
+ <Icon icon="mdi:youtube" width="14" className="text-red-500" />
+ <span>YouTube</span>
+ <span className="text-[9px] opacity-75 font-mono">Max HQ</span>
+ </button>
+
+ <button
+ type="button"
+ onClick={() => setBitrateMode("custom")}
+ className={`py-1.5 px-1 text-[11px] font-medium rounded transition-all flex flex-col items-center gap-0.5 ${
+ bitrateMode === "custom"
+ ? "bg-purple-500/15 text-purple-400 border border-purple-500/30 font-semibold"
+ : "text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <Icon icon="lucide:sliders" width="14" className="text-purple-500" />
+ <span>Custom</span>
+ <span className="text-[9px] opacity-75 font-mono">Slider</span>
</button>
</div>
- </div>
- {/* Framerate Selection (FPS) */}
- {selectedFormat !== "gif" && (
- <div>
- <div className="flex items-center justify-between mb-2">
- <div className="flex items-center gap-1.5">
- <span className="text-xs font-medium text-muted-foreground">Framerate</span>
- <span className="text-[10px] text-blue-500/90 font-medium">✨ Smooth Scroll</span>
+ {/* Custom Bitrate Slider */}
+ {bitrateMode === "custom" && (
+ <div className="mt-2.5 p-2.5 rounded-lg border border-purple-500/30 bg-purple-500/5 space-y-1.5">
+ <div className="flex items-center justify-between text-xs">
+ <span className="text-purple-300 font-medium">Custom Bitrate</span>
+ <span className="font-mono text-xs font-bold text-purple-400">{customBitrateMbps} Mbps</span>
+ </div>
+ <input
+ type="range"
+ min="1"
+ max="50"
+ step="1"
+ value={customBitrateMbps}
+ onChange={(e) => setCustomBitrateMbps(Number(e.target.value))}
+ className="w-full h-1.5 bg-muted rounded-lg appearance-none cursor-pointer accent-purple-500"
+ />
+ <div className="flex justify-between text-[9px] font-mono text-muted-foreground">
+ <span>1 Mbps (Tiny)</span>
+ <span>25 Mbps (HQ)</span>
+ <span>50 Mbps (Master)</span>
</div>
- <span className="text-[10px] text-muted-foreground/70">
- {selectedFps === 120 ? "120/144Hz Native" : selectedFps === 60 ? "Fluid 60 FPS" : "Standard 30 FPS"}
- </span>
</div>
- <div className="grid grid-cols-3 gap-1.5">
- {FPS_PRESETS.map((preset) => {
- const isSelected = selectedFps === preset.value;
- return (
- <button
- key={preset.value}
- type="button"
- onClick={() => setSelectedFps(preset.value)}
- className={`p-2 rounded-lg border text-left transition-all relative ${
- isSelected
- ? "border-blue-500/60 bg-blue-500/10 text-foreground shadow-sm ring-1 ring-blue-500/30"
- : "border-border/60 bg-card/40 hover:bg-muted/60 text-muted-foreground hover:text-foreground"
- }`}
- >
- <div className="flex items-center justify-between">
- <span className={`text-xs font-bold ${isSelected ? "text-blue-500 dark:text-blue-400" : ""}`}>
- {preset.label}
- </span>
- {preset.recommended && (
- <span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse" />
- )}
- </div>
- <span className="text-[10px] text-muted-foreground block mt-0.5 leading-tight">
- {preset.desc}
- </span>
- </button>
- );
- })}
+ )}
+ </div>
+ )}
+
+ {/* Framerate Selection (FPS) */}
+ {selectedFormat !== "gif" && (
+ <div>
+ <div className="flex items-center justify-between mb-1.5">
+ <div className="flex items-center gap-1.5">
+ <span className="text-xs font-medium text-muted-foreground">Framerate</span>
+ <span className="text-[10px] text-blue-500/90 font-medium">✨ Smooth Scroll</span>
</div>
+ <span className="text-[10px] text-muted-foreground/70">
+ {selectedFps === 120 ? "120/144Hz Native" : selectedFps === 60 ? "Fluid 60 FPS" : "Standard 30 FPS"}
+ </span>
</div>
- )}
+ <div className="grid grid-cols-3 gap-1.5">
+ {FPS_PRESETS.map((preset) => {
+ const isSelected = selectedFps === preset.value;
+ return (
+ <button
+ key={preset.value}
+ type="button"
+ onClick={() => setSelectedFps(preset.value)}
+ className={`p-2 rounded-lg border text-left transition-all relative ${
+ isSelected
+ ? "border-blue-500/60 bg-blue-500/10 text-foreground shadow-sm ring-1 ring-blue-500/30"
+ : "border-border/60 bg-card/40 hover:bg-muted/60 text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <div className="flex items-center justify-between">
+ <span className={`text-xs font-bold ${isSelected ? "text-blue-500 dark:text-blue-400" : ""}`}>
+ {preset.label}
+ </span>
+ {preset.recommended && (
+ <span className="w-1.5 h-1.5 rounded-full bg-blue-500 animate-pulse" />
+ )}
+ </div>
+ <span className="text-[10px] text-muted-foreground block mt-0.5 leading-tight">
+ {preset.desc}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ )}
- {/* Resolution Selector */}
- {selectedFormat !== "gif" ? (
- <div>
- <div className="flex items-center justify-between mb-2">
- <span className="text-xs font-medium text-muted-foreground">Resolution</span>
- <span className="text-[10px] text-muted-foreground/70">Aspect 16:9</span>
- </div>
- <div className="space-y-1.5 max-h-48 overflow-y-auto custom-scrollbar pr-1">
- {QUALITY_OPTIONS.map((opt) => {
- const isSelected = selectedQuality === opt.id;
- return (
- <button
- key={opt.id}
- type="button"
- onClick={() => {
- setSelectedQuality(opt.id);
- }}
- className={`w-full flex items-center justify-between p-2.5 rounded-lg border text-left transition-all ${
- isSelected
- ? "border-primary/60 bg-primary/10 text-foreground ring-1 ring-primary/20"
- : "border-border/40 hover:border-border/80 hover:bg-muted/40 text-muted-foreground hover:text-foreground"
- }`}
- >
- <div className="flex items-center gap-2.5">
- <div className={`w-2 h-2 rounded-full ${isSelected ? "bg-primary" : "bg-muted-foreground/40"}`} />
- <div>
- <div className="flex items-center gap-1.5">
- <span className={`text-xs font-semibold ${isSelected ? "text-foreground" : ""}`}>
- {opt.label}
- </span>
- {opt.tag && (
- <span className="text-[9px] px-1.5 py-0.2 rounded font-medium bg-muted text-muted-foreground border border-border/40">
- {opt.tag}
- </span>
- )}
- </div>
- <span className="text-[10px] font-mono text-muted-foreground/80 block">
- {opt.resolution}
+ {/* Resolution Selector */}
+ {selectedFormat !== "gif" ? (
+ <div>
+ <div className="flex items-center justify-between mb-1.5">
+ <span className="text-xs font-medium text-muted-foreground">Resolution</span>
+ <span className="text-[10px] text-muted-foreground/70">Aspect 16:9</span>
+ </div>
+ <div className="space-y-1.5 max-h-40 overflow-y-auto custom-scrollbar pr-1">
+ {QUALITY_OPTIONS.map((opt) => {
+ const isSelected = selectedQuality === opt.id;
+ return (
+ <button
+ key={opt.id}
+ type="button"
+ onClick={() => {
+ setSelectedQuality(opt.id);
+ }}
+ className={`w-full flex items-center justify-between p-2.5 rounded-lg border text-left transition-all ${
+ isSelected
+ ? "border-primary/60 bg-primary/10 text-foreground ring-1 ring-primary/20"
+ : "border-border/40 hover:border-border/80 hover:bg-muted/40 text-muted-foreground hover:text-foreground"
+ }`}
+ >
+ <div className="flex items-center gap-2.5">
+ <div className={`w-2 h-2 rounded-full ${isSelected ? "bg-primary" : "bg-muted-foreground/40"}`} />
+ <div>
+ <div className="flex items-center gap-1.5">
+ <span className={`text-xs font-semibold ${isSelected ? "text-foreground" : ""}`}>
+ {opt.label}
</span>
+ {opt.tag && (
+ <span className="text-[9px] px-1.5 py-0.2 rounded font-medium bg-muted text-muted-foreground border border-border/40">
+ {opt.tag}
+ </span>
+ )}
</div>
+ <span className="text-[10px] font-mono text-muted-foreground/80 block">
+ {opt.resolution}
+ </span>
</div>
- <span className="text-[10px] font-mono font-medium px-2 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/40">
- {selectedFps} fps
- </span>
- </button>
- );
- })}
- </div>
+ </div>
+ <span className="text-[10px] font-mono font-medium px-2 py-0.5 rounded bg-muted/80 text-muted-foreground border border-border/40">
+ {selectedFps} fps
+ </span>
+ </button>
+ );
+ })}
</div>
- ) : (
- <div className="p-3 rounded-lg border border-orange-500/20 bg-orange-500/5 text-orange-400 space-y-1">
- <div className="flex items-center gap-1.5 text-xs font-semibold text-orange-400">
- <Icon icon="mdi:information-outline" width="16" />
- GIF Animated Export
- </div>
- <p className="text-[11px] text-orange-400/80 leading-relaxed">
- Exporting as an animated GIF renders at 720p (24 fps) without audio, ideal for embeds, GitHub, and documentation.
- </p>
+ </div>
+ ) : (
+ <div className="p-3 rounded-lg border border-orange-500/20 bg-orange-500/5 text-orange-400 space-y-1">
+ <div className="flex items-center gap-1.5 text-xs font-semibold text-orange-400">
+ <Icon icon="mdi:information-outline" width="16" />
+ GIF Animated Export
</div>
- )}
- </div>
+ <p className="text-[11px] text-orange-400/80 leading-relaxed">
+ Exporting as an animated GIF renders at 720p (24 fps) without audio, ideal for embeds, GitHub, and documentation.
+ </p>
+ </div>
+ )}
+ </div>
- {/* Footer Action */}
- <div className="p-3 border-t border-border/60 bg-muted/30 flex items-center gap-2">
- <Button
- onClick={handleStartExport}
- variant="primary"
- className="w-full py-2.5 text-xs font-semibold gap-2 shadow-md hover:brightness-105 active:scale-[0.98] transition-all"
- >
- <Icon icon="lucide:arrow-down-circle" width="16" />
- Export {selectedFormat.toUpperCase()} ({selectedFormat === "gif" ? "720p · 24fps" : `${selectedQuality.toUpperCase()} · ${selectedFps}fps`})
- </Button>
- </div>
+ {/* Footer Action */}
+ <div className="p-3 border-t border-border/60 bg-muted/30 flex items-center gap-2 shrink-0">
+ <Button
+ onClick={handleStartExport}
+ variant="primary"
+ className="w-full py-2.5 text-xs font-semibold gap-2 shadow-md hover:brightness-105 active:scale-[0.98] transition-all"
+ >
+ <Icon icon="lucide:arrow-down-circle" width="16" />
+ Export {selectedFormat.toUpperCase()} ({selectedFormat === "gif" ? "720p · 24fps" : `${selectedQuality.toUpperCase()} · ${selectedFps}fps · ${Math.round(effectiveBitrateBps / 1_000_000)}Mbps`})
+ </Button>
</div>
</PopoverContent>
</Popover>
diff --git a/app/components/ui/editor/EditorTopBar.tsx b/app/components/ui/editor/EditorTopBar.tsx
index 4f07526..4fddfbf 100644
--- a/app/components/ui/editor/EditorTopBar.tsx
+++ b/app/components/ui/editor/EditorTopBar.tsx
@@ -23,7 +23,7 @@ interface ImageExportProgress {
}
interface EditorTopBarProps {
- onExport: (quality: ExportQuality, fps?: number) => void;
+ onExport: (quality: ExportQuality, fps?: number, bitrate?: number) => void;
exportProgress: ExportProgress;
hasTransparentBackground?: boolean;
onUndo?: () => void;
diff --git a/hooks/useVideoExport.ts b/hooks/useVideoExport.ts
index 1b96c75..d8f7908 100644
--- a/hooks/useVideoExport.ts
+++ b/hooks/useVideoExport.ts
@@ -161,6 +161,7 @@ export function useVideoExport(
targetWidth, targetHeight, setExportProgress, cancellationRef.current, speed, settings
);
} else {
+ const effectiveBitrate = settings.bitrate || qualitySettings.bitrate;
await exportWithMediabunnyAndAudio(
video,
canvasHandle,
@@ -168,7 +169,7 @@ export function useVideoExport(
exportDuration,
trimStart,
fps,
- qualitySettings.bitrate,
+ effectiveBitrate,
qualitySettings.width,
qualitySettings.height,
setExportProgress,
diff --git a/types/video.types.ts b/types/video.types.ts
index dae6f69..7f58111 100644
--- a/types/video.types.ts
+++ b/types/video.types.ts
@@ -11,6 +11,7 @@ export interface TrimSettings {
export interface ExportSettings {
quality: ExportQuality;
fps?: number;
+ bitrate?: number;
trim?: TrimSettings;
transparentBackground?: boolean;
muteOriginalAudio?: boolean;