This document defines the from-scratch rewrite direction for the next version of the project.
Current decision: prioritize UI/UX design first, then implementation.
The repository has been intentionally cleaned up to focus on V2:
- Legacy desktop UI runtime and Windows packaging assets were removed from active project structure.
- Active stack is now:
- Web UI in
app/web - Backend API in
app/backend - Reused algorithm modules in
app/backend/algorithms
A working UI prototype is now available at:
app/web/
From repo root:
python3 -m http.server 4173Then open:
http://localhost:4173/app/web/
In a separate terminal from repo root:
python3 -m uvicorn app.backend.main:app --host 127.0.0.1 --port 8000 --reloadHealth check:
curl http://127.0.0.1:8000/api/healthContract check:
curl http://127.0.0.1:8000/api/contract- Import local video clip in browser.
- Auto-generate metadata (duration, resolution, estimated fps/frame count).
- Generate detailed shot data:
- average shot length (global)
- average scene length
- average shot length per scene
- shot scale composition per scene (heuristic)
- Scene-level color analysis:
- per-scene dominant color
- color wheel with dominant hue highlighted
- Scene-level object analysis:
- object detector output aggregated to scene-level notable props
- fallback heuristic props if detector is unavailable
- API-driven frontend:
- web UI calls
POST /api/analyze - exports JSON/CSV from backend response model
The web UI is now connected to a real backend contract and existing Python algorithms. Some modules still use pragmatic fallback behavior when optional model inference fails.
pyCinemetrics/
├── app/
│ ├── __init__.py
│ ├── backend/
│ │ ├── __init__.py
│ │ ├── main.py # FastAPI app + /api endpoints
│ │ ├── analysis_pipeline.py # Scene/shot orchestration
│ │ └── algorithms/ # Integrated analysis modules (migrated legacy core)
│ └── web/
│ ├── index.html # Cinematic UI shell
│ ├── styles.css # Dark cinema theme
│ └── app.js # API-driven frontend logic
├── docs/
│ └── RELEASE.md
├── models/ # Model assets/weights
├── img/ # Generated analysis outputs (gitignored except .gitkeep)
├── video/ # Optional local input clips
├── pyproject.toml
├── uv.lock
├── README.md
└── .github/workflows/ci.yml
multipart/form-data request fields:
video(binary, required)scene_sensitivity(int 1..10, default6)shot_threshold(float 0.05..0.95, default0.35)include_object_detection(bool, defaulttrue)include_shot_scale(bool, defaulttrue)
Response keys:
metaglobalshotsscenesoutputs
The response is designed to directly power the web UI tabs.
Implemented and integrated:
- Scene/shot analysis backend endpoint with contract.
- Existing algorithms integrated in backend pipeline:
- shot boundary generation (
TransNetV2) - shot scale inference (
shotscale) - object detection (
ObjectDetection)
- Scene-level metrics generated from backend output:
- ASL (global)
- average scene length
- average shot length per scene
- shot scale composition per scene
- Scene-level color and props summaries surfaced in UI.
- Export flows (JSON / scenes CSV / shots CSV) from live analysis results.
KIV (kept intentionally for now):
- LLM API integration (UI draft generator is local template only).
- Deeper semantic scene interpretation pipeline.
Build a scene-centric film analysis app with a clear, modern interface where users can:
- Import one video clip.
- Instantly get metadata and high-level structure.
- Explore analytics by scene first, then drill down to shots.
- Export interpretable visual and tabular outputs.
- Video Import + Metadata Generation
- Once user imports a clip, generate metadata:
- filename, duration, fps, resolution, frame count
- shot count, scene count
- timecode range for each scene
- Detailed Shot Data
- Generate average shot length (ASL).
- Generate average scene length (new).
- Generate average shot length per scene (new).
- Include shot scale composition per scene (new):
- long / medium / close-up proportions per scene
- Scene-Level Color Analysis
- Compute dominant color at scene level (not shot level).
- Render a color wheel and highlight dominant hue per scene.
- Scene-Level Object Detection
- Output notable props per scene.
- Keep output structured so future LLM interpretation can be plugged in.
- Scene-first storytelling
- Scene becomes the default unit for navigation and comparison.
- Progressive disclosure
- First show summary metrics, then reveal detailed charts and tables.
- One primary path
- Import -> Process -> Explore -> Export.
- Readable over technical
- Keep labels academic but understandable for non-engineers.
- Import Screen
- Dropzone / file picker
- recent projects
- processing requirements hint
- Project Overview Dashboard
- metadata cards
- timeline strip with scene segmentation
- global KPIs (ASL, avg scene length, total scenes, total shots)
- Detailed Shot Data View
- scene table
- per-scene metrics:
- scene duration
- shot count
- avg shot length in that scene
- shot scale composition (stacked bars or donuts)
- Color Analysis View
- scene list on left
- color wheel on right
- dominant scene hue highlighted
- optional secondary palette per scene
- Object Analysis View
- scene list
- notable props chips/tags per scene
- confidence/occurrence ranking
- placeholder panel: “LLM interpretation (future)”
- Export Center
- export CSV/JSON
- export chart PNG/SVG
- export per-scene report bundle
- User imports a clip.
- System computes metadata + shot boundaries + scene boundaries.
- User lands on Overview with key numbers and segmented timeline.
- User opens “Detailed Shot Data” for scene/shot structural metrics.
- User opens “Color Analysis” and “Object Analysis” for scene meaning cues.
- User exports selected outputs.
Define these entities early so UI and backend stay aligned:
VideoMeta
- id, filename, duration_s, fps, width, height, frame_count
Scene
- scene_id, start_frame, end_frame, start_tc, end_tc, duration_s
Shot
- shot_id, scene_id, start_frame, end_frame, duration_s, shot_scale
SceneColorSummary
- scene_id, dominant_hue_deg, dominant_rgb, wheel_bin, palette[]
SceneObjectSummary
- scene_id, objects[] (
label,score,count)
pyCinemetrics/
├── docs/
│ ├── product/
│ │ ├── vision.md
│ │ ├── user-flows.md
│ │ └── metrics-definitions.md
│ ├── ui/
│ │ ├── information-architecture.md
│ │ ├── wireframes.md
│ │ └── component-spec.md
│ └── api/
│ └── ui-data-contracts.md
├── app/
│ ├── web/
│ └── backend/
│ └── algorithms/
└── README.md
- M0 - Design Spec Complete
- finalize IA, wireframes, metric definitions, scene/shot terminology
- M1 - Clickable Prototype
- no real model inference
- mock data for all major screens
- M2 - Real Data Integration
- metadata + scene/shot metrics endpoints connected
- M3 - Analysis Views
- scene-level color wheel and object summaries from real pipeline
- M4 - Export + Review
- report export and analyst feedback cycle
- Perfect model accuracy.
- Full cloud deployment.
- LLM meaning analysis (only keep integration-ready output format now).
- Freeze KPI definitions:
- ASL, average scene length, average shot length per scene.
- Lock the scene detection strategy:
- choose algorithm and scene/shot merge rule.
- Draft wireframes for these 5 screens:
- Import, Overview, Detailed Shot Data, Color Analysis, Object Analysis.
- Define API/JSON contracts for all UI panels before coding.
This V2 rewrite is built in respect of the original PyCinemetrics effort and contributors.
Please cite and acknowledge the original work:
- Project portal: https://movie.yingshinet.com
- Research paper: https://www.sciencedirect.com/science/article/pii/S2352711024000578
V2 changes focus on architecture, UI, and API modernization while preserving the research intent of computational film analysis.