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",
"-crf",
"30",
"-an",
`${filename}.mp4`,
]);
ffmpeg.on("exit", async () => {
uploadToS3()
})
})
If the recording is less than or equal to approximately 1 hour it works perfectly, but if the recording is 1 and a half hours it already breaks and it does not correctly generate the files, nor the flv nor the conversion to mp4
I hope my program works the same way it does for 1 hour recordings