Archive for Linux

TV Streaming and playback on Raspberry Pi

Follow by previous post on the MPEG2 license MPEG2 hardware decode license for Raspberry Pi., I get my hands busy putting things together to make use of the Pi.

The above screenshot is about streaming local TV signal in H.K. from Pi to network.

A bit of explanation:


  • Raspberry Pi version B running on 900MHz
  • A USB 2.0 Hub with external power supply.
  • MyGica D689 USB DVB-TH TV Tuner


  • mumudvb for streaming TV signal to the network
  • omxplayer for local playback
  • vlc on win32 for playback on PC (remote)

With the new MPEG2 License, playback on RPi with omxplayer is takes about 23% CPU,
mumudvb streaming to 2 IP unicast with different TV channel takes about 33% CPU,

With the new MPEG2 hardware decode license, it plays back at 100% frame rate on the Pi (was like 3fps only without the license)

P.S: I am having sound issues on my Pi due to some other reasons, didn’t spend the time on fixing it yet, so now local playback at mute, but I am sure I can iron it out next (should related to some ALSA drivers issues)

Good one there Team Raspberry Pi, such a nice computer to have and play with, thanks!

MPEG2 hardware decode license for Raspberry Pi.

It is just great for developers / manufacturers to listen to how the user thinks and use their products.

A Few word from the officials

If you’ve been following this website since we launched it last summer, you’ll probably be aware that we had to make some hard decisions about exactly what we could include on the Raspberry Pi if we were to meet our extremely low target price. One of the things that we had to regretfully dismiss as an option was an MPEG-2 decode licence for every unit. Providing that licence would have raised the price of every Raspberry Pi by roughly 10%, and we simply weren’t able to justify that when we held it up against the educational goals of the Foundation. Our initial expectation was that most of you would buy the Raspberry Pi for educational purposes, and that you wouldn’t mind that MPEG-2 wasn’t available. Our bad.

At GBP2.4 (only USD3.8, or HKD30), now our beloved RaspberryPi can enjoy full hardware decode with MPEG2 support, which is very important for my usage in DVB TV solutions!

New video features! MPEG-2 and VC-1 decode, H.264 encode, CEC support –

Place your order now to show support! I ordered mine~~~

MPEG-2 license key

1525: Order placed, confirmation received.
1712: License Key received.

That is quick!

