| 40 | } |
| 41 | |
| 42 | function parseArgs() { |
| 43 | const args = process.argv.slice(2); |
| 44 | const normalizedArgs = args[0] === "--" ? args.slice(1) : args; |
| 45 | const inputPath = normalizedArgs[0]; |
| 46 | let forcedFps: number | null = null; |
| 47 | let forcedMaxDuration: number | null = null; |
| 48 | for (let i = 1; i < normalizedArgs.length; i += 1) { |
| 49 | const arg = normalizedArgs[i]; |
| 50 | if (arg === "--fps" && normalizedArgs[i + 1]) { |
| 51 | forcedFps = parseNum(normalizedArgs[i + 1]); |
| 52 | i += 1; |
| 53 | continue; |
| 54 | } |
| 55 | if (arg === "--max-duration" && normalizedArgs[i + 1]) { |
| 56 | forcedMaxDuration = parseNum(normalizedArgs[i + 1]); |
| 57 | i += 1; |
| 58 | } |
| 59 | } |
| 60 | return { inputPath, forcedFps, forcedMaxDuration }; |
| 61 | } |
| 62 | |
| 63 | function parseAttributes(rawAttrs: string): AttrMap { |
| 64 | const attrs: AttrMap = {}; |