31 August, 2013

Android Rtsp Usage



Loved my Samsung Galaxy but recently replaced it.  Result is that I have a relatively decent smart phone with little, to no, purpose in life.  Repurposing as a RTSP server device seemed like a reasonable task.

Reviewed a series of video server apps in the Google Play Store, but only one that worked well for me with Linux RTSP clients was:
https://play.google.com/store/apps/details?id=com.pas.webcam

After installing the app and short configuration, you start the server by clicking the 'Start server' button in the video preference activity.

Once the phone streaming is running, it displays a live view of the scene and the connection URL.

Open it with VLC and you're cookin' with bacon:


$ cvlc http://192.168.0.157:8080/video






VoilĂ .

24 August, 2013

Soupin' Up Your Linux Harddrive Performance

I came across a little utility that I was until now unaware of. I discovered it when I was doing a search for increasing hard drive performance on our Linux workstations, the utility 'hdparm'.

The remainder of this posting should be performed in single-user mode to avoid interrupting remote users and get proper performance measurements for your system.

First, let's baseline our system hard drive performance, do so performing the following command as root.

# /sbin/hdparm -Tt /dev/hda

The first parameter '-T' measures the performance of the cache system, how the memory, CPU and buffer cache perform together.

The second parameter '-t' measures the performance of the disk, reading data not in cache. According to my drives specs which advertises XXX MB/sec this is pathetic in comparison.

# /sbin/hdparm /dev/hda

It shouldn't surprise you to see a good number of the drive features are turned off. These default settings are nice, safe but by no means optimal. These settings are pretty much guaranteed to work for near any system you throw at it, from a x386 to bleeding edge hardware.

The first option, 'multicount' is short for multiple sector count. This controls how many sectors are fetched from the disk for a single I/O interrupt. The man page suggests that enabling this feature may reduce disk overhead by 30-50% and provide 5-50% data throughput improvements.
The second option, 'I/O support' controls how data passes from the PCI bus to the controller. Near all modern controller chipsets support mode 3, 32-bit mode w/sync. Turning this on will likely near double your throughput.
The third option, 'unmaskirq' allows Linut to unmask other interrups, allowint it to attend to other interrupt driven tasks whil waiting for the disk to return the requested data. While not all hardware configurations will be able to handle this, if your hardware supports it you should note better response time.
The fourth option, 'use_dma' should be used with a bit more caution, we'll be ignoring this feature as it's documented as risky.

So, let's get our hands dirty.
Let's first set 32-bit w/sync on and multicount on.


# /sbin/hdparm -c3 -m16 /dev/hda
# /sbin/hdparm -Tt /dev/hda


'K, let's take another step.

# /sbin/hdparm -X66 -d1 -u1 -m16 -c3 /dev/hda
# /sbin/hdparm -Tt /dev/hda


It's worth noting that these settings don't persist, rebooting your box will default back to your original settings. This allows you to play around with it 'til you find a suite of settings you're happy with. When you're happy, edit your /etc/rc.d/* scripts, adding the assignments after the fsck check.




17 August, 2013

Simple Bash Loop

Seems I have to look this up a gazillion times.


#!/bin/bash

for i in {1..5}; do
 echo $i
done

Cheers.