• Welcome to Computer Association of SIUE - Forums.
 

Removing Lag in Linux/BSD Multimedia

Started by William Grim, 2006-05-02T03:47:35-05:00 (Tuesday)

Previous topic - Next topic

William Grim

So, I had this little problem when I tried to play some of my movies in VLC under FreeBSD.  The problem was that VLC ran at the same priority as other processes and was being deprived of necessary resources to run without lag.

Since I'm sure other people experience this problem with video players and other things under Linux or BSD, I thought I'd write a little script and share it with everyone.  It also requires some tweaking of the permission on tools that could be used to overtake a system if the tweaks are not done correctly.

First, assuming you have `renice' on your system and it's in /usr/bin, copy (not rename) it to /usr/bin/renice.priv.  Next,  set some special privileges on it to allow users in the root group (Linux) or the wheel group (BSD) increased privileges and deny anyone else from using it.

Quote# cp /usr/bin/renice /usr/bin/renice.priv
# chmod 4550 /usr/bin/renice.priv

Now, let's assume you are trying to make VLC start with a higher priority without manually having to renice it and that you are in the root or wheel group.  If VLC is installed at /usr/X11R6/bin/vlc, you will need to do a couple things:

Quote# pushd /usr/X11R6/bin
# mv vlc vlc.real
# cat > vlc <#!/bin/sh

vlc.real $@ &
renice.priv -3 -p $!
eof
# chmod 0755 vlc
# popd

Now you're all set.  You can write similar wrappers like this for other tools you want to run at higher priorities "automatically".

If you're worried about what will happen if a user not in the root or wheel group tries to run it, don't worry.  All that will happen is that VLC will run at normal priority.
William Grim
IT Associate, Morgan Stanley