Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Merge remote-tracking branch 'upstream/main' into codex/feature/camera-crop

wizardAEI89702dfcb96c
diff --cc src/components/video-editor/SettingsPanel.tsx
index 694a51bc,478bc261..7256235f
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@@ -2564,29 -2691,86 +2703,87 @@@ export function SettingsPanel(
/>
</div>
{!zoomClassicMode && (
- <SliderControl
- label={tSettings("effects.zoomSmoothness", "Zoom Smoothness")}
- value={zoomSmoothness}
- defaultValue={0.5}
- min={0}
- max={1}
- step={0.01}
- onChange={(v) => onZoomSmoothnessChange?.(v)}
- formatValue={(v) => (v <= 0 ? tSettings("effects.off") : v.toFixed(2))}
- parseInput={(text) => parseFloat(text)}
- />
+ <div className="text-[10px] text-muted-foreground">
+ {tSettings(
+ "effects.motionPresetsZoomHint",
+ "Zoom motion presets are available in Settings.",
+ )}
+ </div>
+ )}
+ {showDevMotionControls ? (
+ <div className="space-y-1.5 rounded-lg border border-[#2563EB]/15 bg-[#2563EB]/5 px-3 py-3">
+ <div>
+ <div className="text-[11px] font-medium text-foreground">
+ {tSettings("effects.exportBlurDebug", "Export Blur Debug")}
+ </div>
+ <div className="mt-0.5 text-[10px] text-muted-foreground">
+ {tSettings(
+ "effects.exportBlurDebugHint",
+ "Development-only temporal blur tuning for export and preview parity checks.",
+ )}
+ </div>
+ </div>
+ <SliderControl
+ label={tSettings("effects.zoomTemporalMotionBlur", "Temporal blur")}
+ value={zoomTemporalMotionBlur}
+ defaultValue={initialEditorPreferences.zoomTemporalMotionBlur}
+ min={0}
+ max={2}
+ step={0.05}
+ onChange={(value) => onZoomTemporalMotionBlurChange?.(value)}
+ formatValue={(value) => `${value.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ <SliderControl
+ label={tSettings("effects.zoomMotionBlurSampleCount", "Sample count")}
+ value={
- zoomMotionBlurSampleCount ?? TEMPORAL_MOTION_BLUR_DEFAULT_SAMPLE_COUNT
++ zoomMotionBlurSampleCount ??
++ TEMPORAL_MOTION_BLUR_DEFAULT_SAMPLE_COUNT
+ }
+ defaultValue={
+ initialEditorPreferences.zoomMotionBlurSampleCount ??
+ TEMPORAL_MOTION_BLUR_DEFAULT_SAMPLE_COUNT
+ }
+ min={TEMPORAL_MOTION_BLUR_MIN_SAMPLE_COUNT}
+ max={TEMPORAL_MOTION_BLUR_MAX_SAMPLE_COUNT}
+ step={2}
+ onChange={(value) =>
+ onZoomMotionBlurSampleCountChange?.(Math.round(value))
+ }
+ formatValue={(value) => `${Math.round(value)} samples`}
+ parseInput={(text) => parseFloat(text.replace(/samples?$/i, "").trim())}
+ />
+ <SliderControl
+ label={tSettings("effects.zoomMotionBlurShutterFraction", "Shutter")}
+ value={
+ zoomMotionBlurShutterFraction ??
+ TEMPORAL_MOTION_BLUR_DEFAULT_SHUTTER_FRACTION
+ }
+ defaultValue={
+ initialEditorPreferences.zoomMotionBlurShutterFraction ??
+ TEMPORAL_MOTION_BLUR_DEFAULT_SHUTTER_FRACTION
+ }
+ min={TEMPORAL_MOTION_BLUR_MIN_SHUTTER_FRACTION}
+ max={TEMPORAL_MOTION_BLUR_MAX_SHUTTER_FRACTION}
+ step={0.01}
+ onChange={(value) => onZoomMotionBlurShutterFractionChange?.(value)}
+ formatValue={(value) => `${Math.round(value * 100)}%`}
+ parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100}
+ />
+ </div>
+ ) : (
+ <div className="rounded-lg border border-foreground/10 bg-foreground/[0.03] px-3 py-2">
+ <div className="text-[10px] text-muted-foreground">
+ {tSettings(
+ "effects.exportBlurLocked",
+ "Export blur is fixed for this build.",
+ )}
+ </div>
+ <div className="mt-1 text-[12px] font-medium text-foreground">
+ {`${TEMPORAL_MOTION_BLUR_DEFAULT_SAMPLE_COUNT} samples · ${Math.round(TEMPORAL_MOTION_BLUR_DEFAULT_SHUTTER_FRACTION * 100)}% shutter`}
+ </div>
+ </div>
)}
- <SliderControl
- label={tSettings("effects.zoomMotionBlur")}
- value={zoomMotionBlur}
- defaultValue={DEFAULT_ZOOM_MOTION_BLUR}
- min={0}
- max={2}
- step={0.05}
- onChange={(v) => onZoomMotionBlurChange?.(v)}
- formatValue={(v) => `${v.toFixed(2)}×`}
- parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
- />
{selectedZoomId && (
<Button
onClick={() => {
@@@ -2843,6 -3014,67 +3027,78 @@@
return parseFloat(text.replace(/×$/, ""));
}}
/>
+ {showDevMotionControls ? (
+ <div className="space-y-1.5 rounded-lg border border-[#2563EB]/15 bg-[#2563EB]/5 px-3 py-3">
+ <div>
+ <div className="text-[11px] font-medium text-foreground">
- {tSettings("effects.cursorDebugTuning", "Cursor Debug Tuning")}
++ {tSettings(
++ "effects.cursorDebugTuning",
++ "Cursor Debug Tuning",
++ )}
+ </div>
+ <div className="mt-0.5 text-[10px] text-muted-foreground">
+ {tSettings(
+ "effects.cursorDebugTuningHint",
+ "Development-only spring tuning controls.",
+ )}
+ </div>
+ </div>
+ <SliderControl
+ label={tSettings(
+ "effects.cursorSpringStiffnessMultiplier",
+ "Spring stiffness",
+ )}
+ value={cursorSpringStiffnessMultiplier}
- defaultValue={initialEditorPreferences.cursorSpringStiffnessMultiplier}
++ defaultValue={
++ initialEditorPreferences.cursorSpringStiffnessMultiplier
++ }
+ min={0.25}
+ max={3}
+ step={0.01}
+ onChange={(value) =>
+ onCursorSpringStiffnessMultiplierChange?.(value)
+ }
+ formatValue={(value) => `${value.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ <SliderControl
+ label={tSettings(
+ "effects.cursorSpringDampingMultiplier",
+ "Spring damping",
+ )}
+ value={cursorSpringDampingMultiplier}
- defaultValue={initialEditorPreferences.cursorSpringDampingMultiplier}
++ defaultValue={
++ initialEditorPreferences.cursorSpringDampingMultiplier
++ }
+ min={0.25}
+ max={3}
+ step={0.01}
+ onChange={(value) =>
+ onCursorSpringDampingMultiplierChange?.(value)
+ }
+ formatValue={(value) => `${value.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ <SliderControl
+ label={tSettings(
+ "effects.cursorSpringMassMultiplier",
+ "Spring mass",
+ )}
+ value={cursorSpringMassMultiplier}
- defaultValue={initialEditorPreferences.cursorSpringMassMultiplier}
++ defaultValue={
++ initialEditorPreferences.cursorSpringMassMultiplier
++ }
+ min={0.25}
+ max={3}
+ step={0.01}
- onChange={(value) => onCursorSpringMassMultiplierChange?.(value)}
++ onChange={(value) =>
++ onCursorSpringMassMultiplierChange?.(value)
++ }
+ formatValue={(value) => `${value.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ </div>
+ ) : null}
</div>
{renderExtensionPanelsForSections("cursor")}
</section>
diff --cc src/components/video-editor/VideoEditor.tsx
index 6483ca13,a19098d6..ba757a5c
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@@ -172,10 -170,12 +170,12 @@@ import
extendAutoFullTrackClip,
type FigureData,
getClipSourceEndMs,
+ type Padding,
- type PlaybackSpeed,
+ mapSourceTimeToTimelineTime as resolveSourceTimeToTimelineTime,
+ mapTimelineTimeToSourceTime as resolveTimelineTimeToSourceTime,
- type Padding,
type SpeedRegion,
type TrimRegion,
+ trimsToClips,
type WebcamOverlaySettings,
type ZoomDepth,
type ZoomFocus,
@@@ -1519,6 -1658,9 +1658,9 @@@ export default function VideoEditor()
shadowIntensity: number;
backgroundBlur: number;
zoomMotionBlur: number;
- zoomTemporalMotionBlur: number;
- zoomMotionBlurSampleCount: number | null;
- zoomMotionBlurShutterFraction: number | null;
++ zoomTemporalMotionBlur: number;
++ zoomMotionBlurSampleCount: number | null;
++ zoomMotionBlurShutterFraction: number | null;
connectZooms: boolean;
zoomInDurationMs: number;
zoomInOverlapMs: number;
@@@ -1920,6 -2070,13 +2073,9 @@@
setCursorStyle(normalizedEditor.cursorStyle);
setCursorSize(normalizedEditor.cursorSize);
setCursorSmoothing(normalizedEditor.cursorSmoothing);
- setCursorSpringStiffnessMultiplier(
- normalizedEditor.cursorSpringStiffnessMultiplier,
- );
- setCursorSpringDampingMultiplier(
- normalizedEditor.cursorSpringDampingMultiplier,
- );
++ setCursorSpringStiffnessMultiplier(normalizedEditor.cursorSpringStiffnessMultiplier);
++ setCursorSpringDampingMultiplier(normalizedEditor.cursorSpringDampingMultiplier);
+ setCursorSpringMassMultiplier(normalizedEditor.cursorSpringMassMultiplier);
setZoomSmoothness(normalizedEditor.zoomSmoothness);
setZoomClassicMode(normalizedEditor.zoomClassicMode);
setCursorMotionBlur(normalizedEditor.cursorMotionBlur);
@@@ -3016,10 -3162,30 +3170,30 @@@
if (totalMs <= 0) return;
if (!clipInitializedRef.current) {
if (clipRegions.length === 0) {
- const id = `clip-${nextClipIdRef.current++}`;
- autoFullTrackClipIdRef.current = id;
- autoFullTrackClipEndMsRef.current = totalMs;
- setClipRegions([{ id, startMs: 0, endMs: totalMs, speed: 1 }]);
+ const nextClipRegions =
+ trimRegions.length > 0
+ ? trimsToClips(trimRegions, totalMs)
+ : (() => {
- const id = `clip-${nextClipIdRef.current++}`;
- autoFullTrackClipIdRef.current = id;
- autoFullTrackClipEndMsRef.current = totalMs;
- return [{ id, startMs: 0, endMs: totalMs, speed: 1 }];
- })();
++ const id = `clip-${nextClipIdRef.current++}`;
++ autoFullTrackClipIdRef.current = id;
++ autoFullTrackClipEndMsRef.current = totalMs;
++ return [{ id, startMs: 0, endMs: totalMs, speed: 1 }];
++ })();
+
+ if (trimRegions.length > 0) {
+ nextClipIdRef.current = deriveNextId(
+ "clip",
+ nextClipRegions.map((region) => region.id),
+ );
+ }
+
+ setClipRegions(nextClipRegions);
+ if (speedRegions.length > 0) {
+ // Legacy speed regions no longer have dedicated editing surfaces.
+ // Clear them during clip bootstrap so old projects do not keep
+ // hidden playback changes that users cannot inspect or edit.
+ setSpeedRegions([]);
+ }
}
clipInitializedRef.current = true;
return;
@@@ -4213,8 -4234,8 +4245,8 @@@
isPlaying,
previewSourceAudioFallbackPaths,
sourceAudioFallbackStartDelayMsByPath,
- speedRegions,
- effectiveSpeedRegions,
- ]);
++ effectiveSpeedRegions,
+ ]);
const showExportSuccessToast = useCallback((filePath: string) => {
toast.success(`Exported successfully to ${filePath}`, {
@@@ -5989,6 -6010,13 +6037,15 @@@
cursorStyle={cursorStyle}
cursorSize={cursorSize}
cursorSmoothing={cursorSmoothing}
+ cursorSpringStiffnessMultiplier={
+ cursorSpringStiffnessMultiplier
+ }
+ cursorSpringDampingMultiplier={
+ cursorSpringDampingMultiplier
+ }
- cursorSpringMassMultiplier={cursorSpringMassMultiplier}
++ cursorSpringMassMultiplier={
++ cursorSpringMassMultiplier
++ }
zoomSmoothness={zoomSmoothness}
zoomClassicMode={zoomClassicMode}
cursorMotionBlur={cursorMotionBlur}
diff --cc src/components/video-editor/VideoPlayback.tsx
index e9fce7e6,11002c6a..2c7499d0
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@@ -373,16 -358,7 +362,11 @@@ const VideoPlayback = forwardRef<VideoP
const webcamVideoRef = useRef<HTMLVideoElement | null>(null);
const webcamBubbleRef = useRef<HTMLDivElement | null>(null);
const webcamBubbleInnerRef = useRef<HTMLDivElement | null>(null);
+ const [webcamVideoDimensions, setWebcamVideoDimensions] = useState<{
+ width: number;
+ height: number;
+ } | null>(null);
const captionBoxRef = useRef<HTMLDivElement | null>(null);
- const captionEditInputRef = useRef<HTMLTextAreaElement | null>(null);
- const captionEditSessionRef = useRef<CaptionEditSession | null>(null);
- const [captionEditSession, setCaptionEditSession] = useState<CaptionEditSession | null>(
- null,
- );
const currentTimeRef = useRef(0);
const zoomRegionsRef = useRef<ZoomRegion[]>([]);
const selectedZoomIdRef = useRef<string | null>(null);
@@@ -679,46 -507,8 +515,46 @@@
});
return () => cancelAnimationFrame(frame);
- }, [activeCaptionLayout, autoCaptionSettings, captionEditSizeKey, isCaptionEditing]);
+ }, [activeCaptionLayout, autoCaptionSettings]);
const motionBlurStateRef = useRef<MotionBlurState>(createMotionBlurState());
+ const webcamEnabled = webcam?.enabled ?? false;
+ const webcamMargin = webcam?.margin ?? 24;
+ const webcamSize = webcam?.size ?? DEFAULT_WEBCAM_SIZE;
+ const webcamReactToZoom = webcam?.reactToZoom ?? DEFAULT_WEBCAM_REACT_TO_ZOOM;
+ const webcamPositionPreset = webcam?.positionPreset ?? webcam?.corner ?? "bottom-right";
+ const webcamPositionX = webcam?.positionX ?? 1;
+ const webcamPositionY = webcam?.positionY ?? 1;
+ const webcamCorner = webcam?.corner ?? "bottom-right";
+ const webcamCornerRadius = webcam?.cornerRadius ?? DEFAULT_WEBCAM_CORNER_RADIUS;
+ const webcamShadow = webcam?.shadow ?? DEFAULT_WEBCAM_SHADOW;
+ const webcamTimeOffsetMs = webcam?.timeOffsetMs;
+ const webcamCropRegion = webcam?.cropRegion;
+ const webcamMirror = webcam?.mirror ?? false;
+ const webcamCropPreviewContentStyle = useMemo<React.CSSProperties>(() => {
+ if (!webcamVideoDimensions) {
+ return { opacity: 0 };
+ }
+
+ const { sx, sy, sw, sh } = getWebcamCropSourceRect(
+ webcamCropRegion,
+ webcamVideoDimensions.width,
+ webcamVideoDimensions.height,
+ );
+ const coverScale = Math.max(1 / sw, 1 / sh);
+ const drawWidth = webcamVideoDimensions.width * coverScale;
+ const drawHeight = webcamVideoDimensions.height * coverScale;
+ const drawX = (1 - sw * coverScale) / 2 - sx * coverScale;
+ const drawY = (1 - sh * coverScale) / 2 - sy * coverScale;
+
+ return {
+ left: `${drawX * 100}%`,
+ top: `${drawY * 100}%`,
+ width: `${drawWidth * 100}%`,
+ height: `${drawHeight * 100}%`,
+ maxWidth: "none",
+ willChange: "left, top, width, height",
+ };
+ }, [webcamCropRegion, webcamVideoDimensions]);
const applyWebcamBubbleLayout = useCallback(
(zoomScale: number) => {
diff --cc src/lib/exporter/modernFrameRenderer.ts
index b6f42814,161d26bc..c7ea54f5
--- a/src/lib/exporter/modernFrameRenderer.ts
+++ b/src/lib/exporter/modernFrameRenderer.ts
@@@ -87,6 -89,10 +91,7 @@@ import
VIDEO_SHADOW_LAYER_PROFILES,
WEBCAM_SHADOW_LAYER_PROFILES,
} from "./shadowProfile";
-import {
- buildTemporalSamplePlanUs,
- getTemporalMotionBlurConfig,
-} from "./temporalMotionBlur";
++import { buildTemporalSamplePlanUs, getTemporalMotionBlurConfig } from "./temporalMotionBlur";
import type { ExportRenderBackend } from "./types";
interface FrameRenderConfig {