A small self-hosted web app that downloads, converts and shrinks media to fit, on the GPU when there is one, and then cleans up after itself.
Three things, one container, no accounts and no library to curate:
- Download: video or audio from YouTube and the hundreds of other sites
yt-dlpsupports, as MP4, MKV, WebM, MP3, M4A, OPUS, OGG, WAV or FLAC, up to 4K. - Convert: change a file's format. Streams that already suit the new container are copied rather than re-encoded, so MKV → MP4 of an H.264 video takes seconds and loses nothing; the rest is encoded on the GPU when there is one.
- Compress: name a size (10, 25, 50, 100 MB or anything else) and every file lands under it. Videos are encoded at the resolution and frame rate the budget can actually carry (why), measured, and encoded again if they came out over anyway. Images keep the best quality that fits.
Select several files and they queue up, one encode at a time. Deleting a job stops it. Finished files download straight to the browser, and everything on the server is deleted after a day (configurable), so the disk never fills up.
Convert and Compress can also merge separate audio tracks into one, for recordings that keep game and microphone audio apart (ShadowPlay, OBS multi-track and similar).
Paste a link, pick a format.
Or drop in files and pick a size to land under. Light and dark follow the system.
Warning
There is no authentication. This is built for a trusted machine or a trusted LAN. Do not expose it directly to the internet: put a VPN or an authenticating proxy in front of it. See SECURITY.md for the full trust model.
docker run -d --name tailor \
-p 8080:8080 \
-v tailor_data:/data \
--restart unless-stopped \
ghcr.io/bbareth/tailor:latestOpen http://localhost:8080. With an Intel or AMD GPU, add the two options in Hardware encoding for encodes several times faster.
Portainer
Stacks → Add stack, paste the contents of
docker-compose.yml, deploy, then open
http://<host>:8080.
| Tag | What it is |
|---|---|
latest |
The newest tagged release. Use this. |
0.2.0, 0.2 |
A specific release, pinned. |
edge |
Built from main on every push. Expect rough edges. |
Images are published for linux/amd64 and linux/arm64.
Note
This project was called media_manager until 0.2.0. The old image,
ghcr.io/bbareth/media_manager, stays at 0.1.1 and gets no more updates.
To move over, swap the image name; the data volume can be reused as it is.
Pass the GPU's render node into the container and tailor uses it for every video it encodes:
docker run -d --name tailor \
-p 8080:8080 -v tailor_data:/data \
--device /dev/dri/renderD128 \
--group-add "$(stat -c %g /dev/dri/renderD128)" \
ghcr.io/bbareth/tailor:latest(In compose, uncomment devices and group_add.) At startup tailor runs a
five-frame test encode on the device. If it works, the header says GPU
encoding and the job details say GPU; if it does not, the log says why and
everything runs on the CPU as before. A job the GPU cannot handle falls back to
the CPU on its own.
The image carries VAAPI drivers for Intel (iGPUs from Broadwell on, and Arc)
and AMD. NVIDIA cards are not covered. On Proxmox, pass the device through to
the LXC container first (pct set <id> -dev0 /dev/dri/renderD128,gid=<render gid>).
Measured on an i7-8700K with its UHD 630, in a container with six cores, 30 seconds of 1440p60 game footage:
| Job | CPU (x264) | GPU (VAAPI) |
|---|---|---|
| Compress to 1080p30 at 3 Mbps | 14.8 s, SSIM 0.963 | 4.6 s, SSIM 0.962 |
| Convert to MP4, re-encoding | 36.2 s | 7.7 s (a larger file) |
| Convert to MP4 when H.264 already | 0.3 s (copied) | 0.3 s (copied) |
At the same size the GPU's picture is as good as two-pass x264 for this kind
of footage. Set MEDIA_HWACCEL=off to use the CPU regardless.
Everything is an environment variable; there is no config file.
| Variable | Default | What it does |
|---|---|---|
PORT |
8080 |
HTTP port inside the container. |
MEDIA_RETENTION_SECS |
86400 (1 day) |
Age at which files and job records are deleted. |
MEDIA_MAX_JOBS |
1 |
Conversions and compressions run at once. The rest wait. One is right for the CPU, which ffmpeg already keeps busy; a GPU can take two. Downloads never wait. |
MEDIA_HWACCEL |
auto |
auto uses the GPU when the test encode works, off never tries. |
MEDIA_VAAPI_DEVICE |
/dev/dri/renderD128 |
The render node to use. |
MEDIA_DATA_DIR |
/data |
Working files. Mount a volume here. |
MEDIA_STATIC_DIR |
/app/static |
Built frontend assets. Set inside the image. |
RUST_LOG |
tailor=info |
Log filter, in tracing syntax. |
/data is scratch space. It does not need backups, since its contents are
purged on a schedule. What it does need is room: if your Docker root disk
is small, bind-mount a directory on a larger one instead of using a named
volume.
The container runs as uid 10001, not root. A fresh named volume picks that up on its own; a bind-mounted host directory has to be made writable first:
sudo chown -R 10001:10001 /srv/tailor_data- Backend: Rust, Axum. One static binary, state held in memory, no database.
- Frontend: TypeScript and React, built by Vite, served by the same binary. No component library and no state manager.
- Media tools:
yt-dlpandffmpeg, bundled in the image.
Each job gets a UUID-named folder under /data. Downloads run yt-dlp with a
format selector derived from your quality choice. Uploads stream to disk, then
one ffprobe call reads the duration (so the progress bar is real), the
codecs (so a conversion knows what it can copy), the resolution and frame rate
(so a compression can plan) and the audio tracks. Conversions and compressions
wait for an encode slot, then run ffmpeg. The frontend polls /api/jobs for
progress, and a sweep every 30 minutes deletes anything past its retention age,
including stray folders left by earlier runs.
yt-dlp is installed from PyPI into a virtualenv rather than used as the
standalone binary, which self-extracts at runtime and fails on hosts with a
small /tmp.
The naive approach to "make this 12 MB" is to re-encode at the source's own dimensions and let the bitrate fall wherever it lands. That produces a blocky mess, and it is slow. Measured on a 2560×1440 60 fps game capture, 60 seconds targeted at 12 MB, six cores of a desktop CPU from 2017:
| Encode | Time | Bits per pixel |
|---|---|---|
| 1440p60, preset medium | 95 s | 0.0068 |
| 1080p60, preset medium | 71 s | 0.0121 |
| 1080p30, preset medium | 50 s | 0.0241 |
| 1080p30, preset faster | 43 s | 0.0241 |
| 720p30, preset faster | 33 s | 0.0543 |
Two things follow. Encode time tracks pixels per second almost linearly, so resolution and frame rate, not the x264 preset, are what make it slow; loosening the preset alone bought about 25 %. And at 0.0068 bits per pixel a 1440p frame is being asked to describe four million pixels with almost nothing, which is why the output looked bad.
So scaling down is not a compromise here. It makes the picture better and the
wait shorter at the same time.
backend/src/encode_plan.rs picks the largest
rung of a standard ladder whose bits-per-pixel clears a floor, halves a 60 fps
source before it gives up a resolution rung, and never upscales. The job's
detail line tells you what it chose (… · 1080p @ 30 fps · GPU).
The frontend is an ordinary client of this; nothing is privileged.
| Method | Path | Body | Purpose |
|---|---|---|---|
GET |
/api/health |
none | Returns ok. |
GET |
/api/info |
none | Version, encoder, retention and job limit. |
POST |
/api/downloads |
JSON { url, format, quality } |
Start a download. |
POST |
/api/transcode |
multipart file, format, combine_audio, reencode |
Start a conversion. |
POST |
/api/compress |
multipart file, target_mb, combine_audio |
Start a size-targeted encode. |
GET |
/api/jobs |
none | Every job, newest first. |
GET |
/api/jobs/{id} |
none | One job. |
GET |
/api/jobs/{id}/file |
none | Stream the finished output. |
DELETE |
/api/jobs/{id} |
none | Stop a job and delete its files. |
curl -F target_mb=25 -F file=@clip.mp4 http://localhost:8080/api/compressYou need Rust (stable), Node 22+, and ffmpeg, ffprobe and yt-dlp on your
PATH.
# terminal 1: backend on :8080
cd backend && cargo run# terminal 2: frontend on :5173, proxying /api to :8080
cd frontend && npm install && npm run devFor a production-style local run, build the frontend and point the backend at the output:
cd frontend && npm run build && cd ../backend
MEDIA_STATIC_DIR=../frontend/dist cargo run --releaseBuilding the image yourself, optionally pinning yt-dlp:
docker build -t tailor .docker build --build-arg YTDLP_VERSION=2025.05.22 -t tailor .Contributions are welcome. CONTRIBUTING.md covers the setup, what CI checks, and the house style.
MIT.
This tool automates yt-dlp and ffmpeg; it does not host, index, or
redistribute anything. What you may download is between you, the site's terms,
and your local copyright law. Please respect all three.