Thursday, October 20, 2011

routing real-time audio to the internet

I've been working on a server-side audio tool. My app works well on the desktop - it is written in Java and the audio from SourceDataLine just works. So, I moved the app to a remove server.

Pulseaudio was installed on the remote server, and I thought it should be pretty easy to route the output back over the internet to myself.

In the end it was:

parec -r | oggenc -r -o - - | ./sighttpd -f ./oggout.conf

I called my java code with 'padsp', I'm not sure that is necessary but it probably is. This method avoids using Gstreamer (that should be a good solution if you want to scale: It can plug your audio into icecast/shoutcast.)

SourceDataLine provided the audio stream in my Java app.

NOTE: I spent a whole bunch of time playing with a file output pipe from pulse audio. The excellent support from pulse audio mailing list and irc channel steered me away from that.

Saturday, September 10, 2011

understanding the decision copyright in EU

If you are struggling to understand the sense of the copyright extension granted by the EU, I invite you to exercise the following idea against the decision:

The tradition of dead generations hang like a nightmare in the minds of the living.

In this case, Cliff et al have conjured a spectre that law makers have felt confident cowering to. The instantaneous value of the copyright in question has become crippling to law makers, trapped in the headlights of old intellectual capital. The alternative, to welcome a continuous introduction of content to the chaos of the public domain ecosystem, lost this round.

It doesn't take a great deal of imagination to think that: as Marx provides a compelling critique of modern political economy, Marx may provide a compelling critique of modern political economy.

For the record, IMHO Cliff's music is utterly worthless. And (IMHO) people that enjoy his music are idiots. And that goes for every other artist that has become so alienated from their art that they need lawyers to provide critical appraisal of their (past) actions.

Monday, July 18, 2011

sighttpd ogg only

sighttpd is an excellent light weight streaming tool. Version 1.2 is the current master from git:

One issue I had with this version is that it has a run-time dependency on shcodecs-record. The symptoms of noting having shcodecs-record available on the path is that sighttpd fails with:

execvp() failed: No such file or directory

I didn't need the stuff that shcodecs provides (MPEG-4 and H.264 encoding and decoding on SH-Mobile processor series.) To remove this dependency, a cheap hack was employed: comment out ./src/main.c:165 

// shrecord_run();

Then, recompile. I have a post on making a static sighttpd if you're interested in that.

The shrecord dependency has been removed in the recent git master, so get that and ignore this.

Sunday, July 10, 2011

static build of sighttpd

sighttpd is a handy lightweight tool for streaming media over the internet. It is a lightweight alternative to icecast/shoutcast.

I need a static build of this tool, so I followed the instructions and added LDFLAGS="-all-static" to the make command. The compete build chain was:

   autoreconf -vif
   make LDFLAGS="-all-static"
   scp ./src/sighttpd richard@myserver:tools/

NOTE: you'll need to have shcodecs-record is in search path.

Sunday, June 26, 2011

one-liner to get useful info on OpenNebula VMs

I've been playing with OpenNebula. I've got a few dozen VMs which are being provided with context dynamically. It would be handy to list all the machines MAC and IP addresses, along with their names. For this purpose, I use the following one-liner:

 for ID in `sqlite3 /var/lib/one/one.db 'select oid from vm_pool where state = 3 order by name;'` ; do onevm show $ID | grep "NAME\|IP\|MAC" | grep -v VIRTUAL | grep -v ' : ' | sed 's/REQUIREMENTS=/  /'; done


Tuesday, May 3, 2011

koan error on Scientific Linux 6

I'm doing some virtualisation stuff, using cobbler and koan. On a new install of Scientific Linux 6 (as a proxy for RHEL6) I got the error:

  if ret == -1: raise libvirtError ('virConnectGetVersion() failed', conn=self)

it seems that the package: qemu-kvm was not installed. So, to fix:

yum install qemu-kvm

Thursday, March 10, 2011

resetting password for user in authlogic

I needed to quickly reset a user's password in an Rails application that used authlogic. I didn't have the nice 'request reminder' stuff set up, so I used the console instead:

././script/console production
>> forgetfulUser = User.find(:first, :conditions => {:login => 'richard'})
>> forgetfulUser.password = 'newPassw0rd'
>> forgetfulUser.password_confirmation = 'newPassw0rd'

and it was done.

Thursday, February 17, 2011

encoding files to watch on Samsung TV

I have access to a nice Samsung TV that supports media on USB drives.

It has a bunch of codecs including x264 and MP3. My Ubuntu has some codecs on it so I needed to encode my media files into a suitable format to play them.

I received the error:

Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

And finally arrived at the following:

ffmpeg -i ./test.flv -acodec libmp3lame -vcodec libx264 -vpre medium test.avi

You can find helpful details on encoding on the blog:
including a handy list of encoding quality vs speed presets.


It may be worth running ffmpeg -i test.

If either of the streams are mp3 or h264 then you can save time by passing 'copy' as the -acodec or -vcodec respectivly.

Tuesday, January 11, 2011

Drupal pretty URLs on Ubuntu

Ubuntu helpfully provides Drupal in its repositories. This installed fine for me but during install.php (to configure drupal) pretty urls wouldn't work.

To fix this, I had to edit


find the line at the bottom:

#  RewriteBase /drupal

remove the '#' and add a '6' onto the end to give:

RewriteBase /drupal6