@@ -7,10 +7,9 @@ export const examples: Example[] = [
77 [ "Render transparent overlay (ProRes)" , "hyperframes render --format mov --output overlay.mov" ] ,
88 [ "Render transparent WebM overlay" , "hyperframes render --format webm --output overlay.webm" ] ,
99 [ "High quality at 60fps" , "hyperframes render --fps 60 --quality high --output hd.mp4" ] ,
10- [ "Custom CRF for maximum quality" , "hyperframes render --crf 15 --output pristine.mp4" ] ,
11- [ "Target bitrate encoding" , "hyperframes render --video-bitrate 10M --output hq.mp4" ] ,
1210 [ "Deterministic render via Docker" , "hyperframes render --docker --output deterministic.mp4" ] ,
1311 [ "Parallel rendering with 6 workers" , "hyperframes render --workers 6 --output fast.mp4" ] ,
12+ [ "HDR output (H.265 10-bit)" , "hyperframes render --hdr --output hdr-output.mp4" ] ,
1413] ;
1514import { cpus , freemem , tmpdir } from "node:os" ;
1615import { resolve , dirname , join , basename } from "node:path" ;
@@ -81,19 +80,10 @@ export default defineCommand({
8180 description : "Use Docker for deterministic render" ,
8281 default : false ,
8382 } ,
84- crf : {
85- type : "string" ,
86- description :
87- "CRF (Constant Rate Factor) for the video encoder. " +
88- "Lower = higher quality / larger file. Range: 0–51 for H.264. " +
89- "Overrides the quality preset CRF. Cannot be used with --video-bitrate." ,
90- } ,
91- "video-bitrate" : {
92- type : "string" ,
93- description :
94- "Target video bitrate (e.g. '10M', '5000k'). " +
95- "Uses bitrate-based encoding instead of CRF. " +
96- "Cannot be used with --crf." ,
83+ hdr : {
84+ type : "boolean" ,
85+ description : "Enable HDR: probe sources for PQ/HLG, output H.265 10-bit BT.2020" ,
86+ default : false ,
9787 } ,
9888 gpu : { type : "boolean" , description : "Use GPU encoding" , default : false } ,
9989 quiet : {
@@ -144,36 +134,6 @@ export default defineCommand({
144134 }
145135 const format = formatRaw as "mp4" | "webm" | "mov" ;
146136
147- // ── Validate CRF / video-bitrate ────────────────────────────────────
148- let crf : number | undefined ;
149- let videoBitrate : string | undefined ;
150- if ( args . crf != null && args [ "video-bitrate" ] != null ) {
151- errorBox (
152- "Conflicting options" ,
153- "--crf and --video-bitrate cannot be used together. Choose one." ,
154- ) ;
155- process . exit ( 1 ) ;
156- }
157- if ( args . crf != null ) {
158- const parsed = parseInt ( args . crf , 10 ) ;
159- if ( isNaN ( parsed ) || parsed < 0 || parsed > 51 ) {
160- errorBox ( "Invalid CRF" , `Got "${ args . crf } ". Must be a number between 0 and 51.` ) ;
161- process . exit ( 1 ) ;
162- }
163- crf = parsed ;
164- }
165- if ( args [ "video-bitrate" ] != null ) {
166- const raw = args [ "video-bitrate" ] ;
167- if ( ! / ^ \d + ( \. \d + ) ? [ k K M ] $ / . test ( raw ) ) {
168- errorBox (
169- "Invalid video bitrate" ,
170- `Got "${ raw } ". Must be a number followed by k, K, or M (e.g. "10M", "5000k", "1.5M").` ,
171- ) ;
172- process . exit ( 1 ) ;
173- }
174- videoBitrate = raw ;
175- }
176-
177137 // ── Validate workers ──────────────────────────────────────────────────
178138 let workers : number | undefined ;
179139 if ( args . workers != null && args . workers !== "auto" ) {
@@ -231,12 +191,7 @@ export default defineCommand({
231191 c . accent ( project . name ) +
232192 c . dim ( " \u2192 " + outputPath ) ,
233193 ) ;
234- const encodeLabel = videoBitrate
235- ? `bitrate ${ videoBitrate } `
236- : crf != null
237- ? `crf ${ crf } `
238- : quality ;
239- console . log ( c . dim ( " " + fps + "fps \u00B7 " + encodeLabel + " \u00B7 " + workerLabel ) ) ;
194+ console . log ( c . dim ( " " + fps + "fps \u00B7 " + quality + " \u00B7 " + workerLabel ) ) ;
240195 console . log ( "" ) ;
241196 }
242197
@@ -316,9 +271,8 @@ export default defineCommand({
316271 format,
317272 workers : workerCount ,
318273 gpu : useGpu ,
274+ hdr : args . hdr ?? false ,
319275 quiet,
320- crf,
321- videoBitrate,
322276 } ) ;
323277 } else {
324278 await renderLocal ( project . dir , outputPath , {
@@ -327,10 +281,9 @@ export default defineCommand({
327281 format,
328282 workers : workerCount ,
329283 gpu : useGpu ,
284+ hdr : args . hdr ?? false ,
330285 quiet,
331286 browserPath,
332- crf,
333- videoBitrate,
334287 } ) ;
335288 }
336289 } ,
@@ -342,10 +295,9 @@ interface RenderOptions {
342295 format : "mp4" | "webm" | "mov" ;
343296 workers : number ;
344297 gpu : boolean ;
298+ hdr : boolean ;
345299 quiet : boolean ;
346300 browserPath ?: string ;
347- crf ?: number ;
348- videoBitrate ?: string ;
349301}
350302
351303const DOCKER_IMAGE_PREFIX = "hyperframes-renderer" ;
@@ -480,8 +432,6 @@ async function renderDocker(
480432 String ( options . workers ) ,
481433 ...( options . quiet ? [ "--quiet" ] : [ ] ) ,
482434 ...( options . gpu ? [ "--gpu" ] : [ ] ) ,
483- ...( options . crf != null ? [ "--crf" , String ( options . crf ) ] : [ ] ) ,
484- ...( options . videoBitrate ? [ "--video-bitrate" , options . videoBitrate ] : [ ] ) ,
485435 ] ;
486436
487437 if ( ! options . quiet ) {
@@ -543,8 +493,7 @@ async function renderLocal(
543493 format : options . format ,
544494 workers : options . workers ,
545495 useGpu : options . gpu ,
546- crf : options . crf ,
547- videoBitrate : options . videoBitrate ,
496+ hdr : options . hdr ,
548497 } ) ;
549498
550499 const onProgress = options . quiet
0 commit comments