MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / transcodeToMp4

Function transcodeToMp4

packages/cli/src/commands/init.ts:141–172  ·  view source on GitHub ↗
(inputPath: string, outputPath: string)

Source from the content-addressed store, hash-verified

139// hasFFmpeg is imported from whisper/manager.ts to avoid duplication
140
141function transcodeToMp4(inputPath: string, outputPath: string): Promise<boolean> {
142 return new Promise((resolvePromise) => {
143 const ffmpegPath = findFFmpeg();
144 if (!ffmpegPath) {
145 resolvePromise(false);
146 return;
147 }
148 const child = spawn(
149 ffmpegPath,
150 [
151 "-i",
152 inputPath,
153 "-c:v",
154 "libx264",
155 "-preset",
156 "fast",
157 "-crf",
158 "18",
159 "-c:a",
160 "aac",
161 "-b:a",
162 "192k",
163 "-y",
164 outputPath,
165 ],
166 { stdio: "pipe" },
167 );
168
169 child.on("close", (code) => resolvePromise(code === 0));
170 child.on("error", () => resolvePromise(false));
171 });
172}
173
174// ---------------------------------------------------------------------------
175// Static template helpers

Callers 1

handleVideoFileFunction · 0.85

Calls 3

findFFmpegFunction · 0.85
onMethod · 0.65
spawnFunction · 0.50

Tested by

no test coverage detected