Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have some video files that are far larger than they need to be and i'm using handbreak to reduce their sizes. i would like to reduce the load they have on my cpu. yes i know in doing so it will take longer to convert the files, but that is fine. please any suggestions and or tutorials on doing this would be greatly appreciated. thanks
amd fx 6300 on kde neon 64 bit
nvidia 750ti on the 430 driver
kernel 5.1
this was written with my script to resample mp3 in mind. whenever lame would stop doing one mp3 then pick up another one it catches the new pid for lame, then puts cpulimit back to work on that new pid, when mp3s where finished it's checks 1 times before exiting, to compensate for lag time between mp3's
example
Code:
$ limitcpu qbittorrent 40
qbittorrent
40
pid 25474
Process 25474 found
then you can start top to just get a look see for your own well being, and of course you can use this with your handbrake or handbrake-cli or creating a script yourself that does the same thing , or off the cli for when you are doing only one movie.
i doubt that cpulimit would be of much help here; but surely can't hurt to try.
i think this should be a setting within handbrake; either within handbrake proper, or something passed to the transcoding software.
If ffmpeg does handbrake's transcoding, or you could switch to ffmpeg proper, here's some ideas.
i doubt that cpulimit would be of much help here; but surely can't hurt to try.
i think this should be a setting within handbrake; either within handbrake proper, or something passed to the transcoding software.
If ffmpeg does handbrake's transcoding, or you could switch to ffmpeg proper, here's some ideas.
thanks i'll have a look through some of those. much rather do that than write out a script.
i have some video files that are far larger than they need to be and i'm using handbreak to reduce their sizes. i would like to reduce the load they have on my cpu. yes i know in doing so it will take longer to convert the files, but that is fine. please any suggestions and or tutorials on doing this would be greatly appreciated.
The traditional method is nice. It does not guarantee a CPU percentage, but increases the probability that the CPU is relinquished to non-nice processes when they want it.
Code:
$ nice -n 19 handbrake [handbrake options and arguments]
EDIT: Also renice to change the nice value of a running process.
Last edited by berndbausch; 05-31-2019 at 06:45 AM.
Just out of curiosity why would you want this? Is it to have more power to use the computer while encoding? Or because you think it will prevent so called wear and tear on the cpu? If the latter then you shouldn't worry about it.
Cpu's don't exactly wear out, at least not in the common sense. You won't be shortening the life of the chip by running full blast, at least not in any measurable sense. Overclocking however is a good way to blow a chip if you don't know what you are doing and don't keep it cool.
Another method to reduce the stress on your CPU would be using the cpufreq-* utilities if they're available on your distribution, with a governor like "powersave."
it's a kludge that mostly just "Limit cpu usage of a process in percentage. Actually sends SIGSTOP/SIGCONT POSIX signals to processes".
I'm not sure it'll work at all with a GUI program. Maybe it'll just limit the GUI. Surely handbrake outsources the transcoding. It would be much better to tell that process (hopefully ffmpeg) directly (via command options) to restrict itself.
And even if cpulimit can be applied, I suspect that it carries significant overhead.
But as I said, can't hurt to try.
Well if you have cooling issues, limiting how much heat you generate can help prolong your broken hardware. I ran a laptop without a working fan for over a year by only using it to look at game guides while I gamed on the other not-broken computer.
I also live in a warm region so having my computer output less heat lets the A/C turn off once in a blue moon. Other quirks like putting an I/O intensive thing on it's own storage device, so other users don't feel the pinch.
Mostly I use nice on browsers so I can kill the browsers when they misbehave. Versus waiting seconds or minutes for HID interfaces to move far enough to express my intent. Without holding a power button for seconds to kill everything.
In the case of the previous fanless, but not by design computer, it did eventually heat up enough to make the USB unstable. Which it was booting off of, so end of life at that point.
There's cpufreq and other tools to have your CPU run slower than it's max. Not exactly a per process method. But one way to not pop a fuse if you have more computers than you should on one circuit. Or otherwise live in 1970s era housing not designed for our modern electronics.
I won't speak to the OP's intentions, but the reason I use sched_idle is to maintain a responsive interactive system/desktop while big compile jobs are running in the background. sched_idle or nice won't do anything to help manage cpu thermal output; as others have mentioned, you'll need to look towards cpu frequency management if that is your concern.
it certainly didn't take peeps to get off topic and start useless speculation on why i want to limit handbreak's cpu usage. that said i only had about 40 files that needed to be reduced so decided to just let handbreak use what it wanted. thanks for the input and suggestions though.
I did (and still do) have a use case for cpulimit - it's a script that generates a desktop background every few minutes or so. If I don't limit it, the fans spin up every time, and that's simply disturbing to me. setting nice to the lowest value does NOT help with that.
so i use cpulimit to keep it from happening. however, i don't run the whole script with cpulimit, just the crucial command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.