From 0ad0df56122c5c8b6f8421c4c390049fe5ee9c74 Mon Sep 17 00:00:00 2001 From: James Magahern Date: Sun, 14 Jun 2026 19:07:58 -0700 Subject: [PATCH] realtime flag for http urls --- AGENTS.md | 2 +- server/index.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 39ef2b2..82c794f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,7 +110,7 @@ Frame output: - Maps `0:v:0` - Disables audio with `-an` -- Applies `fps=,scale=w='min(,iw)':h=-2:flags=bicubic:out_range=pc,format=yuvj420p` +- Applies `fps=,scale=w='min(,iw)':h=-2:flags=bicubic:out_range=pc,format=yuvj420p,realtime` - Encodes `mjpeg` - Uses `-pix_fmt yuvj420p`, `-color_range pc`, `-q:v ` - Outputs `image2pipe` to either `pipe:1` or `pipe:3` diff --git a/server/index.js b/server/index.js index 518cba4..93b0e0a 100644 --- a/server/index.js +++ b/server/index.js @@ -2798,6 +2798,7 @@ function buildFrameArgs(session, inputUrl, inputOptions) { } function buildInputArgs(inputUrl, { seekable = true, startTime = 0 } = {}) { + const isHttpInput = isHttpInputUrl(inputUrl); const args = [ '-hide_banner', '-nostdin', @@ -2806,7 +2807,7 @@ function buildInputArgs(inputUrl, { seekable = true, startTime = 0 } = {}) { '-nostats', ]; - if (seekable) { + if (seekable && isHttpInput) { args.push('-seekable', startTime > 0 ? '1' : FFMPEG_INPUT_SEEKABLE); } @@ -2814,7 +2815,7 @@ function buildInputArgs(inputUrl, { seekable = true, startTime = 0 } = {}) { args.push('-ss', formatFfmpegSeconds(startTime)); } - if (FFMPEG_HTTP_RECONNECT && isHttpInputUrl(inputUrl)) { + if (FFMPEG_HTTP_RECONNECT && isHttpInput) { args.push( '-reconnect', '1', @@ -2849,7 +2850,7 @@ function formatFfmpegSeconds(seconds) { function buildFrameOutputArgs(session, outputUrl) { const { fps, quality, width } = session.options; - const videoFilter = `fps=${fps},scale=w='min(${width},iw)':h=-2:flags=bicubic:out_range=pc,format=yuvj420p`; + const videoFilter = `fps=${fps},scale=w='min(${width},iw)':h=-2:flags=bicubic:out_range=pc,format=yuvj420p,realtime`; return [ '-an',