When start record i call an api /start-record which does:
const ffmpeg = spawn("ffmpeg", [
"-i",
rtsp,
"-c:v",
"copy",
"-an",
"-f",
"flv",
`$filename.flv`,
]);
ffmpegProcesses[rtsp] =
process: ffmpeg,
filename,
;
When stop the record i call an api /stop-record which does:
ffmpegProcesses[rtsp].process.kill("SIGKILL");
ffmpegProcesses[rtsp].process.on("exit", async () =>
const ffmpeg = spawn("ffmpeg", [
"-i",
`$filename.flv`,
"-c:v",
"libx264",
"-preset",
"fast",
(...)