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

Function ensureFfmpeg

apps/sim/lib/media/ffmpeg.ts:16–45  ·  view source on GitHub ↗

Lazy FFmpeg binary resolution (ffmpeg-static, then system), mirroring lib/audio/extractor.ts.

()

Source from the content-addressed store, hash-verified

14
15/** Lazy FFmpeg binary resolution (ffmpeg-static, then system), mirroring lib/audio/extractor.ts. */
16function ensureFfmpeg(): void {
17 if (ffmpegInitialized) {
18 if (!ffmpegPath) {
19 throw new Error(
20 'FFmpeg not found. Install: brew install ffmpeg (macOS) / apk add ffmpeg (Alpine) / apt-get install ffmpeg (Ubuntu)'
21 )
22 }
23 return
24 }
25 ffmpegInitialized = true
26
27 if (ffmpegStatic && typeof ffmpegStatic === 'string') {
28 try {
29 fsSync.accessSync(ffmpegStatic, fsSync.constants.X_OK)
30 ffmpegPath = ffmpegStatic
31 ffmpeg.setFfmpegPath(ffmpegPath)
32 return
33 } catch {
34 // fall through to system ffmpeg
35 }
36 }
37
38 try {
39 const cmd = process.platform === 'win32' ? 'where ffmpeg' : 'which ffmpeg'
40 ffmpegPath = execSync(cmd, { encoding: 'utf-8' }).trim().split('\n')[0]
41 ffmpeg.setFfmpegPath(ffmpegPath)
42 } catch {
43 logger.warn('[FFmpeg] No FFmpeg binary found at init time')
44 }
45}
46
47export type FfmpegOperation =
48 | 'overlay_audio'

Callers 2

withTempDirFunction · 0.70
probeFileFunction · 0.70

Calls 1

warnMethod · 0.65

Tested by

no test coverage detected