Forum
Set new CPU Priority for omxplayer - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Kodi (/forum-18.html)
+--- Thread: Set new CPU Priority for omxplayer (/thread-240.html)

Pages: 1 2


Set new CPU Priority for omxplayer - namtih - 11th Jan, 2013 04:57 AM

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.


RE: Set new CPU Priority for omxplayer - CurlyMo - 11th Jan, 2013 05:02 AM

To start with, can you share the NTFS-3G driver?


RE: Set new CPU Priority for omxplayer - namtih - 11th Jan, 2013 05:08 AM

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.


RE: Set new CPU Priority for omxplayer - CurlyMo - 11th Jan, 2013 05:14 AM

Quote:And unfortunately we didn't get the new NTFS driver running yet.

I thought you did.


RE: Set new CPU Priority for omxplayer - namtih - 11th Jan, 2013 05:23 AM

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.


RE: Set new CPU Priority for omxplayer - namtih - 11th Jan, 2013 06:39 AM

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?


RE: Set new CPU Priority for omxplayer - raspberry_pd - 11th Jan, 2013 06:08 PM

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.


RE: Set new CPU Priority for omxplayer - namtih - 11th Jan, 2013 07:03 PM

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.


RE: Set new CPU Priority for omxplayer - raspberry_pd - 11th Jan, 2013 08:59 PM

(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.


RE: Set new CPU Priority for omxplayer - CurlyMo - 11th Jan, 2013 09:07 PM

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


RE: Set new CPU Priority for omxplayer - raspberry_pd - 11th Jan, 2013 09:25 PM

Quote: -N, --nicelevel int
This alters the priority of the process before starting it.

http://linuxreviews.org/man/start-stop-daemon/


RE: Set new CPU Priority for omxplayer - namtih - 12th Jan, 2013 12:23 AM

(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.


RE: Set new CPU Priority for omxplayer - namtih - 20th Jan, 2013 06:47 PM

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.


RE: Set new CPU Priority for omxplayer - CurlyMo - 20th Jan, 2013 07:56 PM

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.


RE: Set new CPU Priority for omxplayer - namtih - 20th Jan, 2013 08:00 PM

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?