Install the Latest Version of LCD4LINUX on Ubuntu

Update: It seems that I need to add some additional steps when installing on a completely vanilla version of Ubuntu. So I have added all the steps that should now be required.

Despite the most recent version (0.11.0) of lcd4linux being released in November 2009, Ubuntu Lucid comes with an older version and thus misses out on some new features and drivers, in particular drivers for the cool and cheap Pertelian X2040.

It is however, possible to build the latest version of lcd4linux from source, but you need to do a few things in order to get it to work.

This little guide assumes you have built stuff before on Ubuntu, so have all the necessary build tools.

First, navigate to the folder you want to download and build the source in.

Then, download the latest version via svn:

svn co https://ssl.bulix.org/svn/lcd4linux/trunk lcd4linux

Next, navigate into the newly created source folder using cd lcd4linux and install some dependencies:

sudo apt-get install automake autoconf m4 perl libtool gettext

Then, run ./configure, if you want to include a specific driver, for instance for Pertelian, include it here, like this:
./configure –with-drivers=Pertelian
Now, if you try to make, it wont work, I am not sure why, but there are some issues. To fix these, issue the two following commands:
mkdir m4
sudo ln -sf /usr/share/libtool/config/ltmain.sh .
Now, you can run:
make
sudo make install
And you now have a working and up-to-date lcd4linux. I’d recommend using checkinstall rather than make install, because you can uninstall the package at a later date if you want.

Doing all this allows me to run my Pertelan display on my little thin client that I use as a baby monitor. It now tells me the PIDs of FFmpeg and motion (so that I know that they are working and running), that the Internet connection is UP and the system load, alongside the date and time!

Author bio: Marie Moody is a freelance writer and blogger at Essay-bag.com – compare and contrast essay topics

A Better FFmpeg Progress Script

So, a while ago I wrote an FFmpeg progress script. It worked, but it wasn’t brilliant and it fell apart on occassion.

After getting so annoyed by trying to get it work, I gave up. However, having a need to encode some stuff with FFmpeg again, I decided to return to the script. In the interveening period, my post on the Ubuntu forums, apart from getting one of the best response ever (see the matrix comment) had also encouraged others to give their solutions.

I thus used a combination of these ideas to create my updated version, which is below. It seems to be slightly more robust and still give the same useful info. I will be using this version for now, so I hope it is of use for others 😉

#!/bin/bash
#updated ffmpeg progress indicator
#by Rupert Plumridge
#for updates visit www.prupert.co.uk
#Creative Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales Licence
# Based on the ffmpegprogress bar from: /web/20160323214453/http://handybashscripts.blogspot.com/2011/01/ffmpeg-with-progress-bar-re-work.html
# which was based on my initital progress script – circle of life and all that 😉
# version 2.0
# 07.04.2011
# now uses apparently better progress detection, based on duration of overall video and progress along the conversion
####################################################################################
# USAGE #
# 1) Run the script with the name of the file to be converted after the name of the script (e.g. ./ffmpeg-progress.sh “My Awesome Video.mpg)
###################################################################################
# Please adjust the following variables as needed.
# It is recommended you at least adjust the first variable, the name of the script
SCRIPT=ffmpeg-progress.sh
LOG=$HOME/ffmpegprog.log
display () # Calculate/collect progress
{
START=$(date +%s); FR_CNT=0; ETA=0; ELAPSED=0
while [ -e /proc/$PID ]; do # Is FFmpeg running?
sleep 2
VSTATS=$(awk {gsub(/frame=/, “”)}/./{line=$1-1} END{print line} \
/tmp/vstats) # Parse vstats file.
if [ $VSTATS -gt $FR_CNT ]; then # Parsed sane or no?
FR_CNT=$VSTATS
PERCENTAGE=$(( 100 * FR_CNT / TOT_FR )) # Progbar calc.
ELAPSED=$(( $(date +%s) START )); echo $ELAPSED > /tmp/elapsed.value
ETA=$(date -d @$(awk BEGIN{print int(($ELAPSED / $FR_CNT) *\
($TOT_FR$FR_CNT))}) -u +%H:%M:%S) # ETA calc.
fi
echo -ne \rFrame:$FR_CNT of $TOT_FR Time:$(date -d @$ELAPSED -u +%H:%M:%S) ETA:$ETA Percent:$PERCENTAGE # Text for stats output.
done
}
trap killall ffmpeg $SCRIPT; rm -f $RM/vstats*; exit \
INT TERM EXIT # Kill & clean if stopped.
# Get duration and PAL/NTSC fps then calculate total frames.
FPS=$(ffprobe $1 2>&1 | sed -n s/.*, \(.*\) tbr.*/\1/p)
DUR=$(ffprobe $1 2>&1 | sed -n s/.* Duration: \([^,]*\), .*/\1/p)
HRS=$(echo $DUR | cut -d: -f1)
MIN=$(echo $DUR | cut -d: -f2)
SEC=$(echo $DUR | cut -d: -f3)
TOT_FR=$(echo ($HRS*3600+$MIN*60+$SEC)*$FPS | bc | cut -d. -f1)
if [ ! $TOT_FR -gt 0 ]; then echo error; exit; fi
# Re-code with it.
nice -n 15 ffmpeg -deinterlace -vstats_file /tmp/vstats -y -i $1 -vcodec libx264 -level 41 -vpre main -vpre medium -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 $1.mkv 2>/dev/null & # CHANGE THIS FOR YOUR FFMPEG COMMAND.
PID=$! &&
echo ffmpeg PID = $PID
echo Length: $DUR – Frames: $TOT_FR
display # Show progress.
rm -f $RM/vstats* # Clean up tmp files.
# Statistics for logfile entry.
((BATCH+=$(cat /tmp/elapsed.value))) # Batch time totaling.
ELAPSED=$(cat /tmp/elapsed.value) # Per file time.
echo \nDuration: $DUR – Total frames: $TOT_FR >> $LOG
AV_RATE=$(( TOT_FR / ELAPSED ))
echo -e Re-coding time taken: $(date -d @$ELAPSED -u +%H:%M:%S)\
at an average rate of $AV_RATEfps.\n >> $LOG
exit

