Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

834 B
Raw Blame
const windowsProcessCreation = ["PATHEXT", "SYSTEMROOT", "WINDIR", "ComSpec", "TEMP", "TMP"] as const;

/**
 * ffmpeg and ffprobe are started as PATH executables. The Host environment is
 * not forwarded, so credential values stay out of those processes. Windows still
 * needs the process-creation variables CreateProcess uses to resolve `.exe`.
 */
export function mediaProcessEnv(
  extra?: Readonly<Record<string, string>>,
  platform: NodeJS.Platform = process.platform,
): NodeJS.ProcessEnv {
  const env: NodeJS.ProcessEnv = { PATH: process.env.PATH ?? "" };
  if (platform === "win32") {
    for (const name of windowsProcessCreation) {
      const value = process.env[name];
      if (value !== undefined && value.length > 0) env[name] = value;
    }
  }
  if (extra !== undefined) Object.assign(env, extra);
  return env;
}