Boro
Boro

Reputation: 39

Lower CPU % used by FFMPEG Process via PHP (FLV Video Conversion)

Okay, so I currently execute an ffmpeg command via PHP to run a video conversion. The Problem I'm Having is during the conversion, the ffmpeg process(es) use up so much CPU/Processing Power (near 100%), which slows down the response of my webserver.

Is there a Way (crontab or script) I can limit the ffmpeg processes to a certain CPU percentage?

Thanks,

Upvotes: 0

Views: 2764

Answers (1)

Dean Harding
Dean Harding

Reputation: 72648

What platform? I assume from "crontab" that you're on Linux, in which case you can run ffmpeg using nice. That is, instead of:

ffmpeg (options)

Run:

nice -n 20 ffmpeg (options)

This will run ffmpeg at the lowest possible priority, which means any other processing (e.g. web pages) will get scheduled ahead of ffmpeg. It'll still run at "100%" but it'll never take time away from higher priority tasks, which is what you want.

Upvotes: 3

Related Questions