Creating a time-lapse movie using avconv

This note explains how to take a number of still images and combine them into a movie using “avconv”.

This note applies to:

  • Ubuntu 14.04
  • avconv 9.16


Before starting a time-lapse project, one should consider some constraints. The number of pictures that can be taken by the camera is constrained by the size of the memory card where the camera saves its information. On the other hand, the largest possible number of pictures should be taken, since it provides for a smoother end video.

Therefore, an approximate length of the event to be recorded must be used, in conjunction with the total number of pictures that can be saved to memory, to compute the interval between each picture taken.

Also, one should consider the power needs for the extended duration that the camera is used.

Finally, the memory card used by the camera should be fast enough to record the images at the rate that they will be produced.

Image collection

After all pictures have been taken, one ends up with a large collection of images, generally numbered sequentially by the camera using a special naming convention. For this note, an example is used to demonstrate the process. In this example, about 2300 pictures were taken every two seconds, over a period of 1 hour and 20 minutes. The resulting collection was picture named as follows:

Creating Movie

On Ubuntu, the command-line tool “avconv” can be used to combines still images into a movie. The command required to combine the images from the previous example is:

The parameter “-r 10” sets the number of frames per second on the input stream. This is an important parameter since it influences both the smoothness of the video and its length. The higher the number, the smoother the resulting video. Ideally, the input frame rate should be 25 to 30 frames per seconds for the best smoothness.

However, following our example, at 25 frames per second, the resulting video would be 1.5 minutes long. In our example, we wish to have the resulting movie showing the original event over 4 minutes. Therefore, the input rate is set to 10.

The parameter “-start_number 6796” specifies the number at which the file name sequence starts at. This parameter is used with the input file format parameter “-i IMG_%d.JPG”, where the portion of the name with %d is replaced by a number, to find each image file.

The parameter “-q:v 0” sets the highest output video quality.

The parameter “-s hd1080” is used to sets the output dimensions of the video to high definition.

The parameters “-vcodec libx264” and “-crf 25” are used to set the output CODEC to H.264 and output frame rate. The output frame rate does not affect the length of the movie.


Although there are many factors to consider when making a time-lapse movie, the command-line tool “avconv” is really useful stitch together the video portion of the project. “avconv” is the successor to “ffmpeg”. Both tools are mature and contain a large number of options.

Therefore, use the options above as a starting point and experiment until you reach the desired effect.

Access WebDAV drive over SSL using Basic Auth via Windows 7

This note explains how to use a WebDAV drive using Windows 7. In particular, this note addresses issues that arise when the WebDAV drive enforces SSL, using a self-signed certificate, and basic authentication. All the steps detailed below are performed on a Windows 7 computer where the Web drive is intended to be used.

This note relates to:

  • Windows 7 client
  • WebDAV drive served by Apache 2.2


Adjust Registry

This step is required if the WebDAV drive enforces user authentication using HTTP “Basic Auth”.

Start the program “regedit.exe” using the following steps:

  • Press “Start” button
  • Choose “Run”
  • Enter “regedit.exe” and press enter

In the regedit program, navigate down the tree using the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters

Within the “Parameters” section, set the value of setting “BasicAuthLevel” to 2. The meaning of the values are:

  • 0 – Basic authentication disabled
  • 1 – Basic authentication enabled for SSL shares only
  • 2 or greater – Basic authentication enabled for SSL shares and for non-SSL shares

Close the regedit program.

Reboot Windows.

Import Self-Signed Certificate

This steps imports the WebDAV certificate to the store of trusted certificate. This step is necessary only if the certificate
is self-signed.

Open Internet Explorer as an administrator. Only IE will work for this step (Firefox and Chrome are not helping for this situation).
To open IE as an administrator, press on the “Start” button and find the Internet Explorer entry. Right click on the Internet Explorer entry in the start menu and choose “Run as administrator”.

  • In IE, browse to the site where the WebDAV is stored. It should be a URL that looks like “”. If the certificate has not been previously accepted, a dialogue box opens warning the user that the certificate is not trusted. Choose to “Continue to this website (not recommended)”.
  • Once the page of the WebDAV is displayed, the address bar will contain a tab titled “Certificate Error”. Click on this tab and choose “View Certificates”.
  • Click on the “Install Certificate…” button.
  • Choose the option “Place all certificates in the following store” and click on the “Browse…” button
  • Select “Trusted Root Certification Authorities” folder and press “OK” button
  • Click on “Next” and then “Finish”
  • Accept warnings

Once the certificate is installed, IE can be dismissed since it is no longer used.

Mount WedDAV drive

