Make JPEG quality configurable

This commit is contained in:
2026-05-29 10:21:25 -07:00
parent 8b74d25954
commit 9d1f4cc53b
4 changed files with 5 additions and 3 deletions

View File

@@ -176,6 +176,7 @@ Runtime:
- `RECENT_URL_LIMIT`: recent URL count, default `12`. - `RECENT_URL_LIMIT`: recent URL count, default `12`.
- `FAVORITES_PATH`: favorites JSON path. - `FAVORITES_PATH`: favorites JSON path.
- `FAVORITES_LIMIT`: favorites count, default `50`. - `FAVORITES_LIMIT`: favorites count, default `50`.
- `JPEG_QUALITY`: default JPEG quality, fallback `7`, clamped `2..18`; lower is better for ffmpeg `-q:v`.
- `MAX_WS_BUFFER_BYTES`: server-side WebSocket JPEG frame backlog cap, default `2097152`. - `MAX_WS_BUFFER_BYTES`: server-side WebSocket JPEG frame backlog cap, default `2097152`.
- `MAX_AUDIO_QUEUE_BYTES`: single-mode audio output queue cap, default `16777216`. - `MAX_AUDIO_QUEUE_BYTES`: single-mode audio output queue cap, default `16777216`.
- `MAX_RELAY_BRANCH_QUEUE_BYTES`: relay per-branch compressed-input queue cap, default `16777216`. - `MAX_RELAY_BRANCH_QUEUE_BYTES`: relay per-branch compressed-input queue cap, default `16777216`.
@@ -184,7 +185,7 @@ Session playback options are accepted by `POST /api/session` even though the UI
- `fps`: default `24`, clamped `1..30`. - `fps`: default `24`, clamped `1..30`.
- `width`: default `960`, clamped `160..1920`. - `width`: default `960`, clamped `160..1920`.
- `quality`: default `5`, clamped `2..18`; lower is better for ffmpeg `-q:v`. - `quality`: defaults to `JPEG_QUALITY`, clamped `2..18`; lower is better for ffmpeg `-q:v`.
- `audioBitrate`: default `160k`, accepts two or three digits followed by `k`. - `audioBitrate`: default `160k`, accepts two or three digits followed by `k`.
## Docker Notes ## Docker Notes

View File

@@ -71,7 +71,7 @@ The UI intentionally hides these settings, but the backend still supports them t
- Frame rate defaults to `24fps`. Lower it if the client cannot keep up. - Frame rate defaults to `24fps`. Lower it if the client cannot keep up.
- Max width defaults to `960px`. Lower it first if bandwidth or image decode is the bottleneck. - Max width defaults to `960px`. Lower it first if bandwidth or image decode is the bottleneck.
- JPEG quality uses ffmpeg's `-q:v` scale, where lower is better. `5` is the default, `2` is high quality, and `18` is rough but lighter. - JPEG quality uses ffmpeg's `-q:v` scale, where lower is better. Set the default with `JPEG_QUALITY`; `7` is the fallback, `2` is high quality, and `18` is rough but lighter.
- Audio defaults to MP3 at `160k`. - Audio defaults to MP3 at `160k`.
## Tradeoffs ## Tradeoffs

View File

@@ -15,6 +15,7 @@ services:
PLAYBACK_CONNECTION_MODE: relay PLAYBACK_CONNECTION_MODE: relay
FFMPEG_LOG_LEVEL: warning FFMPEG_LOG_LEVEL: warning
FFMPEG_INPUT_SEEKABLE: "0" FFMPEG_INPUT_SEEKABLE: "0"
JPEG_QUALITY: "7"
MAX_WS_BUFFER_BYTES: "2097152" MAX_WS_BUFFER_BYTES: "2097152"
MAX_AUDIO_QUEUE_BYTES: "16777216" MAX_AUDIO_QUEUE_BYTES: "16777216"
MAX_RELAY_BRANCH_QUEUE_BYTES: "16777216" MAX_RELAY_BRANCH_QUEUE_BYTES: "16777216"

View File

@@ -39,7 +39,7 @@ const JPEG_EOI = Buffer.from([0xff, 0xd9]);
const defaults = { const defaults = {
fps: 24, fps: 24,
width: 960, width: 960,
quality: 5, quality: clampInteger(process.env.JPEG_QUALITY, 7, 2, 18),
audioBitrate: '160k', audioBitrate: '160k',
}; };