Tuesday, December 30, 2014

ARCH Linux on a WM8850-based mini laptop

One of my purchases earlier this year was a mini laptop, powered by a Wondermedia WM8850 chip.



It's kinda handy: runs Android/Linux selectively, has a HDMI interface, wired Ethernet and fullsize USB 2.0 ports. Also, it can be charged from USB, tablet style.

Quirks include no HDMI on Linux (yet), and it takes a bit of effort to turn on the wireless. Missing the gpio binary, you can get there by using the sysfs interface:

echo 6 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio6/direction
echo 1 > /sys/class/gpio/gpio6/value


Just echo 0 there to turn it off again.

Compiling a kernel needed some scraping on the web, but can be done like this:

cd linux-3.16
nice make ARCH=arm menuconfig
nice make ARCH=arm zImage
cat arch/arm/boot/zImage arch/arm/boot/dts/wm8850-w70v2.dtb > arch/arm/boot/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "My Linux" -d arch/arm/boot/zImage_w_dtb ~/uzImage.bin
make ARCH=arm modules
sudo make ARCH=arm modules_install


The kernel config is online here.

It works happy with a 8GB SD card and adding a bit of swap can't hurt as the 512MB of RAM is not that much.

Thanks for the vt8500 developers!

Monday, December 29, 2014

HTML5 video live streaming with ffmpeg and mediaelement.js, Round 2

Follow-up from this summer to the original post.

So, after not rolling out our HTML5 player last year, we've decided to give it a go again this year.
What we've learned: things have changed in Internet-land.

IE no longer requests or supports WMV anymore, which is weird but actually correct. It takes mp4 now as default.

Chrome was still ticking along happy.

Firefox was a big surprise: between version 19 and 20 they've reworked the HTTP engine, so it's a bit quirky now:
  • It fetches the first 8k for metadata in a request
  • It uses HTTP 206 Partial content requests now
  • If it doesn't get an X-Content-Duration, it'll send a new partial request for the end of the file. As it's transcoded on the fly, this is bad for us.
So, we need to give it:
  • HTTP 206 headers
  • Range headers
  • X-Content-Duration headers (in seconds)
This can be done with something like this:

$ua=$_SERVER['HTTP_USER_AGENT'];
$useragent='generic';
# match Firefox 1-19
if ( preg_match('/Gecko.20.*Firefox.(1){0,1}[0-9]\./', $ua) ) {
    $firefox19=true;
}
# match all Firefox
if ( preg_match('/Gecko\/.*Firefox.[1-9]/', $ua) ) {
    $firefox=true;
}
# if Firefox 20-
if ($firefox && !$firefox19) {
    $useragent='ff20';
}

# generic headers
if ($useragent=='generic') {
#header("HTTP/1.1 200 OK");
#header('Content-Disposition: attachment; filename=' . basename($file));
}

# firefox 20+ headers
#   firefox 20 wants partial content with code 206, and likes X-Content-Duration
if ($useragent=='ff20') {
header("HTTP/1.1 206 Partial Content");
header("Range: bytes=0-");
header("X-Content-Duration: $totduration");
}

I couldn't get the Flash fallback of mediaelement.js working and Silverlight was killed by Microsoft, so mediaelement.js was taken out from our setup, with a manual Flash fallback link.
We've also noticed A-V sync issues with ffmpeg, so deployment was pulled again, but we're making progress.

Thanks to Browserstack, for making life easier while testing.

Sunday, December 28, 2014

Linux, Network and Datacenter contractor/freelance engineer in Dublin

New year, new-old adventures:

I'm moving back to the contract/freelance market, this time in Ireland. I'll be available as a Linux, networking and datacenter engineer in Dublin and Shannon (as necessary).

Certified to work on the following kit (the list is not exhaustive):
- Cisco
- Juniper
- Brocade
- HP
- D-Link
- Zyxel

For the full list and to contact, please check out my LinkedIn profile.
I'm happy to work through Elance, as it provides protection to all parties.
I have a nice Experts-Exchange profile as well.

Edit:

Now we do Facebook as well!

Edit2:

The website is live: d8ns.com.