feat(core): lighter preview copies of heavy videos below full quality (#6365)

* feat(core): tell which video files deserve a lighter preview copy, and at which size

* feat(studio-server): serve lighter copies of heavy playable files, a keyframe every second

* feat(core): the preview plays lighter copies of heavy videos below full quality

* style: shorten two comments

* style: shorten a comment

* style: shorten a comment

* fix(core): format the preview quality files and split the copy sizing for the complexity gate

* style: format the studio-server preview files

* fix(core): type the copy job's level as a preview quality

* chore(producer): raise the package size budget for the preview runtime growth
This commit is contained in:
Miguel Ángel
2026-10-26 03:53:21 +00:00
committed by GitHub
parent c0ddd3228d
commit 38d9aeb5ea
19 changed files with 721 additions and 118 deletions
@@ -35,7 +35,7 @@ import { mkdirWithinProject, realpath, realProjectRoot } from "./safePath.js";
* dropped from the queue or its ffmpeg is killed.
*/
export const PROXY_PARAMS_VERSION = "v6";
export const PROXY_PARAMS_VERSION = "v7";
export const CACHE_DIR_NAME = ".transcode-cache";
@@ -595,6 +595,7 @@ async function encodeInChunks(
for (const piece of pieces) if (existsSync(piece)) unlinkSync(piece);
}
const KEYFRAME_EVERY_SECOND_ARGS = ["-force_key_frames", "expr:gte(t,n_forced*1)"];
// Fixed recipe; changing either array means bumping PROXY_PARAMS_VERSION.
const H264_ARGS = [
"-c:v",
@@ -717,6 +718,7 @@ async function runFfmpeg(
...(range ? ["-t", String(range.lengthSeconds)] : []),
"-vf",
videoFilter,
...KEYFRAME_EVERY_SECOND_ARGS,
...(keepsAlpha ? [...VP8_ARGS, ...vp8Threads(range ? gate.size : 1)] : H264_ARGS),
target,
],