Forum

Full Version: Set new CPU Priority for omxplayer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Does anyone know which file contains the omxplayer call?
I wanted to check if I can edit the call to lower the CPU priority (nice -n -10 omxplayer...).

The reason is to hopefully get a smoother playback, when some background processes are running. Had some troubles yesterday evening with parallel running openvpn, pyload (-> python) and high CPU usage of the current NTFS-3G driver.
To start with, can you share the NTFS-3G driver?
Sorry, I don't understand what you mean?
It's the standard builtin ntfs-3g driver set via fstab.
Code:
UUID=DA205B73205xxxxx /mnt/hdd  ntfs-3g noatime,nodiratime,async,rw       0       0

And that's the result with 2 parallel downloads. So you see, no much CPU left for the omxplayer to get a smooth playback.
http://www.imagebanana.com/view/wdobkkj8/top.jpg

So the idea was to assign more CPU usage/priority to the omxplayer, as I wasn't able to find methods to optimize the openvpn or python runtime.
And unfortunately we didn't get the new NTFS driver running yet.
Quote:And unfortunately we didn't get the new NTFS driver running yet.

I thought you did.
No, not really.
I only got a nice fullscreen of error messages and realized that this is too big for my Linux skills after 3 days of trying Confused

gizag pointed out that the driver in the first post was wrong and that he would perhaps give the new version a try. But until now no new post from him, so I think he also had no luck yet.

Just got the tip in the XBMC IRC channel that the omxplayer isn't using any CPU power. So the next try would be XBMC itself and/or the xbmc.bin.
I've added the following line to the "do_start" function in "etc/init.d/xbmc":
Code:
renice -10 -p $(pgrep xbmc.bin)

But the CPU priority is still 0 after a restart.
When I execute the command in the command line it's working fine. Can anyone please help with the init script?
To improve playback, wouldn't you increase the priority assigned to xbmc.bin, rather than lower it? AFAIK this would be how it's done in Windows. Of course it may be inverse in Linux. Just curious.
Yep, it's inverse in Linux:
http://www.nixtutor.com/linux/changing-priority-on-linux-processes/
Quote:The Linux niceness scale goes from -20 to 19. The lower the number the more priority that task gets.



CurlyMo, can you please help how to edit the start script to set a new CPU priority of "-10" for the xbmc.bin process?
I wasn't able to get it working.
(11th Jan, 2013 07:03 PM)namtih Wrote: [ -> ]Yep, it's inverse in Linux:
http://www.nixtutor.com/linux/changing-priority-on-linux-processes/

The Linux niceness scale goes from -20 to 19. The lower the number the more priority that task gets.

Thanks for the explanation namtih. It's really nice to have someone willing to help educate, rather than troll of flame people for asking questions. Asking questions is just as valid a means of learning as RTFMing.
Quote:CurlyMo, can you please help how to edit the start script to set a new CPU priority of "-10" for the xbmc.bin process?
I wasn't able to get it working.

Look into the '-N' flag of start-stop-daemon
Quote: -N, --nicelevel int
This alters the priority of the process before starting it.

http://linuxreviews.org/man/start-stop-daemon/
(11th Jan, 2013 09:07 PM)CurlyMo Wrote: [ -> ]Look into the '-N' flag of start-stop-daemon

Thanks, got it working now.
I set it to "-10" and will give a feedback in some days if it made any difference.
I don't know the exact reason, but since setting this value I had several freezes while watching a movie or video addons. The complete Pi just froze.
I don't understand why setting another nicevalue is causing this, but at the moment I can't recommend to set/change this value.
Pretty simple, the nice value is limiting the CPU XBMC can use. Due to the lack of power, the RPi doesn't have enough resources to let XBMC run smoothly while limited in CPU power.
But I set it from 0 to -10. So I assigned a higher/more priority to the XBMC process. So why got the stability worse?
Pages: 1 2
Reference URL's