Stutter-Free Linux Netflix with Netflix-Desktop and Compton

27 Jun 2013

Netflix has mentinoned that it will soon switch to a HTML5 for its desktop video player, but at least until that happens (and hopefully not after), Linux users are stuck with some pretty hacky workarounds. In fact, running Netflix inside a virtual machine was previously considered the most reliable option. Fortunately, now there's Netflix-Desktop, a cleaner hack which is comprised of a patched version of WINE using Firefox and Microsoft Silverlight.

Installation:

I had no issues getting Netflix-Desktop installed and running, but as soon as I started watching something, there were problems. The first was a hideous, unwatchable amount of screen-tearing. The second was an absolute cacophony of audio stuttering and popping. At first I thought the audio issue might be with my PulseAudio or ALSA settings, but both problems were easily solved by getting vsync working.

Previously, I had tried to use the Nvidia settings panel to no avail. I also tried enabling the compositor in Xfce4. Nothing. In fact, when I enabled the Xfce4 compositor, it generated a horrendous amount of tearing in games that previously seemed to have vsync working. I was pretty frustrated until I came across an old friend of mine, compton.

Compton is a lightweight Xlib compositor that agnostically runs on top of window managers. It provides features like:

  • real transparency
  • shadows
  • fade-in/out
  • blur
But most importantly, compton gives you an opengl desktop with vsync. In my case, this was very useful since my 1st party drivers didn't seem to be doing the job. With compton, the screen tearing completely went away, and the audio stuttering is now no worse than in anything else in my system.

Here is some information about getting compton for Ubuntu, as well as a description of some of the options. If you're in Arch Linux, you can use the compton-git AUR package.

Here are the options that I use (same as the aformentioned post's) for near-perfect Netflix-Desktop playback:

compton --backend glx --paint-on-overlay --glx-no-stencil \
--glx-no-rebind-pixmap --vsync opengl-swc --detect-client-opacity \
--shadow-exclude "! name~=''" -b

Unforunately, I can't seem to get compton started via .xinitrc or the Xfce4 startup manager. If you're using Xfce4, you might have to start it manually.

UPDATE: There is an old trick where instead of putting the command in .xinitrc, the command is placed in a shell script which gets executed in .xinitrc. I just verified that this works with compton. Just make sure the shell script has permission to execute and has #!/bin/bash (or whatever will be executing the script) at the top.