Wednesday, November 06, 2013

mjpg-streamer on Rasberry Pi

Commands copied all across the webs so real credit to the Universe, mainly http://blog.miguelgrinberg.com/post/how-to-build-and-run-mjpg-streamer-on-the-raspberry-pi but not limited to.

Checkout the latest code:
svn checkout svn://svn.code.sf.net/p/mjpg-streamer/code/ mjpg-streamer-code

Intstall dependencies and work around bugs:
apt-get install libjpeg8-dev imagemagick libv4l-dev
ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h

I don't have a special Pi camera but a bunch of cheap Linux-supported USB webcams so I really want the input_uvc.so:
make mjpg_streamer input_file.so output_http.so input_uvc.so

Copy binaries around:
cp mjpg_streamer /usr/local/bin
cp input_uvc.so output_http.so input_file.so /usr/local/lib/
cp -R www /usr/local/www
cd /usr/local/www

Limit the index to a more limited choice, do whatever you want here really.
mv index.html index.html.fubar
mv stream.html index.html

Run the mjpg_streamer from a script, input is the /dev/videoX  and a port offset so that I can run multiple cameras:
#!/bin/bash
LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_uvc.so -f 12 -d $1 -r 1280x720" -o "output_http.so -p $2 -w /usr/local/www"

i.e., streamcam /dev/video0 8080 or streamcam /dev/video1 8081 from an rc script.

Finally set up a NAT on your router to point it to this or use Apache reverse proxies from an existing web server whatever floats your boat.

Here's the easiest way to do it on Apache, assuming the Pi is on 192.168.1.99 and you've got Apache server with ProxyPass etc. modules loaded. Go and look somewhere else on how to setup an Apache server. You might even prefer to install the Apache Server on your Pi, it might be easier to manage the Apache server instead of the locally managed one.

<VirtualHost *:80>
  ServerName webcam.fubar.com
   DocumentRoot /home/fubar/public_html/webcam
   ProxyPass / http://192.168.1.99:8080/
   ProxyPassReverse / http://192.168.1.99:8080/
   <Directory />
   </Directory>
</VirtualHost>

<VirtualHost *:443>
  ServerName webcam.fubar.com
   DocumentRoot /home/fubar/public_html/webcam
   SSLEngine On
   SSLProxyEngine On
   SSLCertificateFile ssl/server.crt
   SSLCertificateKeyFile ssl/server.key.insecure
   ProxyPass / http://192.168.1.99:8080/
   ProxyPassReverse / http://192.168.1.99:8080/
   <Directory />
   </Directory>
</VirtualHost>

Thursday, October 24, 2013

Ubuntu, Avahi and .local as a domain name

$BIGCORP uses .local as internal domain name.

The tosser who wrote Avahi and the wanker who made it default in Ubuntu uses ".local" as Avahi's internal domain name therefore nothing works. You can nslookup it but cannot use it in commands, scripts, URLs. Shitheads.

Edit /etc/avahi/avahi-daemon.conf and change
domain-name=.local
to
domain-name=.snafu

Save, exit, restart  Avahi daemon, curse the fuckers.

As you can see, I am seriously pissed off with these clueless jellybrains.

Wednesday, September 11, 2013

Disable that annoying DualStick pointer!

It is fugly but it works:
hakan@fubar:12:15:26:~$ cat bin/disablepointer
#!/bin/bash
DEVICE=`xinput --list |grep -i stick| awk '{print $5}'|sed s/id=//g`
PROPERTY=`xinput --list-props $DEVICE | grep Enabled|awk '{print $3}'| sed s/[^0-9]//g`
echo Disabling $DEVICE $PROPERTY 0
xinput --set-prop $DEVICE $PROPERTY 0

Simpler but less fun:
xinput -set-prop "DualPoint Stick" "Device Enabled" 0

Monday, May 27, 2013

Shitheads!

That's you, iOS and iTunes writers & designers!!!

Friday, January 11, 2013

Dear Ubuntu One

You gotta be kidding me. Stop deleting my files!
Sincerely annoyed,
H