MCPcopy Index your code
hub / github.com/simstudioai/sim / probeFile

Function probeFile

apps/sim/lib/media/ffmpeg.ts:222–244  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

220}
221
222function 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.

Callers 2

probeMediaFunction · 0.85
fadeFunction · 0.85

Calls 2

ensureFfmpegFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected