Category Archives: Hardware

Raspberry Pi – Video loop

Here is a nice week-end project, useful for automatic presentations, restaurant menus and waiting room video entertainment/marketing/information (my case).

I used a 32″ TV with a Raspberry Pi B (512 Mb RAM), a Wifi Adapter and a 64 Gb SD card (40 $CND at Costco) to create a simple video looping device.

My goal is simple, I want to use SFTP to upload videos in a folder, and have a simple Debian service loop and play each video file one by one.

Since I am not always here to restart the service, a simple reboot of the Pi (by unplugging) should restart the whole thing. No technical knowledge required !

Here is how I done it:

  1. Create nice corporate information slide deck
    • I suggest creating a visually interesting Powerpoint Presentation, with FULLY automated transitions and animation.
    • Test the presentation in Powerpoint.
    • Once it is perfectly tuned, export the Powerpoint to a MP4 video (sadly, only possible on Windows, not MAC OS)
  2. Setup the system
    • Install Raspbian with NOOBS on my 64Gb SD Card
    • Log-in with the pi user
    • If needed, setup wifi
      • type : startx
      • In LXDE, use the “Wifi” tool to setup the network
      • Exit LXDE
      • Reboot (sudo shutdown -r 0)
    • As a principle, I always upgrade the debian package and install vim (both are optional)
      • sudo aptitude upgrade
      • sudo aptitude install vim ctags
    • As we will use the CLI based Raspberry Pi Video player, omxplayer, there is no need for other software.
  3. Create the looping “application” (2 scripts and a folder)
    • Create a /home/pi/movies folder
    • Use your favorite SFTP client (ex: Mozilla) to push the corporate and other movie files to the Pi
    • Create the loop script (mine is named ~/declicTV/
  4. mkdir /home/pi/declicTV
    cd /home/pi/declicTV

The code is greatly inspired from here.
I have made a few improvements:

#first version from

# set here the path to the directory containing your videos

# you can normally leave this alone
SERVICE_OPTS="-o hdmi -n 3 -b"

# now for our infinite loop!
while true; do
        if ps ax | grep -v grep | grep $SERVICE > /dev/null
        sleep 1;
        for file in $VIDEOPATH/*
                echo $SERVICE $SERVICE_OPTS "$file"
                #Display Files
                $SERVICE $SERVICE_OPTS "$file"
  • Then, it is a simple matter of adding a script to init.d, just like explained here.
    • Don’t forget the update-rc.d part.
    • Here is my init.d declicTV script:
#! /bin/sh
# /etc/init.d/declicTV
# taken from

# Some things that run always
touch /var/lock/declicTV

# Carry out specific functions when asked to by the system
case "$1" in
    echo "Starting script declicTV "
    nohup /home/pi/declicTV/ > /home/pi/declicTV/videoplayer.log &
    echo "Stopping script declicTV"
    killall -9 -r
    echo "Usage: /etc/init.d/declicTV {start|stop}"
    exit 1

exit 0

I hope this will be helpful to you !

Upgrade to SSD without reinstalling Windows

It used to be that my first suggestion for a computer upgrade was “Bigger Screen” or “More RAM”.

Not anymore ! I announce that SSD is the next thing ! (If you can tolerate the craziness)

I just got a new Dell XPS 17 with a i7 Processor and 12 Gigs of RAM. I’m planing to use it for testing memory-hungry programs. Since I will use virtualization a lot, I figured I would need to give these SSD drive a try. Dell upgrade hard-drives prices were ludicrous for “no-name” SSDs, so I decided to buy a OCZ Vertex 3 120G drive from a local store.

For the record : SSDs rocks.

But since I forgot/did not bother to ask for a real Windows CD from Dell… I have a problem.

How can I upgrade my classic 500G HD to a 120G SSD without losing the OS ?

First, make sure you have this available:

  • A usb key/CD with Clonezilla installed (CZ)
  • A usbkey/CD with SystemRescueCD installed (SRCD)
  • A “self-made” Windows Repair CD (either 32 or 64 bits) (WRCD)
  • I assume you have access to 2 classic SATA hard-drives. I my case, I also had the good luck to have two SATA drives slots on a laptop. If that is not your case, try to use a USB external drive adapter or enclosure.
  • I assume you are replacing the first drive of a two hard drives system.
    • The main drive is going to be replaced by the new drive;
    • The second drive will remain in place at the end of the process.

Here are the simple, not-at-all-excessive-steps list to follow:

  • CZ: Before booting the system the first time, backup the main drive to the second drive
  • Figure out witch is the main drive (apart from the second drive) (In my case, Dell documentation was helpful)
  • Boot one time using the original main drive
  • SRCD: Resize the main drive so that the partition would fit on the (smaller) SSD drive
  • Reboot Again : Windows will react by a drive test (this is required or the next steps will fail)
  • CZ: Backup one more time (optional)
  • Remove 2nd drive
  • Move main drive to 2nd drive former socket
  • Install SSD drive in first socket
  • CZ: Clone form main drive to SSd drive
  • Remove main drive, and store in safe place (from now on, this will be your backup)
  • Install second drive in second socket
  • Reboot, again . Windows should react by a drive check
    • At this point. you witness your quickest. reboot. EVER.
  • Optional cleanup steps
    • SRCD: Delete “special” and “recovery” partitions
    • SRCD: Resize main partition to maximum size (all disk)
    • SRCD: Set boot flag on remaining “main” partition
    • WRCD: Boot with Windows Repair CD twice
      • First time will trigger an auto-repair feature
      • At second time, ask for “Repair startup” option to repair the OS
  • Reboot, cleanup again
  • CZ: Backup one last time.
  • Done.