XBMC Ubuntu Minimal Maverick Install Script

As a little New Year’s present, I have updated a script that has been knocking around to allow you to install XBMC on a minimal version of Ubuntu Maverick.

If you simply install Ubuntu from the mini.iso containing the basic Ubuntu Maverick install, then on reboot, download my script using:

wget www.prupert.co.uk/scripts/xbmcmaverickrevo.sh

make it executable, using:

chmod a+x xbmcmaverickrevo.sh

then finally run it using:

sudo ./xbmcmaverickrevo.sh

I find it is best to run it again, once the script reboots the machine, as this fixes a few issues.

It is still a work in progress, as you can’t yet shutdown / restart etc via XBMC since it seems the method to add permissions in Ubuntu 10.10 have changed and they conflict with the setup here, so I am still looking into that. To shutdown / reboot at the moment, I log in via SSH and issue:

sudo shutdown -hP now

Also, it is designed to work just with the Acer Aspire Revo 3610, but there is no reason why it wont work with any other device (apart from maybe the audio configurations).

Enjoy.

Download It Here

Backup All your Files Using Google Docs

Google Docs recently upgraded to allow you to upload any file to Google Docs. This very handy feature means, if you purchase a little extra storage from Google, you can use Google Docs as your personal online backup service. Google offer a variety of storage plans:

20 GB ($5.00 USD per year)
80 GB ($20.00 USD per year)
200 GB ($50.00 USD per year)
400 GB ($100.00 USD per year)
1 TB ($256.00 USD per year)
2 TB ($512.00 USD per year)
4 TB ($1,024.00 USD per year)
8 TB ($2,048.00 USD per year)
16 TB ($4,096.00 USD per year)

From what I remember when I looked in to it, these prices are pretty good compared to dedicated online backup services (though anyone who needs and can afford the 16TB option needs their head examined!). The only issue is how to get all your files into Google Docs. Well, if your Command Line-Fu is strong, you could use Google CL, but it doesn’t work with a batch of files, unless you write some cunning script. A much easier alternative is to use software from Gladinet, in particular their Gladinet Cloud Desktop tool. This allows you to define various backup tasks, allowing you to sync folders and their subfolders to a folder in Google Docs (or Picasa or a number of other online sources). All your folders and subfolders are backed up to Google Docs, with the folder structure being replicated in Google Docs. You can set these tasks to run every day and it should only update new and changed files. I have been using it for the past month or so and it seems to work fairly well. The only real issue is due to slow upload speeds, but I am not sure whether this is an issue with my broadband provider or a limitation of the Google Docs servers. Either way, the results are that all my files are backed up to Google Docs automatically.

Use Dropbox as Your Own Personal Source Repository

Dropbox is an awesome little service, allowing you to sync various files between devices (PCs, Andriod and iPhones for example). Whilst there are lots of uses of the Dropbox service, I tend to use it for two main things.

The first is as my own personal SVN-esque server. I set up a folder in my main Dropbox “root” directory, by default in Windows this is under “My Documents/My Dropbox”. Any code I write, I save in this folder. The code is then synced to all my PCs automatically by Dropbox, allowing me to work on the code from anywhere. As I use Eclipse to write my code, I have set this folder as the default source folder for my workspace in both my Windows and Ubuntu version of Eclipse. Thus, all I need to is open up Eclipse and hit F5 to refresh and get all my updated sources, thanks to Dropbox!

I do the same for the music tracks I am working on under Renoise. By saving all my songs in a folder under the main Dropbox folder, the tracks are synced across all my accounts. As Renoise is cross-platform (to a degree) I can simply open up Renoise on both my Windows and Ubuntu machines and work on the same track. Sweet. This trick works for any cross platform program. You can do it for your Firefox or Google Chrome profiles, or even your Music Library!