Seems I will need to upgrade firmware of GPU / recompile my custom kernel for the new MPEG2 decode to work (at least August 8th or newer releases based on post #1883) and I am a bit busy to do so, I shall leave it for the mean time till I am a bit more free to do so…
Raspberry Pi Discussion Forum – You wanted MPEG-2? You’ve got it!

Canon Canoscan n670u on Ubuntu 12.04 Server.


I still own an old scanner given by my cousin (Thanks Cousin L, yes I still uses it), this scanner was dated back from the year 2k era, I think Aunt gave 1 set to me first and I left it behind in AUS for mate YX, and in about 2005 Cousin L decided to upgrade his second set so this was given to me too, nice scanner to have, it runs with the 5V power from USB (at the time most scanner require extra power), it does fair speed on scanning, it works without much trouble on Windows XP.

It was severing me well for quite some time, I even developed code allowing me to scan by Web (PHP > shell_exec to my share folder and dropbox, from my Android and iPad), till I upgraded to 64bits Windows, dear Canon decided NOT to support this device any more (Curse the person who decided to make a SAME Hardware configuration with 64bit support), I was left alone..

I just hate throwing good hardware away because some greedy company wants more $$ from my pocket! so I try to get my hands dirty and get so workaround!

By first, I try to run it under a Lited version of  32bit XP (which only consume me like 90MB RAM), it works ok but the problem is virtualbox runs USB device like a 99 years old man, scanning a page of  B5 would take me more than 4 minutes….well can’t complain much as it still works, since I only uses it to scan books cover, which I tolerated that for a while…

Recently, I started to use VMware instead of Virtualbox, which give me much better USB support and speed on VMs, so I started to make this old baby works again on my system…

On the VM, I am running Ubuntu 12.04 Server LTS.

By reading some Ubuntu hardware compatible list, it sure does list as supported natively by Ubuntu, good start!

Ubuntu Wiki –
Hardware4linux –

A bit of search leads me to SANE, Scanner Access Now Easy, the scanning solution on Ubuntu, sounds good too!!

And I also found someone who happens to have the same scanner, sweet!!!

Wrestling a Canoscan N670U / N676U / LiDE20 scanner in Edgy –

Ok, lets start rolling:


apt-get install sane

apt-get install sane-utils

Done done, follow the above page example,

nano /etc/sane.d/plustek.conf

The part that confuse me a bit was the file, he actually means copying the block from the link

The second part is to edit the dll.conf of SANE

nano /etc/sane.d/dll.d/dll.conf

What we do is just comment out all unneeded modules, you can follow the link too if you are unsure.

by running “lsusb” and “sane-find-scanner”

>Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
>Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
>Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
>Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
>Bus 002 Device 004: ID 0e0f:0008 VMware, Inc.
>Bus 002 Device 009: ID 04a9:220d Canon, Inc. CanoScan N670U/N676U/LiDE 20


># sane-find-scanner will now attempt to detect your scanner. If the
># result is different from what you expected, first make sure your
># scanner is powered up and properly connected to your computer.

># No SCSI scanners found. If you expected something different, make sure that
># you have loaded a kernel SCSI driver for your SCSI adapter.

>found USB scanner (vendor=0x04a9 [Canon], product=0x220d [CanoScan], chip=LM9832/3) at libusb:002:009
># Your USB scanner was (probably) detected. It may or may not be supported by
># SANE. Try scanimage -L and read the backend’s manpage.

># Not checking for parallel port scanners.

># Most Scanners connected to the parallel port or other proprietary ports
># can’t be detected by this program.

Good, SANE sees my scanner, now to the scanning part, running “scanimage -L” (part of sane-utils, -L list devices)

scaniamge -L
>device `plustek:libusb:002:009′ is a Canon CanoScan N670U/N676U/LiDE20 flatbed scanner

I am good to go! a bit more digging for config needs, runs:

scanimage –help -d “plustek:libusb:002:009”

This output all the config I would need for scans.

My final command for the scan:

scanimage -d “plustek:libusb:002:009″ -x 215 -y 190 –resolution 600 –format=tiff > /mnt/ramdrv/output.tiff”

I am able to scan my books cover again!!!


With the better USB speed on VMware compare to Virtualbox, I get my B5 book cover in 600dpi in about 118.5 secs, a bit below 2 minutes, not that bad for a 12 years old scanner!!

BTW, I do most of my scanning job now by my other scanner Canon P-150, which has a auto paper feeder and do double side, 5ppm (10pages) at 600dpi , but this 12 years old baby is still working good, colors are fine and I am happy it still serves me, and once again thanks to Aunt and Cousin L, I had such a nice scanner and fun with it!!!

Maybe when I have more free time, I shall make my old Webbase scanning code to work with my new Raspberry Pi, a Wireless (Power of coz) Scanning server is just fun!

Extra reading.

Scanning from Terminal –
SANE how to –
SANE Documentation –
MAN scanimage –
Canon USA n670u – Canon USA n670u

ARMania – my ARM based devices.

Recently I have obtained different ARM based hardware for different usage / reasons, it always interested at these boards for different usages, and recently thanks to mates and friends, I have the chance and time to finally put some effort to it to do what I want.

Here are a few idea I would like to make use of these board.

  1.  A DVB-TH streaming server.
      I do own a slingbox, but the idea of a native app + extra cost on every client + the price of the slingbox isn’t something that interested me, what I would like to do is a HTML5 based DVB-TH streaming service, which I can stream DVB content to my devices in browser with HTML5.
  2. A home server monitor system.
      I recently am into Arduino, I would like to build a Web base sensors, video, sound system with it, which I can log example temperature, noise level, and some basic home automation with it.
  3. A old console emulator.
      I have been wanted to do this for long, who doesn’t love to play Mario Brothers now??

I have a different sets of devices on hand to do all of the above, but which goes which and which does the best?

Android device MK802

1200MHz CPU 1000MB RAM

This is an Android device which also support Ubuntu Linux 12.04 from the TF Card slot, honest currently it is very limited early build, I did try to run a few console emulator on Android port, too bad the speed wasn’t really up to my standard (<30fps), and there isn’t a big difference (A bit better) for emulators on Linux port, maybe due to lack of OpenGL and poor GFX drivers, I do have higher hope on this device since its higher CPU clock speed and more memory, I suggest it should get better when a better build of Android / Linux is being developed.

Raspberry Pi

ARM1176JZF-S 700 MHz CPU 256MB RAM

Just got it today in the morning, I think I will try idea 1 and 3.

TP-Link WR703N

Atheros AR7240 CPU (400Mhz) 32MB RAM

This device was meant to be a wireless router with a USB port, with custom firmware thanks to team openwrt, I was able to get basic DVB-TH streaming by mumudvb (no transcoding due to limited CPU resources and memory) with a custom build of openwrt, and I think this should be prefect for my idea 3, A home server system with Arduinos, USB webcam and so on because of its low power consuming.

The hard part on getting work done on WR703N was the OS, openwrt is not full linux, and I do have to go all way round to compile the whole build in order to get extra drivers and app support, compare to the above 2 which many apps / solutions has already been done and ready to use by apt-get install.

With all current test, to my surprise which turns out the old console emulation was the part which all these 3 devices didn’t handle that well (which mainly because poor GFX and CPU processing power and drivers support), and if transcoding is needed on DVB streaming, more processing power shall be needed, which leaves me to think of fall back to ATOM base x86 solutions.