Integrate Remotion rendering into the EXISTING viewer/editor (viewer/ directory). The viewer already has: drag-drop timeline (@xzdarcy/react-timeline-editor), overlay positioning (OverlayEditor.tsx), asset panel (AssetPanel.tsx), live preview (LivePreview.tsx), and auto-save to timeline config. The new Remotion executor also built editing features as a portal overlay on Studio (EditorOverlay.tsx, ClipPanel.tsx, editor-utils.ts, save-config.ts) - these features should be merged INTO the existing viewer, not exist as a separate editor. Specifically: 1) Replace the viewer's canvas-based LivePreview.tsx with @remotion/player showing the actual Remotion composition for pixel-perfect preview. 2) Port the useful new features (split clip, mute, property editing via ClipPanel, save serialization from save-config.ts) into the existing viewer UI. 3) Update the viewer to read/write timeline.json + asset-registry.json instead of timeline.yaml. 4) Remove the EditorOverlay portal from Remotion Studio (it shouldn't have its own editor UI). 5) Keep Remotion Studio as a standalone preview-only tool. The result: ONE editor (the viewer), powered by Remotion for preview and rendering.
code
Plan:
# Implementation Plan: Unify Editor into Viewer with Remotion Player
Overview
Goal: Consolidate into ONE editor (the viewer at viewer/) powered by @remotion/player for preview, while keeping Remotion Studio as a standalone preview-only tool.
Current state:
viewer/ — Full NLE UI (react-timeline-editor, AssetPanel, OverlayEditor, drag-drop) but reads/writes timeline.yaml and uses a canvas-based LivePreview that manually composites video/audio/overlays.
remotion/ — Remotion compositions (Timeline, VideoTrack, AudioTrack, OverlayTrack, Background, Effects) plus an EditorOverlay portal with ClipPanel, split/mute/property editing, and JSON-based save-config. The editor features duplicate what the viewer already has, but add split, mute, and field-level property editing.
No shared types — viewer uses ClipMeta/RawClip/YAML; remotion uses TimelineClip/ResolvedTimelineClip/JSON.
Constraints:
Assistant
User
Assistant
Progress update: I’m checking the revised plan against the repo’s actual integration points, especially where it changes existing behavior rather than just moving code around. I’m focusing on whether the new steps preserve the current viewer workflows and tool expectations.
Assistant
I’ve found one concrete gap already: the revised upload plan still bypasses the repository’s ingest/profile pipeline. The viewer keeps /api/waveform and the old transcript-dependent behavior, but the proposed ffprobe upload path would only fill asset-registry.json, not the asset_profiles/*.yaml files those features read.
Assistant
I’m down to checking whether the revised plan’s assumptions match the local dependencies, not just the app code. Two areas matter here: whether the Player API it relies on actually exists in the installed Remotion package, and whether the new shared import strategy works with the existing build setup.
Assistant
{"flags":[{"id":"plan-upload-bypasses-ingest-profiles","concern":"The revised upload step still breaks a real repository workflow: it writes asset-registry.json metadata with , but it does not produce the files that the viewer and Python tools still rely on. Keeping unchanged is not enough if newly uploaded assets never go through the ingest/profile pipeline.","category":"correctness","severity_hint":"likely-significant","evidence":"The viewer still loads transcript/profile data from in - and -. The waveform endpoint still reads in -. The repo’s supported path for generating those profiles is , which creates transcript/silence/profile data in - and registers the asset from that profile-driven data flow."},{"id":"plan-clip-order-zindex","concern":"The JSON conversion work still needs an explicit clip-order strategy. In this repository, same-track render order matters, especially for overlays, but the viewer model normalizes clips into rows and historically sorts actions by start time before saving. Without preserving per-track order or a z-index field, saving from the viewer can change visual stacking and same-track precedence.","category":"correctness","severity_hint":"likely-significant","evidence":" renders clips in array order, so later clips stack on top of earlier ones in -. The current viewer serializer sorts actions before writing them in -. The revised plan replaces that serializer, but it still does not spell out how / will preserve original clip order when round-tripping through the row-based editor model."}],"verified_flag_ids":["plan-player-metadata","plan-dual-config-owners","plan-asset-registry-metadata","plan-effects-dropped","plan-overlay-coordinate-model","plan-structure-step-headings"],"disputed_flag_ids":[]}
timeline.json + asset-registry.json are the source of truth (per CLAUDE.md).
The react-timeline-editor library stays — it's the drag-drop timeline UI.
Remotion compositions (Timeline.tsx, VideoTrack, AudioTrack, OverlayTrack, Background, Effects) stay intact — they become what @remotion/player renders inside the viewer.
server.mjs (port 3111) is the persistence backend for JSON saves.
Phase 1: Foundation — Shared Types and JSON Data Layer
Step 1: Extract shared type definitions
Scope: Small
Createshared/types.ts at the project root (or a location importable by both viewer and remotion).
UnifyTimelineClip, TimelineConfig, TimelineOutput, AssetRegistryEntry, ResolvedTimelineClip, ResolvedTimelineConfig, and TimelineTrack from remotion/src/load-config.ts — these are the canonical JSON types.
Export viewer-specific types (ClipMeta equivalent mapped to TimelineClip, row-conversion helpers) from this shared module.
Updateremotion/src/load-config.ts to re-export from shared types instead of defining inline.
Step 2: Replace viewer's YAML data layer with JSON
Scope: Medium
Rewriteviewer/src/timeline-data.ts:
Remove js-yaml dependency and all YAML parsing/serialization (parseTimeline, toYaml).
Add loadTimelineConfig() and loadAssetRegistry() functions that fetch from the Vite dev server (proxied to server.mjs or read directly).
Update upload handler to register assets in asset-registry.json instead of timeline.yaml's asset_map.
Updateviewer/src/App.tsx:
Change initial load from YAML fetch to JSON fetch (timeline.json + asset-registry.json).
Change auto-save to POST JSON instead of YAML.
Change external-change polling to compare JSON signatures.
Validate: Viewer loads, displays timeline from JSON, saves edits back to JSON. Canvas preview still works (will be replaced in Phase 2).
Step 3: Port editor-utils into viewer
Scope: Small
Copyremotion/src/timeline/editor-utils.ts into viewer/src/editor-utils.ts (or import from shared location).
Copyremotion/src/save-config.ts serialization logic (serializeClipForDisk, validateSerializedConfig, serializeForDisk) into viewer's save path.
These are pure functions with no Remotion dependencies — they operate on the shared types.
Phase 2: Replace Canvas Preview with Remotion Player
Step 4: Add @remotion/player to viewer
Scope: Medium
Install@remotion/player, remotion, and react peer deps in viewer/package.json. Since both already use React 19, this should be compatible.
Make Remotion composition code importable from viewer:
Option A (recommended): Move composition source files (timeline/VideoTrack.tsx, AudioTrack.tsx, OverlayTrack.tsx, Background.tsx, Effects.tsx, and the main Timeline.tsx composition) into a shared location (e.g., shared/compositions/) that both remotion/ and viewer/ can import via TypeScript path aliases or relative imports.
Option B: Keep compositions in remotion/src/timeline/ and configure viewer's Vite to resolve imports from there.
Createviewer/src/RemotionPreview.tsx:
Import Player from @remotion/player.
Import the Timeline composition component.
Accept the current ResolvedTimelineConfig as a prop.
Wire onTimeUpdate or Player's frame callback to report current time back to parent (for timeline cursor sync).
ReplaceLivePreview usage in App.tsx with RemotionPreview.
The <canvas> element used by OverlayEditor for coordinate mapping needs to be replaced with the Player's container div. Update OverlayEditor to use the Player's container dimensions instead of canvas dimensions.
Validate: Preview shows pixel-perfect Remotion output. Play/pause/seek works. Timeline cursor syncs with player. Overlay editor still works for positioning.
Step 5: Resolve asset file serving
Scope: Small
Remotion Player needs staticFile() URLs for media. In Remotion Studio, staticFile("inputs/demo-one.mp4") resolves via Remotion's dev server. In the viewer's Vite server, these paths don't exist.
Solution: Configure Vite to serve the project root's inputs/ directory at /inputs/ (already partially done via existing media serving). Ensure asset-registry.json file paths like inputs/demo-one.mp4 resolve correctly when used as src attributes.
UpdateloadTimelineConfig for viewer context: resolve file paths from asset-registry to Vite-served URLs (e.g., /inputs/demo-one.mp4 served by Vite's static middleware) rather than using Remotion's staticFile().
The composition components currently use clip.assetEntry.src which is set by loadTimelineConfig() via staticFile(). For the viewer, this needs to be set to the Vite-served URL instead. This means the config-loading code must be environment-aware or accept a URL resolver function.
Phase 3: Port Editing Features
Step 6: Add ClipPanel property editor to viewer
Scope: Medium
Portremotion/src/timeline/ClipPanel.tsx into viewer/src/ClipPanel.tsx.
Remove any Remotion-specific styling or portal logic.
Adapt to use viewer's state management pattern (the applyTimelineEdit flow in App.tsx).
Wire onFieldChange to update the corresponding clip in the JSON config and call save.
Integrate into App.tsx:
Add selectedClipId state.
When a clip is clicked in the timeline, set selectedClipId.
Render ClipPanel when a clip is selected, positioned in the right sidebar.
Wire field changes through applyTimelineEdit → save.
Step 7: Add split and mute operations
Scope: Small
Add split button to ClipPanel (using splitClipAtPlayhead from editor-utils).
Add mute toggle to ClipPanel (using toggleClipMute from editor-utils).
Add keyboard shortcuts in App.tsx:
M → toggle mute on selected clip.
S → split selected clip at playhead.
Escape → deselect clip.
Wire these operations through applyTimelineEdit so they update rows, meta, and trigger save.
Validate: Split creates two clips at the playhead. Mute sets volume to 0 and shows visual indicator. Keyboard shortcuts work.
Phase 4: Cleanup
Step 8: Remove EditorOverlay from Remotion Studio
Scope: Small
Remove the <EditorOverlay> render from remotion/src/timeline/Timeline.tsx (around line 90).
Deleteremotion/src/timeline/EditorOverlay.tsx and remotion/src/timeline/ClipPanel.tsx (their functionality now lives in the viewer).
Keepeditor-utils.ts in the shared location (used by both viewer and Remotion if needed).
Keepsave-config.ts and server.mjs — the viewer will use the same save endpoint.
Validate: Remotion Studio (npx remotion studio) shows preview only, no editor overlay. Timeline composition still renders correctly.
Step 9: Remove legacy YAML path from viewer
Scope: Small
Removejs-yaml from viewer/package.json.
Remove any remaining YAML references in viewer/src/timeline-data.ts.
Remove YAML-specific API endpoints from viewer/vite.config.ts if replaced.
UpdateCLAUDE.md to reflect that the viewer now reads/writes JSON and is the primary editor.
Do NOT delete timeline.yaml or the viewer's ability to serve it — keep it as a frozen legacy artifact per CLAUDE.md.
Execution Order
Step 1 (shared types) — foundation, no functional changes.
Step 2 (JSON data layer) — highest risk, validates the core data path. Do this before adding Remotion Player so the canvas preview can verify JSON loading works.
Step 3 (port editor-utils) — pure functions, no UI changes.
Step 4 (Remotion Player) — the big integration. Depends on Steps 1-2 for types and JSON data.
Step 5 (asset serving) — must be done alongside or immediately after Step 4.
Step 6-7 (ClipPanel, split/mute) — can be done in parallel once the Player works.
Step 8 (remove EditorOverlay) — cleanup, only after viewer is fully functional.
Step 9 (remove YAML) — final cleanup.
Validation Order
After Step 2: Viewer loads timeline from JSON, displays in react-timeline-editor, saves edits back to JSON. Canvas preview still works.
After Step 4-5: Remotion Player shows pixel-perfect preview in viewer. Play/pause/seek/cursor sync all work.
After Step 6-7: ClipPanel shows properties, split and mute work, keyboard shortcuts work.
After Step 8: Remotion Studio has no editor overlay, preview-only.
After Step 9: No YAML dependencies remain in viewer.
code
Plan metadata:
{
"version": 1,
"timestamp": "2026-03-23T21:30:00Z",
"hash": "sha256:3a1b8db98b6dc1f88d45b40a0aa9bbb25386a62531528fb7d40dc96f050e4fc3",
"questions": [
"Should the shared types/compositions live in a new top-level shared/ directory, or should the viewer import directly from remotion/src/? A shared/ dir is cleaner but requires both package.json files to reference it. Importing from remotion/src is simpler but couples the projects.",
"The viewer's Vite dev server currently handles persistence (save-timeline, upload, render). Should we keep that Vite middleware AND the Remotion server.mjs (port 3111), or consolidate into one server? Consolidating avoids two save endpoints but is more work.",
"The viewer's OverlayEditor.tsx provides drag-to-reposition overlays on the canvas. With @remotion/player replacing the canvas, the overlay editor needs to render on top of the Player div. Should we keep the existing OverlayEditor approach (absolute-positioned div over the player) or replace it with something integrated into the Remotion composition?",
"The viewer currently polls for external timeline changes every 1s. The Remotion editor uses a 1.5s reload loop. Should we keep polling or switch to file-watching via WebSocket (the viewer's Vite config already has a file watcher)?",
"Should python3 tools/render.py continue to be triggered from the viewer's Vite middleware, or should we switch to calling Remotion's render directly (e.g., npx remotion render)?"
],
"success_criteria": [
"Viewer loads and displays timeline from timeline.json + asset-registry.json (not timeline.yaml).",
"Viewer preview shows pixel-perfect Remotion output via @remotion/player \u2014 identical to what Remotion Studio shows.",
"Play, pause, seek, and timeline cursor sync work between the Player and react-timeline-editor.",
"Drag-drop clip placement (from AssetPanel), clip repositioning, and clip resizing in the timeline still work and save to JSON.",
"OverlayEditor drag-to-reposition works on top of the Remotion Player.",
"ClipPanel shows all editable properties (at, from, to, speed, volume, hold, effects) for the selected clip.",
"Split-at-playhead creates two correctly-timed clips.",
"Mute toggle sets volume to 0 and shows visual feedback.",
"Keyboard shortcuts (Space=play/pause, M=mute, S=split, Escape=deselect) all work.",
"Remotion Studio (npx remotion studio) shows preview only \u2014 no EditorOverlay or ClipPanel portal.",
"Auto-save writes valid timeline.json that Remotion Studio, Python tools, and the viewer can all read.",
"External changes to timeline.json (e.g., from Python tools) are detected and reloaded in the viewer.",
"python3 tools/render.py still works (reads timeline.json, renders via Remotion)."
],
"assumptions": [
"React 19 is compatible between viewer (React 19.2.0) and @remotion/player (Remotion 4.0.434 which supports React 19). No version conflicts expected.",
"The Remotion composition components (VideoTrack, AudioTrack, OverlayTrack, Background, Effects) have no hard dependency on Remotion Studio \u2014 they use standard Remotion hooks (useCurrentFrame, useVideoConfig) that work inside @remotion/player.",
"The viewer's react-timeline-editor library (@xzdarcy/react-timeline-editor) will remain the timeline UI \u2014 we are NOT replacing it with the EditorOverlay's custom track rendering. The EditorOverlay's track rendering is being discarded; only its editing operations (split, mute, property editing) are being ported.",
"We will use a shared/ directory at the project root for types and compositions, with both viewer and remotion importing from it via relative paths or TypeScript path aliases.",
"The viewer's Vite middleware will be updated to handle JSON persistence directly (reading/writing timeline.json), rather than proxying to server.mjs. This avoids requiring two servers during development. server.mjs remains for Remotion Studio standalone use.",
"Asset file paths in asset-registry.json (e.g., 'inputs/demo-one.mp4') will be served by Vite's static file middleware, and the composition components will receive fully resolved URLs rather than using Remotion's staticFile() helper.",
"The existing auto-save debounce pattern (500ms in viewer) will be kept, adapted to serialize JSON instead of YAML.",
"OverlayEditor will continue to work as an absolute-positioned div layered on top of the Remotion Player container, using the same coordinate-mapping approach (content coords 1280x720 scaled to player container size)."
],
"structure_warnings": []
}
code
Plan structure warnings from validator:
[]
Existing flags:
[]
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
{"flags":[{"id":"plan-player-metadata","concern":"Step 4 understates the Remotion Player integration. The current Timeline composition only gets the right fps, preview-scaled dimensions, durationInFrames, and loaded config through Root.tsx metadata; mounting <Player component={Timeline} ...> directly is not enough to reproduce Studio's output.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/announcement-video/remotion/src/Root.tsx:25-49 computes fps, scaled width/height, durationInFrames, and injects config. /Users/user_c042661f/Documents/announcement-video/remotion/src/timeline/Timeline.tsx:18-21 throws if config is missing."},{"id":"plan-dual-config-owners","concern":"The plan does not include a refactor to separate a passive composition from the Studio controller. If the viewer embeds the current Timeline, the viewer and the composition will both own config loading/reloading, which is a real desync risk.","category":"correctness","severity_hint":"likely-significant","evidence":"The viewer already loads/saves timeline state in /Users/user_c042661f/Documents/announcement-video/viewer/src/App.tsx:72-161. The embedded composition also polls loadTimelineConfig() every 1.5s in /Users/user_c042661f/Documents/announcement-video/remotion/src/timeline/Timeline.tsx:32-55, and /Users/user_c042661f/Documents/announcement-video/remotion/src/load-config.ts:107-118 resolves JSON/assets independently."},{"id":"plan-asset-registry-metadata","concern":"Step 2 treats asset-registry.json like a path map, but the repository uses it as a metadata registry. Updating upload/registration without a metadata-population step will create entries that Remotion cannot classify or validate correctly.","category":"correctness","severity_hint":"likely-significant","evidence":"Current registry entries carry type, duration, resolution, and fps in /Users/user_c042661f/Documents/announcement-video/asset-registry.json:2-57. VideoTrack branches on assetEntry.type in /Users/user_c042661f/Documents/announcement-video/remotion/src/timeline/VideoTrack.tsx:10-35, and ClipPanel uses assetEntry.duration in /Users/user_c042661f/Documents/announcement-video/remotion/src/timeline/ClipPanel.tsx:160-166. The existing viewer upload path only writes a filename mapping in /Users/user_c042661f/Documents/announcement-video/viewer/vite.config.ts:149-176."},{"id":"plan-effects-dropped","concern":"The plan promises ClipPanel/property editing for effects, but it does not add effect fields to the viewer's in-memory model or save path. As written, viewer saves would strip fade/effect data from timeline.json.","category":"correctness","severity_hint":"likely-significant","evidence":"ClipMeta, RawClip, and the YAML serializer in /Users/user_c042661f/Documents/announcement-video/viewer/src/timeline-data.ts:4-38 and /Users/user_c042661f/Documents/announcement-video/viewer/src/timeline-data.ts:175-243 have no effects field. By contrast, Remotion explicitly preserves effects in /Users/user_c042661f/Documents/announcement-video/remotion/src/save-config.ts:5-69."},{"id":"plan-overlay-coordinate-model","concern":"Overlay editing is not a simple canvas-to-div substitution. The current overlay editor derives its hit-testing and box placement from a real canvas plus a manually shrunken content region, while the Remotion composition applies background_scale through CSS transforms. The plan needs an explicit coordinate-system migration step.","category":"correctness","severity_hint":"likely-significant","evidence":"/Users/user_c042661f/Documents/announcement-video/viewer/src/OverlayEditor.tsx:62-72 and /Users/user_c042661f/Documents/announcement-video/viewer/src/OverlayEditor.tsx:166-180 compute scale and offsets from canvas.width/canvas.getBoundingClientRect(). Remotion scales the inner content div with transform: scale(...) in /Users/user_c042661f/Documents/announcement-video/remotion/src/timeline/Timeline.tsx:72-87."},{"id":"plan-structure-step-headings","concern":"The plan does not follow the required structure. It uses phase headings plus ### Step N subsections instead of numbered ## Step N: sections with numbered substeps.","category":"completeness","severity_hint":"likely-significant","evidence":"The supplied plan has ## Phase 1, ## Phase 2, etc., with ### Step 1, ### Step 2, and bullet lists under each step, rather than top-level numbered ## Step N: sections."}],"verified_flag_ids":[],"disputed_flag_ids":[]}
You are an independent reviewer. Critique the plan against the actual repository.
Integrate Remotion rendering into the EXISTING viewer/editor (viewer/ directory). The viewer already has: drag-drop timeline (@xzdarcy/react-timeline-editor), overlay positioning (OverlayEditor.tsx), asset panel (AssetPanel.tsx), live preview (LivePreview.tsx), and auto-save to timeline config. The new Remotion executor also built editing features as a portal overlay on Studio (EditorOverlay.tsx, ClipPanel.tsx, editor-utils.ts, save-config.ts) - these features should be merged INTO the existing viewer, not exist as a separate editor. Specifically: 1) Replace the viewer's canvas-based LivePreview.tsx with @remotion/player showing the actual Remotion composition for pixel-perfect preview. 2) Port the useful new features (split clip, mute, property editing via ClipPanel, save serialization from save-config.ts) into the existing viewer UI. 3) Update the viewer to read/write timeline.json + asset-registry.json instead of timeline.yaml. 4) Remove the EditorOverlay portal from Remotion Studio (it shouldn't have its own editor UI). 5) Keep Remotion Studio as a standalone preview-only tool. The result: ONE editor (the viewer), powered by Remotion for preview and rendering.
code
Plan:
# Implementation Plan: Unify Editor into Viewer with Remotion Player
Overview
Goal: Consolidate into ONE editor (the viewer at viewer/) powered by @remotion/player for preview, while keeping Remotion Studio as a standalone preview-only tool.
Current state:
viewer/ — Full NLE UI (react-timeline-editor, AssetPanel, OverlayEditor, drag-drop) but reads/writes timeline.yaml and uses a canvas-based LivePreview that manually composites video/audio/overlays. Its ClipMeta type lacks effects and hold fields (viewer/src/timeline-data.ts:4-16). The YAML serializer (toYaml at viewer/src/timeline-data.ts:176-244) strips any fields not in RawClip.
remotion/ — Remotion compositions (Timeline, VideoTrack, AudioTrack, OverlayTrack, Background, Effects) plus an EditorOverlay portal with ClipPanel, split/mute/property editing, and JSON-based save-config. The Timeline composition self-loads config via polling (remotion/src/timeline/Timeline.tsx:32-55) and owns its own state, making it act as both renderer and controller. Root.tsx:33-48 computes fps, scaled width/height, and durationInFrames via calculateMetadata — these values are required by @remotion/player but aren't available from the composition alone.
No shared types — viewer uses ClipMeta/RawClip/YAML; remotion uses TimelineClip/ResolvedTimelineClip/JSON.
Constraints:
timeline.json + asset-registry.json are the source of truth (per CLAUDE.md).
The react-timeline-editor library stays — it's the drag-drop timeline UI.
Remotion compositions (VideoTrack, AudioTrack, OverlayTrack, Background, Effects) stay intact — they become what @remotion/player renders inside the viewer.
server.mjs (port 3111) is the persistence backend for Remotion Studio's standalone JSON saves.
Step 1: Extract shared type definitions
Scope: Small
Createshared/types.ts at the project root. Define TimelineClip, TimelineConfig, TimelineOutput, TimelineTrack, TimelineEffect, AssetRegistryEntry, AssetRegistry, ResolvedAssetRegistryEntry, ResolvedTimelineClip, and ResolvedTimelineConfig — taken directly from remotion/src/load-config.ts:3-65.
Export helper type TimelineCompositionProps from shared/types.ts.
Export pure computation functions that both projects need: parseResolution, getClipSourceDuration, getClipTimelineDuration, secondsToFrames, getClipDurationInFrames, getTimelineDurationInFrames, getEffectValue, getConfigSignature — from shared/config-utils.ts. These are currently in remotion/src/load-config.ts:140-201 and have no Remotion imports.
Updateremotion/src/load-config.ts to re-export types from shared/types.ts and functions from shared/config-utils.ts, keeping loadTimelineConfig() and fetchJson() in load-config.ts since they depend on Remotion's staticFile().
Configure both viewer/tsconfig.json and remotion/tsconfig.json with path aliases to resolve @shared/* → ../shared/*.
Step 2: Refactor Timeline composition into passive renderer
Scope: Medium
This step addresses the dual-config-ownership problem. Currently Timeline.tsx both renders AND manages config state (polling loadTimelineConfig() every 1.5s, owning setConfig, creating its own debounced saver). When embedded in the viewer via @remotion/player, the viewer must be the sole config owner.
Extract the rendering body of Timeline.tsx (remotion/src/timeline/Timeline.tsx:71-92) into a new shared/compositions/TimelineRenderer.tsx. This component:
Accepts config: ResolvedTimelineConfig and onConfigChange?: (updater) => void as props.
Contains only the rendering logic: Background, scaled content div with VideoTrack/OverlayTrack, AudioTrack.
Does not poll, does not own config state, does not import loadTimelineConfig or createDebouncedTimelineSaver.
Does not render EditorOverlay (that stays in the Studio-only wrapper for now, removed in Step 9).
Rewriteremotion/src/timeline/Timeline.tsx as a thin Studio wrapper:
Keeps the useState/useEffect polling loop (Timeline.tsx:22-55) and handleConfigChange (Timeline.tsx:63-69).
Renders <EditorOverlay> on top (until Step 9 removes it).
Move shared composition files (VideoTrack.tsx, AudioTrack.tsx, OverlayTrack.tsx, Background.tsx, Effects.tsx) into shared/compositions/. Update imports in both Timeline.tsx (Studio wrapper) and TimelineRenderer.tsx.
Validate:npx remotion studio still works identically — the split is an internal refactor with no behavior change.
Step 3: Replace viewer's YAML data layer with JSON
Scope: Medium
Rewriteviewer/src/timeline-data.ts:
Remove js-yaml import and all YAML parsing (parseTimeline) and serialization (toYaml).
Import types from @shared/types.ts.
Add effects and hold fields to the viewer's in-memory model. Replace ClipMeta with an extended type that includes all TimelineClip fields: effects?: TimelineEffect[] | Record<string, number>, hold?: number. This ensures round-trip fidelity — saves will not strip effects or hold data.
Add configToRows(config: ResolvedTimelineConfig) → { rows, meta, effects } conversion for react-timeline-editor, preserving all fields including effects and hold in the meta map.
Add rowsToConfig(rows, meta, output) → TimelineConfig conversion for saving, using the same field-preserving serialization as remotion/src/save-config.ts:25-45 (iterate TIMELINE_CLIP_FIELDS, include non-undefined values). This replaces the YAML toYaml function.
POST /api/save-timeline → accept JSON body, validate with the same validateSerializedConfig logic from save-config.ts:47-60, write to timeline.json.
GET /api/asset-registry → serve asset-registry.json.
Update upload handler (vite.config.ts:149-181): after writing the file to inputs/, probe the file with ffprobe (via child_process.execSync) to extract type (video/audio/image), , , and . Write a complete to instead of only adding to the YAML . If is unavailable, fall back to extension-based inference and omit numeric metadata (with a console warning).
Step 4: Port editor-utils and save-config into shared
Scope: Small
Moveremotion/src/timeline/editor-utils.ts to shared/editor-utils.ts. Update its imports to use @shared/types and @shared/config-utils instead of ../load-config.
Move the serialization functions from remotion/src/save-config.ts (serializeClipForDisk, validateSerializedConfig, serializeForDisk, and the TIMELINE_CLIP_FIELDS constant) into shared/serialize.ts. These are pure functions — the Remotion-specific parts (saveTimeline, createDebouncedTimelineSaver, getRemotionEnvironment check) stay in remotion/src/save-config.ts and import from shared.
Update viewer's save path (from Step 3) to import serializeForDisk from @shared/serialize.ts instead of reimplementing serialization.
Updateremotion/src/save-config.ts and remotion/src/timeline/Timeline.tsx (Studio wrapper) to import editor-utils from @shared/editor-utils.ts.
Step 5: Add @remotion/player to viewer and replace canvas preview
Scope: Large
This is the core integration. The @remotion/player<Player> component requires explicit fps, durationInFrames, compositionWidth, and compositionHeight props — it does not use Remotion's calculateMetadata (Root.tsx:33-48). The viewer must replicate that metadata computation.
Install@remotion/player, remotion, and any peer deps in viewer/package.json.
Createviewer/src/RemotionPreview.tsx:
Import Player from @remotion/player and TimelineRenderer from @shared/compositions/TimelineRenderer.
Accept config: ResolvedTimelineConfig and preview: boolean as props.
Compute Player metadata by replicating Root.tsx:33-48 logic:
Config ownership: The viewer passes config as a prop → Player passes it as inputProps → TimelineRenderer receives it. No polling inside the composition. The viewer is the sole config owner.
Expose imperative handle for seek/play/pause by forwarding Player's ref (PlayerRef has seekTo, play, pause, getCurrentFrame).
Wire Player's renderPlayPauseButton, or use a frame-change listener to report current time back to parent for timeline cursor sync.
Expose a ref to the Player container div (the DOM element) for OverlayEditor coordinate mapping (used in Step 6).
ReplaceLivePreview in App.tsx with RemotionPreview. Remove the canvas-based preview code.
Remotion compositions use clip.assetEntry.src for media URLs. In Studio, src comes from staticFile() which resolves via Remotion's dev server. In the viewer's Vite context, staticFile() is unavailable.
The viewer's loadTimelineJson() (from Step 3) already resolves src to Vite-served URLs (e.g., /inputs/demo-one.mp4). Verify that TimelineRenderer and its child components (VideoTrack.tsx:10-35, AudioTrack.tsx, OverlayTrack.tsx) only use clip.assetEntry.src for media URLs and never call staticFile() directly.
CheckBackground.tsx — if it uses staticFile() to load the background image from the asset registry, update it to use config.registry[bgAsset].src instead, or accept a resolved URL prop.
Ensure Vite serves the inputs/ directory. The existing viewer vite.config.ts likely already serves static files from the project root; verify /inputs/demo-one.mp4 is accessible. If not, add Vite static middleware: server.fs.allow for the project root and a middleware entry for /inputs/.
Validate: All video, audio, image, and background assets load and render correctly in the viewer's Remotion Player.
Step 7: Migrate OverlayEditor coordinate model
Scope: Medium
The current OverlayEditor (viewer/src/OverlayEditor.tsx:62-72, 166-180) computes scale and offsets from canvas.width / canvas.getBoundingClientRect(). With the canvas replaced by @remotion/player, the coordinate reference changes.
ChangeOverlayEditor props: replace canvasRef: React.RefObject<HTMLCanvasElement> with playerContainerRef: React.RefObject<HTMLDivElement> — a ref to the Player's wrapper div (exposed by RemotionPreview in Step 5).
RewritegetScale() (OverlayEditor.tsx:64-72):
The Player renders at compositionWidth × compositionHeight (e.g., 640×360 at preview scale 0.5). The Player div may be CSS-sized differently.
New scale computation: scaleX = playerRect.width / compositionWidth, scaleY = playerRect.height / compositionHeight. The backgroundScale factor from config.output.background_scale is already applied inside the Remotion composition via CSS transform: scale(...) (Timeline.tsx:81), so the overlay editor must account for it when mapping content coordinates to screen pixels: multiply scale by backgroundScale.
Remove canvas-specific offset computation (OverlayEditor.tsx:169-181). Replace with: the overlay div is positioned absolutely over the Player container, sized to match. Content offset within the container is (containerWidth * (1 - backgroundScale)) / 2 horizontally and vertically — same formula, different source element.
UpdatecontainerStyle computation to use playerContainerRef.current.getBoundingClientRect() instead of canvas.getBoundingClientRect().
Validate: Overlay drag-to-reposition works accurately on top of the Remotion Player. Test at different browser window sizes to confirm scale mapping is correct. Verify resize handles (nw/ne/sw/se) still work.
Step 8: Port ClipPanel, split, and mute into viewer
Scope: Medium
Portremotion/src/timeline/ClipPanel.tsx into viewer/src/ClipPanel.tsx:
Remove portal mounting logic (it was designed for Remotion Studio overlay).
Adapt to viewer's state: accept clip: ResolvedTimelineClip, assetEntry: ResolvedAssetRegistryEntry, and onChange: (clipId, patch) => void props.
Keep all field editors (at, from, to, speed, volume, hold, effects, x/y/width/height/opacity).
Wire onChange to update the clip in the viewer's config state and trigger save.
Integrate into App.tsx:
Add selectedClipId state.
When a clip is clicked in react-timeline-editor, set selectedClipId.
Render <ClipPanel> in a sidebar when a clip is selected.
Add split and mute operations:
Import splitClipAtPlayhead, toggleClipMute from @shared/editor-utils.ts.
Wire split: get current playhead time from RemotionPreview, call splitClipAtPlayhead(config, selectedClipId, playheadTime), update config and rows, trigger save.
Wire mute: call toggleClipMute(config, selectedClipId), update config, trigger save. Show visual indicator (dimmed waveform or mute icon) on muted clips.
Add keyboard shortcuts in App.tsx:
Space → play/pause (already exists or wire to RemotionPreview).
M → toggle mute on selected clip.
S → split selected clip at playhead.
Escape → deselect clip.
Validate: ClipPanel shows all editable properties. Split creates two correctly-timed clips. Mute sets volume to 0 and shows feedback. Keyboard shortcuts work. Verify effects are editable in ClipPanel and survive save/reload.
Step 9: Remove EditorOverlay from Remotion Studio
Scope: Small
Remove the <EditorOverlay> render from the Studio wrapper Timeline.tsx (the rewritten version from Step 2).
Deleteremotion/src/timeline/EditorOverlay.tsx and remotion/src/timeline/ClipPanel.tsx — their functionality now lives in the viewer and shared/ respectively.
Keepremotion/src/save-config.ts and server.mjs — Studio standalone still needs its own save endpoint.
Validate:npx remotion studio shows preview only, no editor overlay. Timeline composition still renders correctly.
Step 10: Remove legacy YAML path from viewer
Scope: Small
Removejs-yaml from viewer/package.json.
Remove any remaining YAML references in viewer/src/timeline-data.ts (parseTimeline, toYaml, RawTimeline, RawClip if fully replaced).
Remove YAML-specific API endpoints from viewer/vite.config.ts if they were replaced in Step 3.
UpdateCLAUDE.md to reflect that the viewer now reads/writes JSON and is the primary editor.
Do NOT delete timeline.yaml — keep it as a frozen legacy artifact per CLAUDE.md.
Execution Order
Step 1 (shared types) — foundation, no functional changes.
Step 2 (passive Timeline refactor) — required before Player integration; no visible behavior change.
Step 3 (JSON data layer) — highest risk, validates core data path. Canvas preview verifies JSON loading works before Remotion Player is added.
Step 4 (port editor-utils/serialize to shared) — pure functions, no UI changes.
Step 5 (Remotion Player) — the big integration. Depends on Steps 1-4.
Step 6 (asset serving) — must be done alongside or immediately after Step 5.
Step 8 (ClipPanel, split, mute) — depends on Steps 4-5. Can be done in parallel with Step 7.
Step 9 (remove EditorOverlay) — cleanup, only after viewer is fully functional.
Step 10 (remove YAML) — final cleanup.
Validation Order
After Step 2:npx remotion studio works identically — regression check only.
After Step 3: Viewer loads timeline from JSON, displays in react-timeline-editor, saves edits back to JSON. Canvas preview still works. Critical check: save a timeline with effects fields, reload, verify effects survive round-trip.
After Steps 5-6: Remotion Player shows pixel-perfect preview in viewer. All media assets load. Play/pause/seek/cursor sync work.
After Step 7: OverlayEditor drag-to-reposition works accurately on top of the Player at multiple window sizes.
After Step 8: ClipPanel shows all properties including effects. Split and mute work. Keyboard shortcuts work.
After Step 9: Remotion Studio has no editor overlay, preview-only.
After Step 10: No YAML dependencies remain in viewer. python3 tools/render.py still works.
code
Plan metadata:
{
"version": 2,
"timestamp": "2026-03-23T20:35:35Z",
"hash": "sha256:0f888717b9e89b73a6ee3860b27d1a8f1d60f79279208ceb8e88317d3075ca62",
"changes_summary": "Revised the plan to address all 6 significant flags from gate feedback:\n\n1. Player metadata (plan-player-metadata): Step 5 now explicitly replicates Root.tsx's calculateMetadata logic \u2014 computing fps, scaled width/height, and durationInFrames from config and passing them as Player props. Includes the exact code pattern.\n\n2. Dual config ownership (plan-dual-config-owners): Added new Step 2 that refactors Timeline.tsx into a passive TimelineRenderer (shared, stateless, no polling) and a thin Studio wrapper (keeps polling/state). The viewer passes config as a prop through Player \u2192 inputProps \u2192 TimelineRenderer, making the viewer the sole config owner.\n\n3. Asset registry metadata (plan-asset-registry-metadata): Step 3.2 now explicitly requires the upload handler to probe files with ffprobe to extract type, duration, resolution, and fps \u2014 creating complete AssetRegistryEntry objects, not just filename mappings.\n\n4. Effects dropped (plan-effects-dropped): Step 3.1 explicitly adds effects and hold fields to the viewer's in-memory ClipMeta type and requires the save path to use TIMELINE_CLIP_FIELDS-based serialization (imported from shared). Step 3.4 adds a round-trip validation check for effects.\n\n5. Overlay coordinate model (plan-overlay-coordinate-model): Added dedicated Step 7 with explicit coordinate migration: replacing canvas refs with Player container div refs, rewriting getScale() for compositionWidth/Height-based mapping, accounting for background_scale applied inside the composition.\n\n6. Structure (plan-structure-step-headings): Reformatted from ## Phase N / ### Step N to numbered ## Step N: top-level sections with numbered substeps.",
"flags_addressed": [
"plan-player-metadata",
"plan-dual-config-owners",
"plan-asset-registry-metadata",
"plan-effects-dropped",
"plan-overlay-coordinate-model",
"plan-structure-step-headings"
],
"questions": [
"Should the shared/ directory be set up as a proper npm workspace package (with its own package.json) or just use TypeScript path aliases? A workspace package is more rigorous but adds package management overhead. Path aliases are simpler but less portable.",
"The viewer's Vite dev server currently handles persistence (save-timeline, upload, render). Should we keep that Vite middleware AND the Remotion server.mjs (port 3111), or consolidate? Current plan keeps both \u2014 Vite for viewer, server.mjs for Studio standalone.",
"The viewer currently polls for external timeline changes every 1s. The Remotion editor uses a 1.5s reload loop. Should we keep polling or switch to file-watching via WebSocket (the viewer's Vite config already has a file watcher)?",
"Should python3 tools/render.py continue to be triggered from the viewer's Vite middleware, or should we switch to calling Remotion's render directly (e.g., npx remotion render)?",
"For the TimelineRenderer shared composition \u2014 should Remotion hooks like useCurrentFrame work inside @remotion/player without any additional provider wrapping? The Remotion docs say yes, but worth confirming with a quick spike."
],
"success_criteria": [
"Viewer loads and displays timeline from timeline.json + asset-registry.json (not timeline.yaml).",
"Viewer preview shows pixel-perfect Remotion output via @remotion/player \u2014 identical to what Remotion Studio shows.",
"Play, pause, seek, and timeline cursor sync work between the Player and react-timeline-editor.",
"Drag-drop clip placement (from AssetPanel), clip repositioning, and clip resizing in the timeline still work and save to JSON.",
"OverlayEditor drag-to-reposition works on top of the Remotion Player with correct coordinate mapping at different window sizes.",
"ClipPanel shows all editable properties (at, from, to, speed, volume, hold, effects) for the selected clip.",
"Split-at-playhead creates two correctly-timed clips.",
"Mute toggle sets volume to 0 and shows visual feedback.",
"Keyboard shortcuts (Space=play/pause, M=mute, S=split, Escape=deselect) all work.",
"Remotion Studio (npx remotion studio) shows preview only \u2014 no EditorOverlay or ClipPanel portal.",
"Auto-save writes valid timeline.json that Remotion Studio, Python tools, and the viewer can all read.",
"Effects and hold fields survive a full round-trip: edit in viewer \u2192 save \u2192 reload \u2192 verify present.",
"Uploaded assets get complete registry entries with type, duration, resolution, and fps metadata.",
"External changes to timeline.json (e.g., from Python tools) are detected and reloaded in the viewer.",
"python3 tools/render.py still works (reads timeline.json, renders via Remotion)."
],
"assumptions": [
"React 19 is compatible between viewer (React 19.2.0) and @remotion/player (Remotion 4.0.434 which supports React 19). No version conflicts expected.",
"The Remotion composition components (VideoTrack, AudioTrack, OverlayTrack, Background, Effects) have no hard dependency on Remotion Studio \u2014 they use standard Remotion hooks (useCurrentFrame, useVideoConfig) that work inside @remotion/player.",
"We will use a shared/ directory at the project root for types, compositions, and pure utility functions, with both viewer and remotion importing via TypeScript path aliases (@shared/, and the viewer's loadTimelineJson resolves src URLs accordingly instead of using Remotion's staticFile().",
"The existing auto-save debounce pattern (500ms in viewer) will be kept, adapted to serialize JSON instead of YAML.",
"ffprobe is available on the development machine for asset metadata extraction during upload. If unavailable, the upload handler falls back to extension-based type inference with a warning.",
"The TimelineRenderer composition (passive, no polling) works correctly inside @remotion/player when config is passed via inputProps \u2014 Remotion hooks like useCurrentFrame and useVideoConfig still function.",
"react-timeline-editor stays as the timeline UI \u2014 only the preview and data layer change."
],
"structure_warnings": [],
"delta_from_previous_percent": 80.72
}
code
Plan structure warnings from validator:
[]
Existing flags:
[
{
"id": "plan-player-metadata",
"concern": "Step 4 understates the Remotion Player integration. The current Timeline composition only gets the right fps, preview-scaled dimensions, durationInFrames, and loaded config through Root.tsx metadata; mounting <Player component={Timeline} ...> directly is not enough to reproduce Studio's output.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan-dual-config-owners",
"concern": "The plan does not include a refactor to separate a passive composition from the Studio controller. If the viewer embeds the current Timeline, the viewer and the composition will both own config loading/reloading, which is a real desync risk.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan-asset-registry-metadata",
"concern": "Step 2 treats asset-registry.json like a path map, but the repository uses it as a metadata registry. Updating upload/registration without a metadata-population step will create entries that Remotion cannot classify or validate correctly.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan-effects-dropped",
"concern": "The plan promises ClipPanel/property editing for effects, but it does not add effect fields to the viewer's in-memory model or save path. As written, viewer saves would strip fade/effect data from timeline.json.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan-overlay-coordinate-model",
"concern": "Overlay editing is not a simple canvas-to-div substitution. The current overlay editor derives its hit-testing and box placement from a real canvas plus a manually shrunken content region, while the Remotion composition applies background_scale through CSS transforms. The plan needs an explicit coordinate-system migration step.",
"status": "addressed",
"severity": "significant"
},
{
"id": "plan-structure-step-headings",
"concern": "The plan does not follow the required structure. It uses phase headings plus ### Step N subsections instead of numbered ## Step N: sections with numbered substeps.",
"status": "addressed",
"severity": "significant"
}
]
code
Requirements:
- Consider whether the plan is at the right level of abstraction.
- Reuse existing flag IDs when the same concern is still open.
- `verified_flag_ids` should list previously addressed flags that now appear resolved.
- Focus on concrete issues that would cause real problems.
- Robustness level: standard. Use balanced judgment. Flag significant risks, but do not spend flags on minor polish or executor-obvious boilerplate.
- Verify that the plan remains aligned with the user's original intent.
- Verify that the plan follows the expected structure: one H1 title, `## Overview`, numbered `## Step N:` sections with file references and numbered substeps, plus `## Execution Order` or `## Validation Order`. Missing structure should be flagged as category `completeness` with severity_hint `likely-significant`.
- Flag scope creep explicitly when the plan grows beyond the original idea or recorded user notes. Use the phrase "Scope creep:" in the concern.
- Assign severity_hint carefully. Implementation details the executor will naturally resolve should usually be `likely-minor`.
Change initial load from YAML fetch to loadTimelineJson().
Change auto-save (500ms debounce) to POST JSON via rowsToConfig() → /api/save-timeline.
Change external-change polling to compare JSON signature via getConfigSignature() from @shared/config-utils.ts.
Validate: Viewer loads, displays timeline from JSON, saves edits back to JSON. Canvas preview still works (will be replaced in Step 5). Critically: save a timeline with effects, reload, verify effects survive the round-trip.
).",
"The viewer's Vite middleware will handle JSON persistence directly (reading/writing timeline.json), rather than proxying to server.mjs. server.mjs remains for Remotion Studio standalone use.",
"Asset file paths in asset-registry.json (e.g., 'inputs/demo-one.mp4') will be served by Vite's static file middleware at /inputs/