Video Capture, Ffmpeg Video

Asked

Viewed 189 times

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?

  • 2

    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..

  • 1

    I’m not sure it’ll solve your problem, the library fluent-ffmped has some methods of output that may help you. It is already written for node.js

  • 1

    I’ve seen some "gambiarras" some people wear a stdinand send a command of exit(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

  • Thank you for your comments. They were helpful in getting the final answer.

1 answer

0


I solved the problem by adding the following chunk to the initial command: -segment_format_options movflags=empty_moov

Browser other questions tagged

You are not signed in. Login or sign up in order to post.