@@ -7,6 +7,11 @@ import {
77 CAPTION_WORDS_PER_LINE_MIN ,
88} from "../../src/lib/ai-edition/captions/wordsPerLine" ;
99import type { CliExportRequest , CliRecordRequest , CliRequest } from "../../src/lib/cliContracts" ;
10+ import {
11+ GIF_SIZE_PRESETS ,
12+ type GifSizePreset ,
13+ MP4_FRAME_RATES ,
14+ } from "../../src/lib/exporter/types" ;
1015
1116export interface CliInfoCommand {
1217 kind : "info" ;
@@ -77,7 +82,7 @@ export const CLI_USAGE = `OpenScreen CLI
7782Usage:
7883 openscreen export <project.openscreen> [options] Render a project to MP4/GIF
7984 openscreen record [options] Record the screen headlessly
80- openscreen sources [--json] [-o <file>] List displays, windows and microphones
85+ openscreen sources [--json] [-o <file>] List displays, windows, microphones and cameras
8186 openscreen pack <project.openscreen> --out <dir> Copy project + media into one portable folder
8287 openscreen captions <project.openscreen> Add auto-captions (on-device Whisper) to a project
8388 [--min-words <1-12>] [--max-words <1-12>]
@@ -90,9 +95,11 @@ Export options:
9095 --format <mp4|gif> Override the format stored in the project
9196 --quality <medium|good|source>
9297 MP4 quality (default: from project)
98+ --fps <24|30|60> MP4 frame rate (default 60)
9399 --gif-fps <15|20|25|30> GIF frame rate (default: from project)
94- --gif-size <medium|large|original>
100+ --gif-size <small| medium|large|original>
95101 GIF size preset (default: from project)
102+ --gif-loop, --no-gif-loop GIF loops forever, or plays once (default: from project)
96103 --auto-zoom Add automatic zooms from cursor telemetry (editor's magic wand)
97104 --audio <file> Mix a voiceover audio file into the MP4 (mp3/wav/m4a)
98105 --audio-mode <mix|replace>
@@ -106,6 +113,8 @@ Record options (recording is saved into the app's recordings directory):
106113 --mic Capture the default microphone
107114 --mic-device <name> Microphone device name (implies --mic)
108115 --system-audio Capture system audio
116+ --camera Record the default webcam beside the screen
117+ --camera-device <name> Camera device name (implies --camera)
109118 --cursor <editable-overlay|system>
110119 Cursor capture mode (default editable-overlay)
111120 --duration <seconds> Stop automatically after this long
@@ -190,8 +199,10 @@ function parseExport(args: string[], cwd: string): CliCommand {
190199 outPath : null ,
191200 format : null ,
192201 quality : null ,
202+ mp4FrameRate : 60 ,
193203 gifFrameRate : null ,
194204 gifSizePreset : null ,
205+ gifLoop : null ,
195206 autoZoom : false ,
196207 audioPath : null ,
197208 audioMode : "mix" ,
@@ -226,6 +237,16 @@ function parseExport(args: string[], cwd: string): CliCommand {
226237 i = next ;
227238 break ;
228239 }
240+ case "--fps" : {
241+ const [ value , next ] = takeValue ( args , i , arg ) ;
242+ const fps = MP4_FRAME_RATES . find ( ( rate ) => rate === Number ( value ) ) ;
243+ if ( fps === undefined ) {
244+ throw new Error ( `--fps must be ${ MP4_FRAME_RATES . join ( ", " ) } , got "${ value } "` ) ;
245+ }
246+ request . mp4FrameRate = fps ;
247+ i = next ;
248+ break ;
249+ }
229250 case "--gif-fps" : {
230251 const [ value , next ] = takeValue ( args , i , arg ) ;
231252 const fps = Number ( value ) ;
@@ -238,13 +259,18 @@ function parseExport(args: string[], cwd: string): CliCommand {
238259 }
239260 case "--gif-size" : {
240261 const [ value , next ] = takeValue ( args , i , arg ) ;
241- if ( value !== "medium" && value !== "large" && value !== "original" ) {
242- throw new Error ( `--gif-size must be medium, large or original, got "${ value } "` ) ;
262+ const size = ( Object . keys ( GIF_SIZE_PRESETS ) as GifSizePreset [ ] ) . find ( ( s ) => s === value ) ;
263+ if ( size === undefined ) {
264+ throw new Error ( `--gif-size must be small, medium, large or original, got "${ value } "` ) ;
243265 }
244- request . gifSizePreset = value ;
266+ request . gifSizePreset = size ;
245267 i = next ;
246268 break ;
247269 }
270+ case "--gif-loop" :
271+ case "--no-gif-loop" :
272+ request . gifLoop = arg === "--gif-loop" ;
273+ break ;
248274 case "--auto-zoom" :
249275 request . autoZoom = true ;
250276 break ;
@@ -312,6 +338,8 @@ function parseRecord(args: string[], cwd: string): CliCommand {
312338 mic : false ,
313339 micDevice : null ,
314340 systemAudio : false ,
341+ camera : false ,
342+ cameraDevice : null ,
315343 cursorMode : "editable-overlay" ,
316344 durationMs : null ,
317345 projectOut : null ,
@@ -349,6 +377,16 @@ function parseRecord(args: string[], cwd: string): CliCommand {
349377 case "--system-audio" :
350378 request . systemAudio = true ;
351379 break ;
380+ case "--camera" :
381+ request . camera = true ;
382+ break ;
383+ case "--camera-device" : {
384+ const [ value , next ] = takeValue ( args , i , arg ) ;
385+ request . camera = true ;
386+ request . cameraDevice = value ;
387+ i = next ;
388+ break ;
389+ }
352390 case "--cursor" : {
353391 const [ value , next ] = takeValue ( args , i , arg ) ;
354392 if ( value !== "editable-overlay" && value !== "system" ) {
0 commit comments