From 01b83cec2013f5d51ae8be7d087486abb2c1033c Mon Sep 17 00:00:00 2001 From: JSLMPR Date: Wed, 8 Jul 2026 17:00:58 +0200 Subject: [PATCH] initial --- .gitignore | 38 +++++++ .idea/.gitignore | 8 ++ .idea/encodings.xml | 7 ++ .idea/misc.xml | 14 +++ .idea/vcs.xml | 6 ++ .../video-clipping-service-planning-prompt.md | 99 +++++++++++++++++++ pom.xml | 17 ++++ src/main/java/org/example/Main.java | 7 ++ 8 files changed, 196 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 docs/video-clipping-service-planning-prompt.md create mode 100644 pom.xml create mode 100644 src/main/java/org/example/Main.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ba0b4af --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/docs/video-clipping-service-planning-prompt.md b/docs/video-clipping-service-planning-prompt.md new file mode 100644 index 0000000..8acf18f --- /dev/null +++ b/docs/video-clipping-service-planning-prompt.md @@ -0,0 +1,99 @@ +# Video Clipping Service Planning Prompt + +Use this prompt to ask an AI to create a production-grade implementation plan for a Java Spring Boot video clipping microservice. + +```text +You are a senior Java/Spring Boot backend architect specializing in large-scale media-processing systems. + +Create a production-grade implementation plan for a Java Spring Boot microservice that accepts very large video files and generates 8-second video clips. + +Before answering, research current official or primary documentation for: +- Spring Boot and Java supported production versions. +- FFmpeg segmenting behavior and keyframe accuracy. +- Object-storage multipart/resumable upload best practices. +- Queue-based async processing. +- Kubernetes deployment, probes, resource limits, and observability. +- Spring Boot testing and Testcontainers. + +Use citations or source links for important version and architecture claims. + +Design principles: +- Do not load entire video files into application memory. +- Prefer direct-to-object-storage upload using signed URLs and multipart/resumable upload. +- Separate API service from video-processing workers. +- Use durable job state, retryable queues, idempotency, and cleanup. +- Explain the performance tradeoff between fast keyframe-aligned clipping and exact 8-second frame-accurate clipping. +- Use FFmpeg safely through isolated worker processes, not inline request processing. + +Include these sections: + +1. Goal and Scope +Define the service, assumptions, non-goals, supported formats, max file size, expected concurrency, and cloud/runtime assumptions. + +2. Architecture +Design the full flow: +Client -> API -> signed upload URL -> object storage -> job record -> queue -> worker -> FFmpeg -> generated clips -> object storage -> job status. + +Explain API service, worker service, database, queue, object storage, temporary disk, and cleanup responsibilities. + +3. Technology Stack +Recommend Java version, Spring Boot version, database, queue, object storage, FFmpeg packaging, container base image, observability tools, and testing tools. Explain each choice. + +4. API Contract +Design versioned REST endpoints using noun-based paths: +- Create video asset/upload session. +- Complete upload/register uploaded object. +- Create or start clip-generation job. +- Get job status. +- List generated clips. +- Get signed download URLs. +- Cancel/delete job. + +For each endpoint include method, path, auth, idempotency, request schema, response schema, and examples. + +5. Validation and Security +Include authn/authz, file size limits, media type checks, video probing, malware scanning, rate limiting, signed URL expiry, object key safety, tenant isolation, sensitive logging rules, and error handling. + +6. Video Processing Design +Explain FFmpeg commands and strategy for: +- Fast segmentation using stream copy where acceptable. +- Accurate 8-second segmentation using transcoding/forced keyframes where required. +- Handling the final shorter segment. +- Audio/video sync. +- Variable frame rate videos. +- Corrupt inputs. +- Progress tracking. +- Retry behavior. +- Partial-output cleanup. + +7. Data Model +Define tables/entities for video assets, upload sessions, processing jobs, generated clips, and job events. Include indexes, lifecycle states, and timestamps. + +8. Performance and Scalability +Cover streaming, object-storage bandwidth, worker concurrency, CPU/memory/disk sizing, queue backpressure, autoscaling, timeout handling, large-file resilience, benchmarking, and cost tradeoffs. + +9. Error Model +Use `application/problem+json` for non-2xx errors. Map 400, 401, 403, 404, 409, 413, 415, 422, 429, 500, and 503 with examples. + +10. Testing Strategy +Include unit, integration, API contract, FFmpeg, queue, object-storage, large-file, failure/retry, security, load, and end-to-end tests. Use JUnit 5, Spring Boot test support, Testcontainers, realistic video fixtures, and mocked/sandboxed cloud services where appropriate. + +11. Deployment and Operations +Include Docker, Kubernetes API and worker deployments, readiness/liveness/startup probes, resource requests/limits, ephemeral storage, horizontal autoscaling, metrics, logs, traces, alerts, dashboards, dead-letter queues, cleanup jobs, and disaster recovery. + +12. Project Structure +Propose a clean/hexagonal Spring Boot package structure separating API, application services, domain, persistence, queue, storage, FFmpeg adapter, config, and tests. + +13. Implementation Milestones +Break implementation into MVP, production hardening, performance tuning, and operational readiness. + +14. Open Questions +List decisions needed before implementation, especially: +- Exact vs keyframe-aligned 8-second clips. +- Maximum file size. +- Supported codecs/containers. +- Cloud provider. +- Auth provider. +- Expected upload and processing volume. +- Retention policy. +``` diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7fb31a3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.example + video-editing + 1.0-SNAPSHOT + + + 21 + 21 + UTF-8 + + + \ No newline at end of file diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java new file mode 100644 index 0000000..407f157 --- /dev/null +++ b/src/main/java/org/example/Main.java @@ -0,0 +1,7 @@ +package org.example; + +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} \ No newline at end of file