How to pause FFmpeg from C++ code?
I'm writing a VisualC++ progr开发者_如何学编程am which have code invoke ffmpeg.exe to convert video file. I wonder is it possible to pause/resume ffmpeg converting thread from C++ code?
LR.
All you need to do is suspend and resume the ffmpeg child process itself.
The main problem is: there is no SuspendProcess API function. And there is no documented or safe way of doing this.
The only simple way of doing this is via SuspendThread/ResumeThread.
See this article on codeproject about how to do it.
There are no ways to controls the conversion using ffmpeg.
However, if you switch you mencoder, you will be able to do it.
This is an equivalent for Unix based command:
mike@krusty:~$ pidof ffmpeg
22730
mike@krusty:~$ sudo kill -STOP 22730
[sudo] password for mike:
mike@krusty:~$ sudo kill -CONT 22730
No. This is a command-line tool, and once it is started, you cannot pause it.
Microsoft API ::SuspendThread function
精彩评论