(filePath: string)
| 220 | } |
| 221 | |
| 222 | function probeFile(filePath: string): Promise<MediaProbe> { |
| 223 | ensureFfmpeg() |
| 224 | return new Promise((resolve, reject) => { |
| 225 | ffmpeg.ffprobe(filePath, (err, metadata) => { |
| 226 | if (err) { |
| 227 | reject(new Error(`FFprobe error: ${err.message}`)) |
| 228 | return |
| 229 | } |
| 230 | const video = metadata.streams.find((s) => s.codec_type === 'video') |
| 231 | const audio = metadata.streams.find((s) => s.codec_type === 'audio') |
| 232 | resolve({ |
| 233 | durationSeconds: Number(metadata.format?.duration) || 0, |
| 234 | format: metadata.format?.format_name || 'unknown', |
| 235 | width: video?.width, |
| 236 | height: video?.height, |
| 237 | videoCodec: video?.codec_name, |
| 238 | audioCodec: audio?.codec_name, |
| 239 | hasAudio: Boolean(audio), |
| 240 | hasVideo: Boolean(video), |
| 241 | }) |
| 242 | }) |
| 243 | }) |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Run a single FFmpeg media operation on the provided input files. |
no test coverage detected