{"id":31534035,"url":"https://github.com/thatguychandan/vidproc","last_synced_at":"2025-10-04T05:16:33.440Z","repository":{"id":315293971,"uuid":"1058731200","full_name":"ThatGuyChandan/VidProc","owner":"ThatGuyChandan","description":"A FastAPI backend for video processing, enabling upload, trimming, overlays (text, image, video), watermarking, and multi-quality generation.   Features asynchronous job handling with Celery/Redis and PostgreSQL integration, all containerized with Docker Compose.","archived":false,"fork":false,"pushed_at":"2025-09-17T18:19:47.000Z","size":4083,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-17T20:53:07.206Z","etag":null,"topics":["docker-compose","fastapi","ffmpeg","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ThatGuyChandan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-17T13:27:58.000Z","updated_at":"2025-09-17T18:33:05.000Z","dependencies_parsed_at":"2025-09-17T20:53:08.839Z","dependency_job_id":"04774d2a-c117-4490-a4c2-362d93527a48","html_url":"https://github.com/ThatGuyChandan/VidProc","commit_stats":null,"previous_names":["thatguychandan/vidproc"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ThatGuyChandan/VidProc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatGuyChandan%2FVidProc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatGuyChandan%2FVidProc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatGuyChandan%2FVidProc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatGuyChandan%2FVidProc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThatGuyChandan","download_url":"https://codeload.github.com/ThatGuyChandan/VidProc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThatGuyChandan%2FVidProc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278266896,"owners_count":25958733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","fastapi","ffmpeg","python"],"created_at":"2025-10-04T05:16:27.614Z","updated_at":"2025-10-04T05:16:33.432Z","avatar_url":"https://github.com/ThatGuyChandan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend Engineer (Contract Role) Assignment – Video Processing APIs\n\nThis project is a FastAPI backend that handles video upload, processing (using ffmpeg), and database storage (Postgres).\n\n## Features\n\n- **Level 1 – Upload \u0026 Metadata:**\n    - API to upload a video.\n    - Store metadata in DB (filename, duration, size, upload_time).\n    - API to list uploaded videos.\n- **Level 2 – Trimming API:**\n    - `POST /trim` → Accept video ID + start/end timestamps.\n    - Return a trimmed video file.\n    - Save trimmed video info in DB (link back to original).\n- **Level 3 – Overlays \u0026 Watermarking:**\n    - API to add **text, image and video overlays** with position \u0026 timing.\n    - API to add a **watermark** (image/logo).  \n    - Store overlay/watermark config in DB.\n- **Level 4 – Async Job Queue:**\n    - Asynchronous processing with Celery/Redis.\n    - Return a `job_id` immediately.\n    - `GET /status/{job_id}` → job status.\n    - `GET /result/{job_id}` → download processed video.\n- **Level 5 – Multiple Output Qualities:**\n    - API to generate multiple versions of video (`1080p`, `720p`, `480p`).\n    - Store all versions in DB.\n    - API to fetch/download specific quality.\n\n## Project Structure\n\n```\n.\n├── backend\n│   ├── celery_worker.py\n│   ├── crud.py\n│   ├── database.py\n│   ├── Dockerfile\n│   ├── __init__.py\n│   ├── main.py\n│   ├── models.py\n│   └── schemas.py\n├── docker-compose.yml\n├── fonts\n│   └── NotoSans-Regular.ttf\n├── overlays\n│   └── logo.png\n├── outputs\n├── qualities\n├── requirements.txt\n├── trims\n└── README.md\n```\n\n## Setup with Docker\n\n1.  **Prerequisites:**\n    - Docker\n    - Docker Compose\n\n2.  **Environment Variables:**\n    Create a `.env` file in the root of the project. You can use the following as a template. These credentials will be used to create the PostgreSQL database.\n    ```\n    POSTGRES_USER=user\n    POSTGRES_PASSWORD=password\n    POSTGRES_DB=videodb\n    ```\n\n3.  **Download Assets:**\n    Download the assets from the provided Google Drive link and place them in the appropriate directories (in the root of the project):\n    -   `fonts/` (e.g., `NotoSans-Regular.ttf`)\n    -   `overlays/` (for images and videos)\n\n4.  **Build and Run with Docker Compose:**\n    ```bash\n    docker-compose up --build\n    ```\n\n## API Usage and Testing\n\nThe API documentation is available at `http://localhost:8000/docs` after running the application.\n\nBelow are some `curl` commands to test the endpoints. Please replace the placeholders with actual values.\n\n### 1. Upload a Video\n\n```bash\ncurl -X POST -F \"file=@/path/to/your/video.mp4\" http://localhost:8000/upload/\n```\n\nThis will return a `job_id`. You can use this `job_id` to check the status of the upload and get the result.\n\n### 2. Check Job Status\n\n```bash\ncurl http://localhost:8000/status/{job_id}\n```\n\n### 3. Get Job Result\n\nOnce the job is completed, you can get the result. For the upload endpoint, this will be the metadata of the video.\n\n```bash\ncurl http://localhost:8000/result/{job_id}\n```\n\n### 4. List Videos\n\n```bash\ncurl http://localhost:8000/videos/\n```\n\nThis will return a list of all uploaded videos with their metadata. Note the `id` of the video you want to use for the next steps.\n\n### 5. Trim a Video\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"start_time\": 0, \"end_time\": 5}' http://localhost:8000/trim/\n```\n\nThis will return a new `job_id`. You can use this `job_id` to get the trimmed video.\n\n### 6. Add a Text Overlay\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"text\": \"Hello World\", \"x\": 10, \"y\": 10, \"start_time\": 0, \"end_time\": 5}' http://localhost:8000/overlays/text\n```\n\n### 7. Add an Image Overlay\n\nMake sure you have an image file (e.g., `logo.png`) in the `overlays` directory.\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"image_name\": \"logo.png\", \"x\": 10, \"y\": 10, \"start_time\": 0, \"end_time\": 5}' http://localhost:8000/overlays/image\n```\n\n### 8. Add a Video Overlay\n\nMake sure you have a video file (e.g., `overlay.mp4`) in the `overlays` directory.\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"video_name\": \"overlay.mp4\", \"x\": 10, \"y\": 10, \"start_time\": 0, \"end_time\": 5}' http://localhost:8000/overlays/video\n```\n\n### 9. Add a Watermark\n\nMake sure you have an image file (e.g., `watermark.png`) in the `overlays` directory.\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"image_name\": \"watermark.png\"}' http://localhost:8000/watermark\n```\n\n### 10. Generate Different Qualities\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"video_id\": 1, \"quality\": \"480p\"}' http://localhost:8000/quality\n```\n\n### 11. Get a Specific Quality\n\n```bash\ncurl http://localhost:8000/videos/1/quality/480p -o output_480p.mp4\n```\n\n## Workflow Diagram\n\n```mermaid\ngraph TD\n    A[User] --\u003e B{Upload Video}\n    B --\u003e C[FastAPI App]\n    C --\u003e D[Celery Task]\n    D --\u003e E{Processing Complete}\n    E --\u003e F[Store Metadata in DB]\n    E --\u003e G[Save Processed Video]\n\n    C --\u003e H[Return Job ID]\n    H --\u003e I{Check Job Status}\n    I --\u003e J[Get Job Result]\n\n    subgraph Video Operations\n        K[Trim Video]\n        L[Add Text Overlay]\n        M[Add Image Overlay]\n        N[Add Video Overlay]\n        O[Add Watermark]\n        P[Generate Multiple Qualities]\n    end\n\n    B --\u003e K\n    B --\u003e L\n    B --\u003e M\n    B --\u003e N\n    B --\u003e O\n    B --\u003e P\n\n    K --\u003e D\n    L --\u003e D\n    M --\u003e D\n    N --\u003e D\n    O --\u003e D\n    P --\u003e D\n\n    J --\u003e Q[Download Processed Video]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatguychandan%2Fvidproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthatguychandan%2Fvidproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthatguychandan%2Fvidproc/lists"}