VLC IPCAM mosaic to screen – lower CPU usage.

Current 2×2 mosaic script and config for MBP 15″ Retina. Lowered CPU usage by 50% over x264 encoding and 25% over mp1v.

#!/bin/bash

/Applications/VLC.app/Contents/MacOS/VLC –vlm-conf ./cam.conf –mosaic-width 2880 –mosaic-order “1,2,3,4” –mosaic-height 1800

 

(cam.conf)

#new channel1 broadcast enabled

#setup channel1 input “rtsp://admin:xxx@10.0.1.21:554//Streaming/Channels/2”

#setup channel1 output #mosaic-bridge{id=1,height=480,width=704,sar=3:2}

new channel2 broadcast enabled

setup channel2 input “rtsp://admin:xxx@10.0.1.22:554//Streaming/Channels/2”

setup channel2 output #mosaic-bridge{id=2,height=480,width=704,sar=3:2}

new channel3 broadcast enabled

setup channel3 input “rtsp://admin:xxx@10.0.1.23:554//Streaming/Channels/2”

setup channel3 output #mosaic-bridge{id=3,height=480,width=704,sar=3:2}

new channel4 broadcast enabled

setup channel4 input “rtsp://admin:xxx@10.0.1.24:554//Streaming/Channels/2”

setup channel4 output #mosaic-bridge{id=4,height=480,width=704,sar=3:2}

new mosaic broadcast enabled

setup mosaic input file:///cam.png

setup mosaic option image-duration=-1

setup mosaic option image-fps=0

setup mosaic option mosaic-rows=2

setup mosaic option mosaic-cols=2

setup mosaic option mosaic-position=1

setup mosaic option mosaic-borderw=100

setup mosaic option mosaic-borderh=100

setup mosaic option mosaic-keep-aspect-ratio=1

setup mosaic output #transcode{sfilter=mosaic,vcodec=UYVY,vb=100,acodec=none,threads=8,scale=0}:display

#control channel1 play

control channel2 play

control channel3 play

control channel4 play

control mosaic play

 

Install Apple Airplay on Raspberry Pi in one line

Working on Rasbian

sudo apt-get install git libao-dev libssl-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libwww-perl avahi-utils libmodule-build-perl  && git clone https://github.com/njh/perl-net-sdp.git perl-net-sdp && cd perl-net-sdp && perl Build.PL && sudo ./Build && sudo ./Build test && sudo ./Build install && cd .. && git clone https://github.com/hendrikw82/shairport.git && cd shairport && sudo make install && sudo cp shairport.init.sample /etc/init.d/shairport && cd /etc/init.d && sudo chmod a+x shairport && sudo update-rc.d shairport defaults && sudo nano shairport

This ends with the init.d shairport file being opened by Nano, find the line starting DAEMON_ARGS YOURNAME the line below

DAEMON_ARGS="-w $PIDFILE -a YOURNAME"

All this information was gathered from a webpage written by Adam Burkepile

To pick a sound card, say you have a USB speaker or HiFiBerry DAC

https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture#Set_the_default_sound_card

Wireless MiLight automation with Raspberry Pi + IFTTT + Evernote + Geeknote

MiLights have this good platform that is simple to use but no IFTTT integration. Looking through the web didn’t provide any easy solutions either. These are just my notes:


MiLight interface <– Python Milight (Raspberry Pi)

Basic command structure: milight (channel) (on/off/B/C) (value) where channel 0 is all, B is brightness (0-19) and C is colour (0-255). Config points to wireless bridge, segregate program in separate directories for controller isolation.

milight 0 on

milight 1 B 10

milight 1 C 190


IFTTT (f*&^king inflexible heap of crap asdjkahsd!!!1)

Recipe bullshit here for lights out just before midnight: When Date Time channel hits 11:45, post note to Evernote with linux commands.

echo “Date Time Lights out IFTTT” `date` >> /home/pi/HA/lights.log && milight 0 off

Log event on RPi then command milight to turn off all LEDs.

IFTTT Recipe: MiLight control, lights out. connects date-time to evernote


Geeknote hack:

I’ll be going to hell for this insecure scripting but hey ho, one day I’ll fix it.

Install Geeknote and register with Evernote (magic happens clearly because the documentation for both does not point you to the API key page, click the green button top right on page)

The hack is simple, change the default note editor to /bin/sh so that whatever is in the body of the note IFTTT posts to Evernote will be run like a script‘ish.

geeknet settings –editor /bin/sh

The way I’m parsing the notes is simple, the header/title/whatever contains the device needing to be controlled, in this case Lights. Get geeknote to search the Evernote account for this title and post the content of the message to /bin/sh where it will be executed. (Security…blah blah blah)


Setup a read, command and destroy script: lights.sh

#! /bin/sh

export PATH=/usr/bin:/bin:/usr/local/bin

/usr/local/bin/geeknote edit –note Lights

/usr/local/bin/geeknote remove Lights  –force


Crontab entry (did it with Webmin because it just works plus it will be executed by user pi not root) calls the script every 6 minutes 24/7.

0,6,12,18,24,30,36,42,48,54 * * * * /home/pi/HA/lights.sh #Scan IFTTT for MiLight notes

Install Postfix mail server to catch CRONTAB errors


It’s worth watching the Evenote page to see what’s being sent before the script destroys the entry.

Screen Shot 2015-03-10 at 13.36.25

Hello world!

Welcome to WordPress.com. After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.

Just another WordPress.com site