Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
It's not cpulimit spawning two ffmpeg instances (per your title); you are starting two (actually three) instances, one in each terminal.
Quote:
I'm running this in one terminal:
Code:
$ cpulimit -e ffmpeg -l 25
In another terminal I'm running this:
Code:
$ for i in $i; do ffmpeg -i $i -b:v 2M $i.webm; done
which starts one instance, in pts/2 and loops through a file list starting instances in pts/3, causing, in your posted example, two instances at one time...not sure why it didn't start all four instances from the pty/3 commands.
Nor do I understand why you are starting one instance in pty/2 that's not doing anything at all.
here is a script I wrote for using cpulimit.
I have not used it in a while, but what i think it did was for each pid of command it would limit it to whatever percent given, as I do remember I was running something in a loop so when it would loop to the next item to process, this script would catch that pid for the same command then set the limit to it.
I gave it a three pass fail setup so if nothing after the 3rd pass looking for a pid it would then stop running. cpulimit throws its error messages, which I pay no attention to.
say if you are running a script that is using ffmpeg within it to process, then you'd start that script, then this script, citing the ./scriptname ffmpeg 20 after ffmpeg first starts pressing a file. This was cpulimint can finds its pid.
if I remember correctly It works if I was running multiple scripts using the same command.
I now use a different script to just limit my cpu overall temp. therefore eliminating the need for this script.
@scasey: Please tell me why it's working with the script. And the pts/2 command is to monitor for ffmpeg instances. It should only limit the one process I'm running. This can even be done after the process is started as described in the man page's EXAMPLES: http://manpages.ubuntu.com/manpages/...pulimit.1.html
(I didn't find any other "official" man page but this is similar to Debian's.)
@BW-userx: But I wanna know why it's not working with a simple for-loop. It's already working with a script. Thanks anyway.
#!/bin/bash
#where the files are currently at
working_dir=
#where ever you want your output to go
file_to=
while read f
do
ffmpeg -i "$f" -b:v 2M "$file_to"/"$f".webm
done <<<"$(find "$working_dir" -type f -iname "*.ext-goes-here")"
now you can run the script at a centralized location, and have the output go to whatever dir you want your final product. It keeps it separated, not tested so kinks maybe needed to be worked out of it first.
BW-userx seems to know more specifics than I so I'll defer to them, but I do have to wonder about this:
Code:
for i in $i; do something with $i...
...doesn't that change the value of the variable the loop is running over??
Yes, sorry that was a typo. Corrected above.
But BW-userx's doesn't help me. I don't need another script. *I've got one that works already.* I just wanna know why it doesn't work as expected when I call it in a terminal via the for-loop ...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.