Activating HW acceleration for embedded YouTube videos

Ever since Google Chrome became terribly slow in gmail, drive, etc regardless of computer or platform, I’ve picked up Mozilla Firefox again. The switch didn’t go painless but I really was tired of typing a whole sentence before Chrome would display it. This problem produces itself not only on google sites but actually in about any text box I would type, be it intermittently.

The main issue with switching to Firefox was stuttering video playback. As you may know, chrome bundles its own flash plugin which is actually the same plugin but tweaked to work optimally with chrome (pepper api). At the same time google controls distribution/patching.  So, if google can tweak the plugin for good performance, why can’t we? 😉

First thing I discovered, is that somehow flash hardware acceleration was disabled. You can enable this by right-clicking on any flash video and click on “settings”. In the “Display” tab, you can check “Enable Hardware Acceleration”.

flash enable HW acceleration settingSmooth youtube vids FTW! Fullscreen video’s also showed up on the correct monitor now (dual head setup). My joy was only for limited time, as I discovered hardware acceleration dit not work for embedded youtube video’s. I was happy nevertheless as the bulk of video’s I watch are on youtube.

However, today, watching the Jolla Tablet intro movie embedded on the site, I could not help feeling the itch again. Why oh why did this play fluently in chrome but did it suck so hard in firefox? Check out this framerate:

yt_embedded_noHWaccel1I started by creating a virgin system account to avoid having my 7 year old home dir, possibly dragging along some evil deprecated setting, be the culprit. This didn’t change anything but at least I had both a blank Firefox and Chrome profile to test with.

First I was under the impression that there would have to be a global flash settings file since when right-clicking on the embedded video, it showed the “Settings” as disabled. There does indeed exist such file: /etc/adobe/mms.cfg in which you can put “EnableLinuxHWVideoDecode=1”. This only crashed my firefox. I did install an additional vdpau package but it didn’t matter. Also, looking at the “Nerd stats” (right-click on video), I learned even youtube vids didn’t have hardware accelerated decoding, only accelerated rendering. So I didn’t proceed on this path.

Now let’s check out how chrome is doing it. Pulling up the “Nerd stats” did surprise me: chrome does not use flash by default for embedded video’s, it uses WebM/VP9!

This begs the question: how is Firefox’s WebM support? Turns out it’s no problem, just change your youtube html5 setting from “default player” (=flash) to “html5”.

youtube html5 settingsSo the  chrome pepper flash tweak actually came down on not using flash. 🙂 Youtube does this by default on chrome but not on firefox. Naughty Google!

You may notice that Firefox does not support all youtube hmtl5 features yet. In particular, you will be served VP8 video’s instead of VP9 which may make a difference in the available resolutions. However, Media Source Extensions and WebM VP9 can already be activated by setting:

media.mediasource.enabled = true

in about:config. Experimental h264 support can be activated with:

media.mediasource.ignore_codecs = true

You can track the MSE support in firefox in this bug report.

Itch scratched and fixed. Finally 🙂

Firefox ctrl+backspace behavior on linux

I’ve always hated why ctrl+backspace wouldn’t do what I expected in the address bar of Mozilla Firefox. So I stopped using Firefox. However, one day I tried it by accident on a windows box and was astonished it did work as expected! I didn’t care that much anymore since my main browser became Google Chrome. However, Chrome became more and more of a resource hog and even their owns sites like gmail and google drive run slower than on firefox. I started using Firefox again and got annoyed again over this small nuisance.

So I started googling the issue and found out that, apparently, linux users want non standard behavior because they are used to different selection behavior than for example a windows user.

I agree that double clicking a path in a console should select the entire path but I don’t see why that should affect the ctrl+backspace behavior. If I press ctrl+backspace in KWrite, it deletes the last word. If I press ctrl+backspace in the address bar in Dolphin, it will delete the last part in the path. The list goes on.. but I will never expect ctrl+backspace to be equal to “select all and press delete” which it does by default on Firefox/Linux.

Luckily, it turns out there’s an option layout.word_select.stop_at_punctuation to configure this behavior 🙂 You might also be interested in layout.word_select.eat_space_to_next_word.

DD-wrt: control radio on a Cisco Linksys E2000

Some people prefer to have their wifi turned off at night. DD-wrt already provides out of the box reprogrammability of the WPS button so you can use that button to turn the wifi off/on.

If you want to use a cron job to automate this process, you need to know the command line. I tried using the wl command:

wl radio off

