2
I have a program written in Node.Js that uses the following Ffmpeg command to capture videos:
ffmpeg -f dshow -i video=Integrated Webcam -c:v libx264 -f segment -strftime 1 -segment_time 60 -segment_format mp4 out%Y-%m-%d_%H-%M-%S.mp4
There is a need for the video project to be stopped at any time by means of a button. When finished by the command:
taskkill /im ffmpeg.exe /t /f
the video is corrupted and cannot be played.
Some way to finish the process but preserving the saved content?
I think not, when you force and finish the ffmpeg it stops writing all the headers containing the information for reading the video, usually the Ncode and the header is written after the entire capture process is done..
– ederwander
I’m not sure it’ll solve your problem, the library
fluent-ffmped
has some methods ofoutput
that may help you. It is already written fornode.js
– Marcelo de Andrade
I’ve seen some "gambiarras" some people wear a
stdin
and send a command ofexit(q)
to finish the ffmpeg in the correct way forcing him to write the video in the proper way... look here what this guy did link– ederwander
Thank you for your comments. They were helpful in getting the final answer.
– lys