Friday, May 6, 2016

Updated Streaming Geovision IP-CAM to YouTube

I recently got a Raspberry Pi 3 to play with and wondered if it could take over the Cat Cam streaming duties from a more traditional x86 Linux server. Moving the script over and updating it for the much newer version of avconv (the libav-tools version of ffmpeg) I found it worked but consumed a whole core of CPU and ran hot at 100% - but it worked.

Well, this was the same problem that forced me to hold back updates to libav-tools on the original server. I thought harder. Realised that the CPU was nowhere near enough to be transcoding the video and so maybe the audio was the problem. Remember that the original avconv command line added a silent audio track and then encoded it as aac? Well, perhaps the aac codec was inefficient? I tried mp3 as the Raspbian version of libav-tools has mp3 encoding as standard, unlike the older version I had. Not much change.

Next brainwave, see if the camera can add silence and just copy the stream, same as the video. Well, I remember there was a setting and eventually I found it:

I ticked this, saved, changed the command line to simply copy the stream and voila! Down to 3% and streaming perfectly.

As the Pi isn't quite ready for production use at home I went back to my original server, updated libav-tools and the dependencies and made the same changes and I was greatly relieved to see the same behaviour. All is good, finally.

The underlying command line is now like this:
avconv -v warning -rtsp_transport tcp -i rtsp://camera1:8554/CH001.sdp -codec:v copy -codec:a copy -f flv rtmp:// -c copy -map 0:v -f segment -segment_time 300 camera1-%03d.mp4
Note that the last part of the command line is to do with the saving off or 5 minute chunks as a CCTV backup and everything after the -c copy ... can be left out

Wednesday, April 27, 2016

Node Red: Forcing numeric comparisons in a Switch node

I've been learning and using node-red to control a relay that turns on my car charger (technically an EVSE, the charger being in the car itself) and one thing I discovered as that the Switch node doesn't enforce any specific type for the comparisons. A bug was reported and a change made in a previous version, for details see, but this was then removed when new features were added to the Switch node.

How this causes problems is if your numbers have different lengths and the default msg.payload type is a string; then 850 is greater than 2000.

The solution I found was a very simple intermediate function that just changes the type of the msg.payload to a number. Put this in front of your Switch node and all works as expected:

save image

Long delayed update

It's been sometime since I posted anything here. Social media and forums means that much of the stuff I'm do get mentioned there in the first instance. I am going to try to make the effort to post here too and in more detail if for no other reason than to have a long lived and locatable instance of all this stuff that I think may be interesting.

Thursday, April 10, 2014

Streaming a Geovision IP Camera to Youtube with avconv

Just a very quick note on the command line I have used after much googling to send my camera stream from a Geovision GV-BL2410 to YouTube Live. The secret was forcing a silent audio stream, which was the step I had previously missed (all on one line):
avconv -v quiet -rtsp_transport tcp -i rtsp://[RTSPIP:RTSPPORT]/CH001.sdp -b:a 128k -f s16le -ar 44100 -ac 2 -i /dev/zero -codec:v copy -codec:a aac -f flv -strict experimental "[YOUTUBEURL]/[YOUTUBESTREAM]"
Obviously replace RTSPIP, RTSPPORT, YOUTUBEURL and YOUTUBESTREAM with your specific values. The YOUTUBEURL will be the one that starts "rtmp://..."

Tuesday, November 5, 2013

Adventures in record cleaning

I've been buying far too much used vinyl in charity shops over the past few months and no matter how filthy or clean these new audio treasures are they never go near my stylus without a full wet clean. Originally I started by using the Knosti Disco Antistat record cleaner and their own cleaning fluid, but at £20+ a litre bottle, with the occasionally cheap deal hitting £15 it was becoming expensive. The fluid can be re-used but even with filtering through the basic paper filters they provide (5 with each bottle) the recycled fluid is full of dirt - and worse the particles that make it through the paper filters are small enough to get left in grooves. I've been thinking that there must be better and cheaper ways to do this.

Sunday, September 23, 2012

"Oh, another thing about stylus down-force..."

Collecting again. Stop it.

Those who watch my random musings on Facebook will know that I have been buying and inheriting more and more old vinyl from charity shops, friends and colleagues. My small collection of old 80s records has now grown to about 5 times the size in the last few months. So, I'm going to slow down with collecting more as there is simply neither enough storage space nor enough listening hours.

Friday, September 21, 2012

Thinking about stamps and data models

I am in no way formally trained in relational databases, data modelling etc. but I am a couple of pages ahead of some. Having said that I think all that does is give me better opportunities to shoot myself in the foot, more quickly and with better accuracy.

So, that disclaimer out of the way, I've been thinking about how to represent a stamp catalogue and collections in a SQL database. I've been playing with MySQL Workbench as a simple design tool and while it's cute it takes quite a lot of work. A sheet or paper and a pen is a bit simpler at this stage.

So, what have I got so far? Not a lot to be honest. Below are some potentially incoherent ramblings and comments are welcomed.