Category Archives: ubuntu

Kivy and vite-vite

Note to self: Use Kivy (Open source Python library for rapid development of applications for multiple platforms) and vite-vite (Toolkit for building business and productivity apps on Android using the Kivy framework) for next prototype.

Livestream webcam via webm to browsers

Here’s a work in progress: livestream webcam video to browsers using Node.js. From here. Ubuntu requires the ‘nodejs’ executable instead of just ‘node’

var express = require('express')
var net = require('net');
var child = require('child_process');

var cmd = 'gst-launch-0.10';
var args = '';
var options = null;

var app = express();

app.get('/', function(req, res) {
  var date = new Date();

  res.writeHead(200, {

  var server = net.createServer(function (socket) {
    socket.on('data', function (data) {
    socket.on('close', function(had_error) {

  server.maxConnections = 1;

  server.listen(function() {
    args =
    ['v4l2src device=/dev/video0',
    '!', 'video/x-raw-rgb,framerate=30/1',
    '!', 'ffmpegcolorspace',
    '!', 'vp8enc', 'speed=2',
    '!', 'queue2',
    '!', 'm.', 'audiotestsrc', 'is-live=1',
    '!', 'audioconvert',
    '!', 'vorbisenc',
    '!', 'queue2',
    '!', 'm.', 'webmmux', 'name=m', 'streamable=true',
    '!', 'tcpclientsink', 'host=localhost',

    var gstMuxer = child.spawn(cmd, args, options);

    gstMuxer.stderr.on('data', onSpawnError);
    gstMuxer.on('exit', onSpawnExit);

    res.connection.on('close', function() {


function onSpawnError(data) {

function onSpawnExit(code) {
  if (code != null) {
    console.error('GStreamer error, exit code ' + code);

process.on('uncaughtException', function(err) {

USB/IP under Ubuntu

USB/IP is a general USB device sharing system over IP network. Unfortunately, on newer  Ubuntu’s the usb/ip device driver isn’t compatible with the userspace tools. Here’s how to fix this on Ubuntu 12.10 (and probably some older versions).

Grab Linard Verstraete’s script from launchpad. Change the last line from

sudo ln -s /usr/local/lib/ /usr/lib/


sudo ln -s /usr/local/lib/ /usr/lib/

and run the script. You now have a compatible device driver and userspace tool. Install on both client and server and check the run instructions from the kernel source. Good luck – I couldn’t get it to work correctly but I did want to share these tips! Drop a note in the comments if you’re more successful.