Closed yashkhandelwal05 closed 1 year ago
I found a fix, you need to manually close the stdin stream, after the tab stream was closed:
stream.on("close", () => {
ffmpeg.stdin.end();
});
What is the use of the close callback for stream ? Will the await stream.destroy() line take time to close off the stream?
yes, it does. The stream has a delay of ~a second and it waits for the stream to end and send the last packet, until it closes the stream
For longer duration videos>= 30 mins it's not working. The stream close is working but ffmpeg.stdin.end() is not working and I am not getting a close callback.
await new Promise((resolve) => {
ffmpeg.stdin.end();
ffmpeg.on('close', (code) => {
console.log(FFmpeg process exited with code ${code}
);
resolve();
});
});
I am using spawn instead of exec. Can that affect as well?
I have tried using both exec and spawn but still its not working with videos of around 1 hr duration
I've let it run for an hour and it closes without problems:
If I am not using : ffmpeg.stderr.on("data", (chunk) => { console.log(chunk.toString()); }); Then the ffmpeg is not ending but when I am using this it's getting ended. I guess this part of code should be optional as I don't want to have a continuous logging.
Can you please try removing this part: ffmpeg.stderr.on("data", (chunk) => { console.log(chunk.toString()); }); And check whether it's working or not
There is also problem with this line:
const ffmpeg = exec(ffmpeg -y -i - -c copy output.mp4
);
I am getting this error. Can you please check?
@SamuelScheit any update?
works for me, can't replicate
I have tried out both ffmpeg.kill() and ffmpeg.stdin.destroy() But still it's not working.