If you use Ubuntu on a computer with an ATI graphics card, you may be disappointed (to say the least) with the video quality. While the quality can be improved by visiting Settings > Preferences > Video > Output Modules and choosing the XVideo output module, this seems to simply switch one problem (blocky picture) for another (flickering).
The problem is that the ATI graphics driver for linux, fglrx, does not get along with Ububtu's 3D desktop effects manager, Compiz Fusion. Both programs fight for control over the display, resuling in flickering as one redraws overtop the other. The "solution" is to use to disable Compiz Fusion while playing videos. You can "wrap" the vlc executable around the following shell script which will automatically disable and re-enable Compiz Fusion as necessary. (The same script can also be wrapped around any other problematic application.)
Run the following code to prepare for the script (one-time only):
sudo apt-get install libnotify-bin compizconfig-settings-managerUse your favorite text editor to save the following script as /usr/local/bin/compizswitcher:
sudo touch /usr/local/bin/compizswitcher
sudo chmod 777 /usr/local/bin/compizswitcher
#!/bin/bash -uAfter saving the script, run the following commands to create a "wrapper" application for VLC (repeat for other applications, switching "vlc" with the appropriate application name):
# quietmint.com Compiz Fusion wrapper script (8/26/08)
if [ $# -lt 1 ]; then
echo "Usage: $0 <command>"
exit 1
fi
ICON="/usr/share/ccsm/icons/hicolor/scalable/apps/plugin-showdesktop.svg"
LOCKFILE="/tmp/compizswitcher.lock"
# Disable?
if [ ! -e $LOCKFILE ]; then
echo "[compizswitcher] Disabling Compiz Fusion"
DISPLAY=$DISPLAY metacity --replace 2>/dev/null | cat /dev/null &
notify-send --expire-time=3500 --icon=$ICON "Application Compatibility" \
"Visual effects are temporarily disabled."
else
echo "[compizswitcher] Duplicate instance, Compiz Fusion was already disabled by another process"
fi
echo "$$" >> "$LOCKFILE";
trap unlock INT TERM EXIT
# Run the original command
$@
unlock() {
# Enable?
OTHERS=$(grep -v "^$$$" "$LOCKFILE")
if [ ! -z "$OTHERS" ]; then
echo "$OTHERS" > "$LOCKFILE"
echo "[compizswitcher] Duplicate instance, leaving Compiz Fusion disabled for other processes"
else
rm -f $LOCKFILE
echo "[compizswitcher] Enabling Compiz Fusion"
DISPLAY=$DISPLAY compiz --replace >/dev/null 2>/dev/null &
sleep 2
notify-send --expire-time=3500 --icon=$ICON "Application Compatibility" \
"Visual effects have been re-enabled."
fi
}
sudo mv /usr/bin/vlc /usr/bin/vlc.realNow you can enjoy high-quality, flicker-free videos without completely sacrificing the aesthetic 3D effects of Compiz Fusion.
sudo touch /usr/bin/vlc
sudo chmod 777 /usr/bin/vlc
echo 'compizswitcher vlc.real $@' > /usr/bin/vlc
