7

Someone setup a server and has FFMPEG is trying to encode a video and it has effectively killed the web server. I didn't set it up but have sudo access and need to kill FFMPEG so that the web server starts responding again. How can I do this? Thank you!

It is an Ubuntu 11.10 server with a standard LAMP stack.

3 Answers 3

16

On Linux, you can use sudo killall ffmpeg to kill every process called "ffmpeg" or ps -ef | grep ffmpeg to get the process ids and then sudo kill <PID> to kill each one individually.

If they don't die, sudo kill -9 <PID> will terminate them.

If you don't want to kill ffmpeg, you can pause a running process with sudo kill -s SIGSTOP <PID> and start them again with sudo kill -s SIGCONT <PID>.

Beware: On Solaris, killall doesn't take arguments. It just kills everything.

4
  • I'd also possibly chmod a-x `which ffmpeg` to stop them doing it again. Apr 2, 2012 at 17:46
  • This worked out for me, thank you. I will be revisiting with the team to make sure they get a system in place to not let FFMPEG do this again.
    – gokujou
    Apr 2, 2012 at 17:51
  • signals sent by option -s SIGCONT and SIGSTOP do not work under Linux Mint 19.3 beta, with kernel 5.0.0-37-generic for some unknown reason. Options specified also as -s CONT or -s STOP did not work either. Of course they seem to work, because the reaction of ffmpeg looks like it was actually stopped, BUT in the recorded file everything was without any break. So I assume that some buffering maybe was involved, or those signals just do not work.
    – piotao
    Dec 15, 2019 at 18:16
  • ffmpeg really seems to require -9 on Linux according to my experiments Jan 18, 2020 at 23:16
6

Not quite what you're asking, but if it's important for the ffmpeg job to finish, it might be enough to renice it to give it a lower priority than the web server processes.

Run something like ps auxw |grep ffmpeg to get the PID of the ffmpeg process, then issue sudo renice -n 19 PID to change the process priority, for process PID from the first command.

This strategy might work a little better than outright killing ffmpeg. It'll give you breathing room for the web processes, but will allow the original job to finish. Also, if there's some sort of job queuer running, it may just start up ffmpeg again after it sees that the original job did not complete successfully.

1
ps -ef | grep ffmpeg

Take note of PID's of different ffmpeg processes, then for each PID

kill -9 PID

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .