How to reduce CPU usage when it reaches 100% while converting video using ffmpeg
That seems to be a small server with 4 GB RAM and a virtual dual-core CPU that is most likely using shared resources. Obviously, this machine is not going to be able to handle video encoding tasks and serve a website at the same time, unless you make compromises in terms of the time it takes for the video encoding to complete.
Under Linux, you can run nice
to reduce the priority of a process.
For example, run:
nice ffmpeg -i <input> <output>
The "niceness" values range from -20 to 19, and the higher, the lower priority a process gets. Without further options, nice
adds 10 to the value of the process, which is 0 by default.
That said, I'd encourage you to not run web servers and intensive processing tasks on the same machine unless you can compartmentalize them in such a way that high resource consumption doesn't kill your website.