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

Function formatFfmpegError

packages/engine/src/utils/runFfmpeg.ts:57–77  ·  view source on GitHub ↗
(
  exitCode: number | null,
  stderr: string,
  tailLines: number = DEFAULT_STDERR_TAIL_LINES,
)

Source from the content-addressed store, hash-verified

55 * exactly which option to fix.
56 */
57export function formatFfmpegError(
58 exitCode: number | null,
59 stderr: string,
60 tailLines: number = DEFAULT_STDERR_TAIL_LINES,
61): string {
62 const tail = (stderr ?? "")
63 .split(/\r?\n/)
64 .filter((line) => line.length > 0)
65 .slice(-tailLines)
66 .join("\n");
67 if (exitCode === null) {
68 return tail ? `[FFmpeg] ${tail}` : "[FFmpeg] process error";
69 }
70 const windowsMessage = formatWindowsFfmpegExit(exitCode);
71 if (windowsMessage) {
72 return tail ? `${windowsMessage}\nffmpeg stderr (tail):\n${tail}` : windowsMessage;
73 }
74 return tail
75 ? `FFmpeg exited with code ${exitCode}\nffmpeg stderr (tail):\n${tail}`
76 : `FFmpeg exited with code ${exitCode}`;
77}
78
79export async function runFfmpeg(args: string[], opts?: RunFfmpegOptions): Promise<RunFfmpegResult> {
80 const startMs = Date.now();

Callers 8

defaultRunFfmpegFunction · 0.90
runFfmpegWithStdinFunction · 0.90
encodeGifFromDirFunction · 0.90
runFfmpeg.test.tsFile · 0.85
spawnStreamingEncoderFunction · 0.85
encodeFramesFromDirFunction · 0.85
muxVideoWithAudioFunction · 0.85
applyFaststartFunction · 0.85

Calls 1

formatWindowsFfmpegExitFunction · 0.85

Tested by

no test coverage detected