Mercurial
comparison medi/README.md @ 217:7ef4c9d2a72d hg-web
[DO NOT PUSH] Random values.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sun, 25 Jan 2026 10:44:04 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 192:b818a4561a3c | 217:7ef4c9d2a72d |
|---|---|
| 1 # medi | |
| 2 | |
| 3 Media upload and processing server. Upload images and videos, get optimized WebP images and HLS video streams. | |
| 4 | |
| 5 ## Features | |
| 6 | |
| 7 - **Image Upload**: Converts to WebP format with configurable quality | |
| 8 - **Video Upload**: Converts to HLS streaming format with thumbnails | |
| 9 - **Background Processing**: Non-blocking uploads with status polling | |
| 10 - **Web UI**: Drag-and-drop upload interface | |
| 11 - **REST API**: Programmatic access to upload and retrieve media | |
| 12 | |
| 13 ## Running | |
| 14 | |
| 15 ```bash | |
| 16 # Build and run | |
| 17 bazel run //medi:medi | |
| 18 | |
| 19 # Run on custom port | |
| 20 bazel run //medi:medi -- 3000 | |
| 21 ``` | |
| 22 | |
| 23 Server starts at `http://localhost:8080` by default. | |
| 24 | |
| 25 ## API | |
| 26 | |
| 27 ### Upload Media | |
| 28 | |
| 29 ```bash | |
| 30 POST /api/upload | |
| 31 Content-Type: multipart/form-data | |
| 32 | |
| 33 # Response | |
| 34 { | |
| 35 "id": "1706123456_12345_0", | |
| 36 "type": "image", | |
| 37 "status": "processing" | |
| 38 } | |
| 39 ``` | |
| 40 | |
| 41 ### Get Media Info | |
| 42 | |
| 43 ```bash | |
| 44 GET /api/media/{id} | |
| 45 | |
| 46 # Response (completed image) | |
| 47 { | |
| 48 "id": "1706123456_12345_0", | |
| 49 "type": "image", | |
| 50 "status": "completed", | |
| 51 "webp": "/media/1706123456_12345_0/image.webp", | |
| 52 "original": "/media/1706123456_12345_0/original.jpg" | |
| 53 } | |
| 54 | |
| 55 # Response (completed video) | |
| 56 { | |
| 57 "id": "1706123456_12345_1", | |
| 58 "type": "video", | |
| 59 "status": "completed", | |
| 60 "hls": "/media/1706123456_12345_1/video.m3u8", | |
| 61 "thumbnail": "/media/1706123456_12345_1/video_thumb.jpg", | |
| 62 "original": "/media/1706123456_12345_1/original.mp4" | |
| 63 } | |
| 64 ``` | |
| 65 | |
| 66 ### List All Media | |
| 67 | |
| 68 ```bash | |
| 69 GET /api/media | |
| 70 | |
| 71 # Response | |
| 72 { | |
| 73 "items": [ | |
| 74 {"id": "1706123456_12345_0", "type": "image"}, | |
| 75 {"id": "1706123456_12345_1", "type": "video"} | |
| 76 ] | |
| 77 } | |
| 78 ``` | |
| 79 | |
| 80 ## Output Structure | |
| 81 | |
| 82 ``` | |
| 83 uploads/ # Temporary upload storage (deleted after processing) | |
| 84 media/ # Processed media | |
| 85 ├── {id}/ | |
| 86 │ ├── original.{ext} # Original uploaded file | |
| 87 │ ├── image.webp # (images) WebP conversion | |
| 88 │ ├── video.m3u8 # (videos) HLS playlist | |
| 89 │ ├── video_000.ts # (videos) HLS segments | |
| 90 │ └── video_thumb.jpg # (videos) Thumbnail | |
| 91 ``` | |
| 92 | |
| 93 ## Supported Formats | |
| 94 | |
| 95 ### Images | |
| 96 JPG, JPEG, PNG, GIF, WebP, BMP, TIFF, HEIC, AVIF | |
| 97 | |
| 98 ### Videos | |
| 99 MP4, MOV, AVI, MKV, WebM, FLV, WMV, M4V, 3GP | |
| 100 | |
| 101 ## Dependencies | |
| 102 | |
| 103 - `//seobeo:seobeo` - HTTP server | |
| 104 - `//media_processor:media_processor` - Media processing | |
| 105 - FFmpeg (system installed) | |
| 106 | |
| 107 ## Building | |
| 108 | |
| 109 ```bash | |
| 110 bazel build //medi:medi | |
| 111 ``` |