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

Java mail and SMTP: “501 HELO requires valid address”

I was trying to send a mail through Java the other day and kept stumbling upon the following exception:

javax.mail.MessagingException: 501 HELO requires valid address

I thought it was caused by an authentication problem or my provider preventing me from sending from a random address.
The former I tried to address by making sure I was fully authenticated as to prove I was not trying to send spam. In java mail the following properties are relevant for sending authenticated mail using TLS:

-Dmail.smtp.host=<your smtp server>
-Dmail.smtp.port=587
-Dmail.smtp.username=<your username>
-Dmail.smtp.password=<your password>
-Dmail.smtp.auth=true
-Dmail.smtp.starttls.enable=true

and setting an authenticator on the mail session object:

Session session = Session.getDefaultInstance(System.getProperties(), new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(MAIL_USER, MAIL_PWD);
}
});

The latter I tried to address by sending from an alias that was associated with the original mailbox (user/pwd combo). Yet I kept getting the same exception.

Looking up the SMTP protocol and testing with telnet, I found out that normally you are supposed to provide a domain name when issueing the EHLO or HELO command. Since the api does not provide any methods for that, I looked for some more properties and indeed, it turns out you need to set

-Dmail.smtp.localhost

to make it provide the hostname for the EHLO command. According to the docs:
Should not normally need to be set if your JDK and your name service are configured properly.” but apparently my case was not normal 🙂

Also worth noting is that you can turn on debug output with:

session.setDebug(true);

UZLGastennetLogin v0.7.1 beta release

Most important changes are use of wakelock for more robust login and about screen for beta info. I also discovered some Samsung devices put quotes around the network SSID which caused the network detection to fail..

Changelog

v0.7.1
======
* fixed network detection on some Samsung models
+ use wakelock for more robust login while on the move
+ about screen for beta info
* changed pending intent flags for notification
* clear error notification on successful login
* internet access check "not ok" reports as error

Internet Explorer basic authentication automation

At work I tried setting a custom header (for example for basic authentication) when navigating the internet explorer activex component using OLE automation. I didn’t find much info on the web, so I post it here as a reminder.

Setting custom headers is in fact supported by the navigate method on the IWebBrowser2 interface as stated in the msdn: simply supply a 5th element. For example, in java it looks something like this:
invoke("Navigate", new Variant[]{
new Variant(url),
new Variant(),
new Variant(),
new Variant(),
new Variant("Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==")
});

UZLGastennetLogin v0.6.3 stable release

After over 2 years of “testing” version 0.6.3 of the UZLGastennetLogin android app has been promoted from the beta channel to the stable channel. Important changes since the previous stable 0.4.2 include a widget indicating login state and notifications for login errors etc.

Since Google Play now supports beta APKs, the beta app itself will be removed from the market In the near future and a beta channel will be added to the stable app instead.
If you’d like to join the beta, surf to beta access. Currently only IT staff at UZ Leuven is given access. If you’d like access too, please join this G+ community.

Changelog

v0.6.3 / 12th September 2011
============================
+ optionally check internet access periodically, configurable interval
* restore last login time at activity resume
+ log last check timestamp

v0.6.2 / 30th August 2011
=========================
* widget: attempt at fixing click listener not working anymore after extended usage
* moved checkoutside worker to service
+ pref: automatically check internet access after each login
+ added extra app states communicating internet access check status
+ added notification when proxy problem occurs
* activity: properly preserve gui state when rotating device

v0.6.1 / 12th August 2011
=========================
* fc on startup: fixed bug in retrieving notification level when no setting is present yet
+ translation update

v0.6.0 / 11th August 2011
=========================
+ notifications, configurable through 4 levels
+ configurable notification sound
* automatic login retry on login/pwd change
* avoid multiple instances of activity
– disabled install to sd to prevent widget trouble

v0.5.1 / 1st August 2011
========================
* widget: attempt at better distinguishable init icon

v0.5.0 / 31th July 2011
=======================
+ widget: shows login state, click on widget to open activity
+ activity: show last login time and ip
* service: correctly parse json response to allow proper logout
* service: moved logout action into service
* service: use AndroidHttpClient instead of HttpClient to avoid IllegalStateExceptions
* service: don’t attempt login on portal error
+ activity: initial localisation support

VLC on opensuse 12.3

Last week, I installed opensuse 12.3 and encountered the following problem with VLC:

main decoder error: no suitable decoder module for fourcc `mpgv’. VLC probably does not support this sound or video format.

I had this for about any video format (mpgv for a DVD in this case). Turned out it is a package problem. Simply install vlc-codecs and you should be good to go.

Update: apparently, this is not a bug, but a feature, see
google+ post
mailing list post