Mount the WebDAV drive using the following steps:

  • Start Windows Explorer (Start > All Programs > Accessories > Windows Explorer)
  • Right-click on “Computer” icon and select “Map Network Drive”
  • Select a letter for your drive
  • Enter the URL for the WebDAV drive ( in the field titled “Folder”
  • Select “Connect using different credentials”
  • Press “Finish” button
  • Enter user name and password

At this point, the WebDAV drive should be accessible like any other drive.

Send message with SSL or STARTTLS using Java Mail

This note explains how to send an e-mail message using JavaMail, including using an SSL connection or the STARTTLS built-in security.

This note applies to:

  • Java version 1.7
  • JavaMail version 1.4.1

If using Maven, the JavaMail artifact can be obtained using the following dependency:

Often, a properties file is loaded to configure the SMTP transport layer. This allows a user to configure outgoing mail server without having to change the code. Here is a code excerpt to obtain a session and

Plain Text

For plain text access to the SMTP service, the following properties can be used:


For sending a message using the STARTTLS built-in security, the following properties should be used:


For sending a message using SMTP over SSL, the following properties should be used:


There is a property which sets the “debug” mode for JavaMail. It can be set with the following properties:

Setup development environment for EZ430-F2013 using Eclipse in Ubuntu

This note explains how to set up Eclipse for developing images for the EZ430-F2013. This note assumes that the development environment is set up in Ubuntu 12.10.

This note relates to:

  • Ubuntu 12.10
  • EZ430-F2013
  • msp430-gcc version 4.6.3
  • Eclipse Classic version 4.2.1


Install Command-Line Tools

The installation of command-line tools to support the EZ430-F2013 development kit is covered in a different note. Please refer to the note Use EZ430-F2013 in Ubuntu to complete this step.

Install CDT

In Eclipse, the packages that support C/C++ development are named the C Development Toolkit, or CDT. Portions of the CDT are required to enabled a development environment for the EZ430-F2013:

  • C/C++ Development Tools
  • C/C++ Development Tools SDK
  • C/C++ Debugger Services Framework (DSF) Examples
  • C/C++ GDB Hardware Debugging

To install the CDT, in Eclipse:

Create a C project to use MSP-GCC

Create a C project:

  • “File” > “New” > “Project…” > “C/C++ / C Project”
  • Enter a project name
  • Use default location
  • Project Type: Executable > Empty Project > Linux GCC
  • Press Finish

Set up new project to use MSP-GCC:

  • Right-click on project, select “Properties”
  • Select page “C/C++ Build” > “Settings”
  • Select configuration “[ All configurations ]”
  • Select settings “Tool Settings” > “GCC C Compiler”
    • Command: msp430-gcc -mmcu=msp430f2013
  • Select settings “Tool Settings” > “GCC C Compiler” > “Includes”
    • Add include path: /usr/msp430/include
  • Select settings “Tool Settings” > “GCC C Compiler” > “Optimization”
    • Optimization Level: “Optimize for size (-Os)”
  • Select settings “Tool Settings” > “GCC C Linker”
    • Command: msp430-gcc -mmcu=msp430f2013 -Wl,-Map=${BuildArtifactFileBaseName}.map
  • Select settings “Tool Settings” > “GCC C Linker” > “Libraries”
    • Add library search path: /usr/msp430/lib
  • Select settings “Tool Settings” > “GCC Assembler”
    • Command: msp430-as
  • Select settings “Tool Settings” > “GCC Assembler” > “General”
    • Add include path: /usr/msp430/include
  • Select settings “Build Artifact”
    • Artifact type: “Executable”
    • Artifact extension: “elf”
  • Select settings “Binary Parsers”
    • select “Elf Parser”
  • Press “Apply” and “OK”

Once the project is set up correctly, it should be possible to build an image from source by right-clicking on the project and selecting “Build Project”. In the console, the output of the build should look something like the following:

Set Up Debugger Configuration

To debug the project directly from the IDE, a debugger must be configured. The following steps are used to configure a debugger to use the command-line tool “msp430-gdb”:

  • Select “Run” > “Debug Configuration…”
  • Select “GDB Hardware Debugging”
  • Press the “New” icon
  • Set name
  • Tab “Main”:
    • Project: select project
  • Tab “Debugger”:
    • GDB Command: msp430-gdb
    • Set “Use remote target”
    • JTAG Device: Generic TCP/IP
    • Host name or IP address: localhost
    • Port number: 2000
  • Tab “Startup”:
    • Reset and Delay: 3
    • Set: “Halt”
    • Initialization Commands: “monitor erase”
    • Set: “Load image”
    • Set: “Use project binary”
    • Set: “Load symbols”
    • Set: “Use project binary”
  • Tab “Common”:
    • Save as: “Shared file” (select project)
    • Display in favorite menu: “Debug”
  • Press “Apply”

Running the debugger from the IDE is the equivalent to running “msp430-gdb” at the command-line. It first requires that “mspdebug” runs to bridge to the EZ430-F2013 development kit. This can be perform from a terminal or from an Eclipse run configuration (next section).

To run the debugger, select from the menu “Run” > “Debug Configurations…”, choose the debugger create and press the button “Debug”.

Run MSPDEBUG from Eclipse

It is possible to run “mspdebug” from Eclipse using a run configuration. Here are the steps to set it up:

  • Select “Run” > “External Tools” > “External Tools Configurations…”
  • Right-click on “Program” and select “New”
  • Enter name: MSPDebug
  • Select “Main” tab:
    • Location: /usr/bin/mspdebug
    • Arguments: uif -d /dev/ttyUSB0 gdb

Once set up as an external tool, to run “mspdebug”, select “Run” > “External Tools” > “External Tools Configurations…”, click on the program called “MSPDebug” and press the “Run” button.


There are many short-cuts in Eclipse to run external tools and debug configurations without using the tedious menus. One of these short-cuts are located on the main tool bar. These short-cuts makes it very convenient to start “mspdebug” and “msp430-gdb”. The ability of developing and debugging using the EZ430-F2013 directly from Eclipse greatly reduces the development cycle of an image targeted for the MSP430.

Use EZ430-F2013 in Ubuntu

This note explains how to install the command-line tools in Ubuntu to compile, load and run images destined for the Texas Instrument EZ430-F2013.

The TI EZ430-F2013 is a USB development environment for small dongles that host a TI MSP430 micro-controller (MSP430-F2012 and MSP430-F2013).

This note relates to:

Install Packages

The packages required to work with the MSP430 are available from the main repositories.

Verify Drivers for EZ430-F2013

Insert the EZ430-F2013 in a USB port. Then, run “dmesg” to verify that it was detected correctly:

The output should end with a set of lines that looks as follows:

The report from “dmesg” shows that the development kit was mounted to /dev/ttyUSB0. For the remainder of the note, this value is assumed. However, you might need to adjust this value to fit your particular installation.

Writing a program for MSP430-F2013

Create a new source file.

Paste the following code:

The code above drives the LED found on the MSP430-F2013 to emit “SOS” in Morse code. A number of definitions are already declared in the file “msp430f2013.h”. Many header files relating to the MSP430 can be found in the directory /usr/msp430/include.

Compiling and Linking Program

Compiling and linking programs/images for the MSP430 is done by using “msp430-gcc”, which is a version of “gcc” that targets the MSP430 micro-controller. Most options available for “gcc” are also available for “msp430-gcc”.

Compiling using “msp430-gcc” yields object files, as with “gcc”. However, invoking the linker produces *.elf files, which can be loaded on the MSP430-F2013 via the development kit (EZ430-F2013).

Following the example started above, the two lines required to produce an object file from the source code, and then link into an image:


A command line utility called “mspdebug” is used to perform most operations that involves the EZ430-F2013 development kit.

First, insert the EZ430-F2013 in a USB port and verify that it is mounted to /dev/ttyUSB0 (see steps above).

When invoking “mspdebug”, one must specify the device that the EZ430-F2013 is mounted as.

This command opens a shell where a number of commands can be sent to the development kit. To leave the shell, press CTRL-D.

Loading Image on MSP430-F2013

Loading an image on an instance of MSP430-F2013 via the development kit is accomplished by using “mspdebug”:


  • <device> refers to the device file name where the USB development kit is mounted
  • <elf-file> refers to the ELF file produce by the msp430-gcc linker

Following the example above:

Debugging MSP430

Via the EZ430-F2013, one can debug the program loaded in the MSP430, including single-step execution, via the “gdb” debugger provided by the MSP430 packages. The command-line utility “msp430-gdb” is similar to “gdb” but designed for the MSP430 micro-controller. However, “mspdebug” is needed to bridge “msp430-gdb” to the MSP430 via the EZ430-F2013 development kit.

The command “gdb” within the shell provided by “mspdebug” start a server that listens to commands from “msp430-gdb” and forwards them to the EZ430-F2013 development kit. When “msp430-gdb” connects to “mspdebug”, it provides a shell similar to the one provided by “gdb”.

The command required to start the server is:

In a different terminal, attach the debugger with the following command:

The commands available in “gdb” are also available in “msp430-gdb”:

  • To execute program: continue
  • To stop program: CTRL-C
  • To list stack variables: info locals
  • To list global variables: info variables

To continue the example started above:

Debug using X Debugger: ddd

If X is available, one can use “ddd”, which is a GUI application to simplify the use of gdb.

To use “msp430-gdb” via “ddd”, one must first start “mspdebug” and then invoke “ddd” by specifying “msp430-gdb”. To continue the example in this note:


Using the TI EZ430-F2013 development kit with an Ubuntu platform is a snap since all the tools required are readily available in the main repositories. Furthermore, anyone familiar with gcc and gdb can easily transition to the line of tools designed for the MSP430 since the commands and options are almost the same.

Fix magic for MP4 MSNV in Ubuntu 12.04

In Ubuntu, as in other flavours of Linux, utilities like “file” detect the type of files by using an algorithm based on “magic numbers”. This algorithm looks for fixed fields in the examined file. Lately, some of these utilities have failed in detecting the proper type for some encountered MP-4 files which do not contain the “magic numbers” expected of a MP-4 file.

This note presents a method to update the magic files to detect new file formats. More specifically, the method concentrates on updating the magic files to recognize the new MP-4 format.

This note relates to:

  • Ubuntu 10.04
  • Ubuntu 12.04
  • MP-4 format, major brand MSNV


This note uses a number of examples to illustrate the fix. In these examples, two files are used, a MP-4 file recognized by the file utility named “known.mp4”; and, a MP-4 file not recognized by the utility named “unrecognized.mp4”.

Exploring the problem

For the recognized file, the following sequence is experienced:

As seen above, the format of the file is recognized correctly and the mime-type is return appropriately. Here is the sequence for the file which is not recognized correctly.

In the case of the file which is not recognized, a generic mime-type is returned.

Differences between files

Programs from the FFMPEG or libav projects can be used to find out details of video files. Using avprobe (or ffprobe), it is possible to get details from each file and examined the differences.

By looking at these reports, it becomes evident that although both files are reported as MP-4, they are not reporting the same major brand.

Detailed Differences

The “od” utility can be used to look at the byte information from each files. This information is necessary to craft the magic file needed to recognized the new format.

A different file header is observed from the file that is not recognized:

In the case of the recognized file, the bytes detected are from offset 4 to 11, where “ftypisom” is recognized as belonging to a file of type MP-4. The same bytes in the file not recognized are “ftypMSNV”. The crafting of the magic numbers to recognize this new file type must be based on this latter string.

Updating Magic Numbers

This note does not explain the format of the magic number files. This topic is covered in other pages. See the references above.

In Ubuntu, updating the file /etc/magic with the proper entries is all that is required for the file utility to detect the new types. There is no need to compile the file, as in other versions of Linux. Nor is there a need to perform any reboot.

To edit the magic number file:

The following lines should be added to the magic file:

After the magic number file is update, save and close.


To test that your changes are working, perform a “file” command on the previously not recognized video file:

If the results above are not observed, then something has gone wrong.


The same problem was encountered on Ubuntu 10.04 and the fix introduced above corrected the problem. I suspect that all intervening versions of Ubuntu between 10.04 and 12.04 suffer the same problem and that the same fix applies.

Fix speakers and headphones playing simultaneously after upgrading to Ubuntu 12.04

After upgrading to Ubuntu 12.04 (Precise Pangolin) on a Dell Inspiron 1720, the speakers continued playing even after plugging in a set of headphones. This problem has been reported and fixed in multiple forums. However, the fix requires a model number, which can not be easily guessed. Therefore, this post is meant to help those who have a machine similar to the Dell Inspiron 1720.


This note applies to:

  • Ubuntu 12.04
  • Dell Inspiron 1720

The fix is applied by using the following steps:

  • Edit /etc/modprobe.d/alsa-base.conf and modify the appropriate line
  • Reboot computer

Edit alsa-base.conf

Initially, the file contained the following line:

This line must be commented out (in case you want it back) and replaced as follows:

After saving the file, rebooting the computer is all that is required.

DD-WRT Router with Multiple Public IP Addresses

This note explains how to add new public IP addresses, in excess of the first static IP address, to the WAN interface of a DD-WRT router. All public addresses are assigned to computers that reside within the LAN network served by the router. Therefore, network address translation (NAT) is performed between the public addresses and the addresses assigned internally. This notes is written after it was successfully performed on:

  • ASUS RT-N16 Wireless Router
  • DD-WRT v24-sp2 (08/07/10) mega (SVN revision 14896)
  • ISP: TekSavvy


When enquiring to receive a new static IP address from my ISP, I found out that a subnet could be leased for a monthly fee. I selected a subnet containing two IP addresses which was assigned to my internet service. The new addresses were communicated using a slash notation: XXX.XXX.XXX.XXX/30.

Although a /30 subnet might suggest that four distinct addresses are available, there are only two. In fact, each subnet contains two addresses that have special meaning: the first, which is the subnet identifier; and, the last, which is the subnet broadcast address. Therefore, the first address available for assignment in a subnet is the one after the subnet identifier. For example, if the assigned subnet was, then the subnet identifier would be, the broadcast address would be and the available addresses would be and

For simplicity in the following examples, we will assume that the assigned subnet is Also, it will be assumed that the public address is assigned to a computer that is manually set with the LAN address


The solution is two-fold. First, assign one of the new public IP addresses to the router’s WAN interface. Then, use firewall rules to route packets to and from the desired computer within the LAN.

Although the solution calls for entering commands through the router’s web interface, I suggest you test those commands by entering them at the command line using a telnet or SSH session to your router. Once this works well, transcribing the commands to the web interface is a good way to save those changes in case the router is rebooted.

Assign Public Address

Using a web browser, open the web interface to your router. This is usually done by directing your browser to an address similar to:

Direct your browser by selecting the “Administration” tab, followed by the “Commands” sub-tab.

In the text box titled “Commands” under “Command Shell”, enter the commands to assign the public address to the WAN interface. Use the example below as a template and substitute the addresses according to your situation:

Once this is entered in the text box, save the changes by pressing the button titled “Save Startup”.

Firewall Rules

To assign the firewall rules, the text box mentioned in the previous step is used. However, when saving the content of the firewall rules, the button titled “Save Firewall” is used instead.

In the firewall rules, one command is used to map the public address to the internal address; one command is used to map the internal address to the public address, and; one command is used to accept each port that should be forwarded.

Use the following template and substitute the appropriate addresses and ports:

The above example forwards HTTP (port 80) and SSH (port 22) requests to the internal computer.

Reboot Reouter

For the changes to take effect, the router must be rebooted. Using the router’s web interface, navigate to “Administration” tab and the “Management” sub-tab. Finally, press the button titled “Reboot Router” at the bottom of the page.

Tethering iPhone 5.1 on Ubuntu 11.10

This blog site already features an note on tethering the iPhone to Ubuntu ( However, since upgrading to iOS 5.1, when the iPhone is connected to the Ubuntu platform, an error is reported stating that “Unhandled Error Lockdown”.

This note applies to:

  • Ubuntu 11.10 (Oneiric)
  • iPhone 5.1


The solution offered by this note is to:

  • Install the package repository offered by Paul McEnery
  • Adjust the package repository to be picked up in oneiric
  • Install the necessary packages from the repository
  • Configure

Install Package Repository from Paul McEnery

Adjust Package Repository for use in Oneiric

I applaud the work done by Paul McEnery in providing us the tools to use the iPhone. Unfortunately, the package repository is not available for Ubuntu 11.10. On the other hand, the package repository for Natty (11.04) seems to work just fine for Oneiric. In this step, the package list is modified to point to the Natty version.

While editing the file, replace “oneiric” to “natty” and save again. The resulting file should look something like:

Install Necessary Packages


The first step of configuration is to tether the iPhone to the platform using the USB connector. Then, run the following command:

Finally, unplug and re-connect the iPhone. The error should not be reported. Instead, all services from the iPhone should be available.

Fix jumpy mouse with PlayOnLinux (wine) in Ubuntu

Since upgrading to Ubuntu 11.10, some games that used to run perfectly using PlayOnLinux started to display unwanted behaviour. In particular, the mouse jumps from the expected position in Starcraft: Broodwar. This behaviour prevents efficient playing. Researching the Internet shows that many other games are plagued by the same problem.

This note applies to:

  • Ubuntu 11.10
  • PlayOnLinux 4.0.16
  • Wine 1.3.18

Many solutions are offered on the Internet which did not work on my system. However, the problem appears fixed in a newer version of Wine. The approach offered in this note is to install Wine 1.4. The latest version of Wine is not yet available via the packages offered by Ubuntu. However, the latest version (beta) is available via the WineHQ’s PPA. The following steps adds a new package repository and updates Wine to the latest version available from this repository. As an interesting note, Wine 1.4 is available via the package named wine-1.3.

After those changes, you can verify the version of the currently installed version of Wine with the following command.


Wine and PlayOnLinux are great tools. The complexity of the task performed by those tools is such that one must expected some unstable versions. This note demonstrated how a user can jump into experimental versions of Wine to access solutions earlier than pushed by the standard packages.