Unfortunately this doesn’t do much. We might need to specify the network interface on which to apply the command. List the network interfaces using the ip addr command:

root@DD-WRT:~# ip a
1: lo: <LOOPBACK,MULTICAST,UP,10000> mtu 16436 qdisc noqueue
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast
    link/ether c0:c1:c0:ab:6c:70 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast
    link/ether c0:c1:c0:ab:6c:72 brd ff:ff:ff:ff:ff:ff
4: teql0:  mtu 1500 qdisc noop
    link/void
5: tunl0:  mtu 1480 qdisc noop
    link/ipip 0.0.0.0 brd 0.0.0.0
6: gre0:  mtu 1476 qdisc noop
    link/gre 0.0.0.0 brd 0.0.0.0
7: vlan1@eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc noqueue
    link/ether c0:c1:c0:ab:6c:70 brd ff:ff:ff:ff:ff:ff
8: vlan2@eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc noqueue
    link/ether c0:c1:c0:ab:6c:71 brd ff:ff:ff:ff:ff:ff
    inet 178.117.xxx.xxx/20 brd 178.117.xxx.255 scope global vlan2
9: br0: <BROADCAST,MULTICAST,PROMISC,UP,10000> mtu 1500 qdisc noqueue
    link/ether c0:c1:c0:ab:6c:70 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.1/24 brd 192.168.1.255 scope global br0
    inet 169.254.255.1/16 brd 169.254.255.255 scope global br0:0
10: etherip0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop
    link/ether f6:1f:60:c5:50:bf brd ff:ff:ff:ff:ff:ff

I’m no network expert so I checked the MAC address of the wifi interface in the web admin Status > Wireless page ( http://192.168.1.1/Status_Wireless.asp ) and figured eth1 must be the wifi interface.
And indeed, using the following command it worked!

wl -i eth1 radio off

You can check whether radio state changes in the wireless status page mentioned above. For automation, put these commands in a cron job on the Administration > Management page ( http://192.168.1.1/Management.asp ).

Using KDE systray notifications from bash scripts

I just improved my Extract audio script to show a system notification when it’s finished. In the meantime I also have a “convert to mp3” script which proves useful if you don’t care about the original audio stream and/or you target a platform with limited decoding abilities:

ffmpeg -i %u -acodec libmp3lame -ar 44100 -ab 160k %u.mp3

To popup a KDE4 system tray notification at the end of the encoding process, simply add the following:

kdialog --passivepopup 'Finished converting %u' 3

The last value simply specifies the timeout in seconds. To chain the commands together, use a semicolon, so it also executes when the encode fails.

Using your EID on opensuse 12.1

In Belgium you can use your EID to login onto the federal portal for using electronic services, for example, for filing tax return. Installation instructions are provided for Windows, Mac and (Ubuntu) Linux. This is what I had to do to get it working on opensuse 12.1 on a Dell Precision M4600.

Installation

smartcard reader

Since the M4600 is a fairly new model, I had to upgrade my pcsc/ccid package to the latest version. It seems the M4600 comes with a Broadcom Corp 5880 smartcard reader which is connected through USB (internally).

Add the chipcard repo:

sudo zypper ar -r http://download.opensuse.org/repositories/security:/chipcard/openSUSE_12.1/security:chipcard.repo

and “switch system packages” in Yast. You should have installed at least the following packages: pcsc-lite, libpcsclite1 and libpth20.

Depending on your smartcard reader, you need a different pcsc plugin package. The Broadcom 5880 smartcard reader is supported through the ccid driver. This means we have to install the pcsc-ccid package from the chipcard repo.

eid middleware

Add the following repo by Pascal Bleser:

sudo zypper ar -r http://download.opensuse.org/repositories/home:/pbleser:/belgium-eid/openSUSE_12.1/home:pbleser:belgium-eid.repo

and install the eid-mw package. I also noticed the eid-mw-firefox package in this repo, but it did not seem to work in my case, possibly because I’m using 64-bit firefox.

configuring firefox

  • Install the belgium eid firefox add-on.
  • Trust Belgium Certificate Authority: Edit menu -> Preferences -> Advanced -> Encryption -> View Certificates -> Authorities -> Belgium root CA2 -> Edit trust -> check all checkboxes
I’m not sure whether the firefox add-on is really needed. Afterwards I uninstalled it and it kept working.

Troubleshooting

smartcard reader

  • check in /var/log/messages which device you have
  • most devices are connected through usb protocol. Check your usb device list:
    lsusb -v
  • google the device or check the device compatibility lists of the pcsc-<driver> packages. You can find the ccid device list here.
  • if you have a pccard interface for your reader, check whether the device is installed with:
    pccardctl ls
  • install the pcsc-tools and perl-pcsc package to have access to some smartcard reader analysis tools. Running the pcsc_scan tool should yield similar output like this:
  • If you get a segfault when loading the pcsc-ccid driver, for example:
    pcscd[3228]: segfault at 0 ip 00007f98bec38121 sp 00007fff2e806208 error 4 in libc-2.14.1.so[7f98bebb8000+187000]
    check whether you updated your portable thread library with the one in the chipcard repo (package name is libpth20)
  • be sure to be using all the packages from the chipcard repo by using the “switch system packages”.
  • firmware upgrade as suggested here, was not necessary. Read the whole thread to find out why a ccid upgrade was actually necessary.

eid middleware

The government created an application eid-viewer which you can use to read some public data from your EID. It’s a java-based app so you need a java JRE to run it:

java -jar eid-viewer-4.0.4-146_tcm227-178503.jar

You can obtain it from this page under the catory “other”.

firefox

Although I installed this add-on, I don’t believe it is needed. I did have trouble the first time I signed in: it succeeded, but redirected me to a page where I would again need to choose whether I wanted to sign on with EID or password. I closed firefox, and tried again, this time it just worked. You can surf to this test page to test whether everything is configured correctly.

Add new harddisk on the fly

So you have this linux box and you want to add an extra harddrive without having to reboot it. The key command we’re looking for, is a way to rescan the scsi bus. This can be achived by rewriting some values in the /sys synthetic filesystem:

echo "- - -" > /sys/class/scsi_host/host#/scan

Replace the digit for the scsi host as appropiate.

If everything went well, you should get output on the console indicating it detected a new hard drive.

Disabling hibernation on windows 7 and why Dirt 2 shows no replay

Yesterday I made this awesome flying finish in Colin McRae Dirt 2 and wanted to view the replay only to realize: there is no replay? That sounded impossible and today, after missing another fine opportunity, I decided to go to the bottom of this. 🙂

Turned out Dirt 2 automatically disables the replay functionality behind your back when there is insufficient free space on your OS partition! That’s right:

  • I have Dirt 2 installed on a partition with 15 GB free space, but that doesn’t matter.
  • It requires 2GB to save a replay!
  • I does not inform the player when it gets turned off (it used to work in the beginning).
  • There is no visual indication whatsoever, that the replay functionality uberhaupt exists but is disabled! It is surgically removed from the gui instead of just a disabled button, for example.

IMO, this is just another example of why consolisation of excellent PC games like CMR is BAD. Anyway, don’t let me go there, let’s focus on hibernation in win 7. 🙂

So I have a 20GB partition for Wintendo 7, but with only 1GB free that does not seem to cut it. Turns out about 6.5GB is taken by the hibernation file (I have 8GB RAM) which I don’t use. So, how to disable that in windows 7? Open a command prompt as administrator and type:

powercfg.exe /hibernate off

That’s all.

Getting mic to work with NVidia VT1708S

Ever since I installed opensuse 11.3, I hadn’t used my mic/headset. Today I decided to fool a bit around in Ardour, but somehow my mic didn’t work. And alas, I made a classic beginner’s mistake: “the solution has to be difficult because it does not work out of the box”.

I tried the standard stuff like trying out all input sources, adding hidden channels, etc. but when that didn’t help I was quickly diving into custom .asoundrc configuration, arecord/aplay sysinfo scripts, probing kernel modules, looking into alsa upgrade scripts and the like.. 🙂

Until I had an epiphany while reading random forum post words. I had been adding the “hidden” channels to my mixer which indeed included “mic” and “front mic” with accompanying boost controls. I noticed a few others which I threw in as well for good measure. I neglected them though, as I didn’t feel interested in enabling “smart” 5.1 or IEC958 2, whatever that was. But then I suddenly remembered: motherboards come with configurable audio backpanels, so this wasn’t really about enabling a fancy audioprocessing feature but rather switching between the 5.1 and standard audio panel, duh!

Apparently, the 5.1 was enabled by default, so “muting” it solved my problem!

Btw, in case you wonder: the HDA NVidia VT1708S chipset is actually a HDA Intel chipset with VIA codec, hence the VTxxxx name. To keep things intesting. 😉