initial
This commit is contained in:
commit
01b83cec20
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -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.
|
||||
```
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>video-editing</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package org.example;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue