|
| 1 | +# FFprobe API - Docker Usage Guide |
| 2 | + |
| 3 | +A simple, ready-to-use Docker image for video file analysis using FFprobe. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +### Pull and Run |
| 8 | +```bash |
| 9 | +# Download and run the image |
| 10 | +docker run -d -p 8080:8080 rendiffdev/ffprobe-api:minimal |
| 11 | + |
| 12 | +# Or use the latest tag |
| 13 | +docker run -d -p 8080:8080 rendiffdev/ffprobe-api:latest |
| 14 | +``` |
| 15 | + |
| 16 | +### Health Check |
| 17 | +```bash |
| 18 | +curl http://localhost:8080/health |
| 19 | +``` |
| 20 | + |
| 21 | +### Analyze a Video File |
| 22 | +```bash |
| 23 | +# Upload and analyze a video file |
| 24 | +curl -X POST http://localhost:8080/api/v1/probe -F "file=@your-video.mp4" |
| 25 | +``` |
| 26 | + |
| 27 | +## Available Images |
| 28 | + |
| 29 | +- `rendiffdev/ffprobe-api:minimal` - Main minimal working image |
| 30 | +- `rendiffdev/ffprobe-api:latest` - Alias for minimal |
| 31 | +- `rendiffdev/ffprobe-api:working` - Alias for minimal |
| 32 | + |
| 33 | +## API Endpoints |
| 34 | + |
| 35 | +### Health Check |
| 36 | +- **URL**: `GET /health` |
| 37 | +- **Response**: JSON with status information |
| 38 | + |
| 39 | +```json |
| 40 | +{ |
| 41 | + "status": "healthy", |
| 42 | + "timestamp": "2025-01-18T12:00:00.000000", |
| 43 | + "version": "1.0.0-minimal", |
| 44 | + "ffprobe_available": true |
| 45 | +} |
| 46 | +``` |
| 47 | + |
| 48 | +### Video Analysis |
| 49 | +- **URL**: `POST /api/v1/probe` |
| 50 | +- **Content-Type**: `multipart/form-data` |
| 51 | +- **Parameter**: `file` (video file to analyze) |
| 52 | + |
| 53 | +```json |
| 54 | +{ |
| 55 | + "file_id": "uuid-here", |
| 56 | + "filename": "your-video.mp4", |
| 57 | + "analysis": { |
| 58 | + "format": { ... }, |
| 59 | + "streams": [ ... ] |
| 60 | + }, |
| 61 | + "timestamp": "2025-01-18T12:00:00.000000" |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +### Version Information |
| 66 | +- **URL**: `GET /api/v1/version` |
| 67 | + |
| 68 | +## Docker Compose Example |
| 69 | + |
| 70 | +```yaml |
| 71 | +version: '3.8' |
| 72 | + |
| 73 | +services: |
| 74 | + ffprobe-api: |
| 75 | + image: rendiffdev/ffprobe-api:minimal |
| 76 | + ports: |
| 77 | + - "8080:8080" |
| 78 | + volumes: |
| 79 | + - "./uploads:/app/uploads" |
| 80 | + - "./reports:/app/reports" |
| 81 | + - "./logs:/app/logs" |
| 82 | + environment: |
| 83 | + - LOG_LEVEL=info |
| 84 | + healthcheck: |
| 85 | + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] |
| 86 | + interval: 30s |
| 87 | + timeout: 10s |
| 88 | + retries: 3 |
| 89 | + start_period: 10s |
| 90 | +``` |
| 91 | +
|
| 92 | +## Persistent Storage |
| 93 | +
|
| 94 | +The image provides volume mount points for: |
| 95 | +
|
| 96 | +- `/app/uploads` - Uploaded files (temporary storage) |
| 97 | +- `/app/reports` - Analysis reports |
| 98 | +- `/app/logs` - Application logs |
| 99 | + |
| 100 | +## Platform Support |
| 101 | + |
| 102 | +- **Architecture**: AMD64/x86_64 only |
| 103 | +- **Optimized for**: Cloud instances, CI/CD, production deployments |
| 104 | +- **Base**: Alpine Linux 3.20 |
| 105 | + |
| 106 | +## Features |
| 107 | + |
| 108 | +✅ **Zero Configuration** - Works out of the box |
| 109 | +✅ **Latest FFmpeg** - BtbN static builds included |
| 110 | +✅ **Python Flask API** - Simple REST interface |
| 111 | +✅ **Health Checks** - Docker native health monitoring |
| 112 | +✅ **Security** - Non-root user, minimal attack surface |
| 113 | +✅ **Lightweight** - Alpine Linux base (~150MB) |
| 114 | + |
| 115 | +## Examples |
| 116 | + |
| 117 | +### Basic Usage |
| 118 | +```bash |
| 119 | +# Start the service |
| 120 | +docker run -d --name ffprobe-api -p 8080:8080 rendiffdev/ffprobe-api:minimal |
| 121 | +
|
| 122 | +# Wait for startup |
| 123 | +sleep 5 |
| 124 | +
|
| 125 | +# Check if it's working |
| 126 | +curl http://localhost:8080/health |
| 127 | +
|
| 128 | +# Analyze a video file |
| 129 | +curl -X POST http://localhost:8080/api/v1/probe -F "file=@sample.mp4" | jq . |
| 130 | +
|
| 131 | +# Stop the service |
| 132 | +docker stop ffprobe-api && docker rm ffprobe-api |
| 133 | +``` |
| 134 | + |
| 135 | +### With Volume Mounting |
| 136 | +```bash |
| 137 | +# Create local directories |
| 138 | +mkdir -p ./data/{uploads,reports,logs} |
| 139 | +
|
| 140 | +# Run with persistent storage |
| 141 | +docker run -d --name ffprobe-api \ |
| 142 | + -p 8080:8080 \ |
| 143 | + -v ./data/uploads:/app/uploads \ |
| 144 | + -v ./data/reports:/app/reports \ |
| 145 | + -v ./data/logs:/app/logs \ |
| 146 | + rendiffdev/ffprobe-api:minimal |
| 147 | +``` |
| 148 | + |
| 149 | +### Production Deployment |
| 150 | +```bash |
| 151 | +# Run with resource limits and restart policy |
| 152 | +docker run -d --name ffprobe-api \ |
| 153 | + -p 8080:8080 \ |
| 154 | + --memory=1g \ |
| 155 | + --cpus=2 \ |
| 156 | + --restart=unless-stopped \ |
| 157 | + -v ffprobe-uploads:/app/uploads \ |
| 158 | + -v ffprobe-reports:/app/reports \ |
| 159 | + -v ffprobe-logs:/app/logs \ |
| 160 | + rendiffdev/ffprobe-api:minimal |
| 161 | +``` |
| 162 | + |
| 163 | +## Troubleshooting |
| 164 | + |
| 165 | +### Container won't start |
| 166 | +```bash |
| 167 | +# Check logs |
| 168 | +docker logs ffprobe-api |
| 169 | +
|
| 170 | +# Check if port is available |
| 171 | +netstat -tulnp | grep :8080 |
| 172 | +``` |
| 173 | + |
| 174 | +### Health check fails |
| 175 | +```bash |
| 176 | +# Check container status |
| 177 | +docker ps -a |
| 178 | +
|
| 179 | +# Check health check details |
| 180 | +docker inspect ffprobe-api | jq '.[0].State.Health' |
| 181 | +``` |
| 182 | + |
| 183 | +### Analysis fails |
| 184 | +- Ensure uploaded file is a valid video format |
| 185 | +- Check file size (default limit: 100MB) |
| 186 | +- Verify FFmpeg supports the codec |
| 187 | + |
| 188 | +## Limitations |
| 189 | + |
| 190 | +- AMD64 architecture only (use on Intel/AMD servers) |
| 191 | +- 100MB file size limit |
| 192 | +- Basic FFprobe analysis only (no advanced features) |
| 193 | +- Single-threaded processing |
| 194 | + |
| 195 | +## Support |
| 196 | + |
| 197 | +This is a simplified working version. For the full-featured implementation: |
| 198 | +- Check the GitHub repository |
| 199 | +- Review the original Go-based API |
| 200 | +- Consider building from source for complete features |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +**Docker Hub**: https://hub.docker.com/r/rendiffdev/ffprobe-api |
| 205 | +**Ready for immediate deployment!** 🚀 |
0 commit comments