Render a video from a series of images

Maintained by the libav group there is a great tool called avconv. Every time I had to convert some video format to another avconv worked for me. This included being able to convert mp4 to (good quality) wmv or creating a video out of a series of images.

Imagine you want to create a timelapse and take a series of pictures to do so. Then you end up with images called something like: Capture_%09d.png. The %09d refers to an integer value with a padding of zeros so that the number will always have 9 digits. This follows the same definition as C printf() function. Creating a video from a series of images is now really easy:

avconv -r 60 -i Capture_%09d.png -s 1280x720 Video_720p.mp4

-r X : framerate of input stream is X fps
-i : define input video; a series of images in this case
-s WxH : set the resolution, can also be 1920x1080 for 1080p

And that is it! The neat thing about avconv is that the default values used for the output format are almost always on point for what you need.

But if you need to adjust something, like bitrate, avconv will always allow you to do that. Down to the rarest parameters!

Oh and about the conversion:

avconv -i video_in.mp4 -qscale 2 -s 1280x720 video_out_720p.wmv

-qscale 2 : ensure high quality. values in [2 5] seem to be fine
-s WxH : scale video (optional)


Simulated Inertial Measurement Unit (IMU)

The topic of my "Diplomarbeit" (comparable to a master thesis) was the design and implementation of a simulation environment that would allow to simulate multiple quadrotors.

It was important to get the behavior of the quadrotors as realistic as possible, since the decision to conduct experiments on real hardware was based on successful simulation results. It was therefore important for the user to be able to rely on the results. Furthermore, the simulation would be used in hardware-in-the-loop scenarios, e.g., real quadrotors avoiding collisions with simulated obstacles. Therefore, realism was a crucial aspect of the simulation environment.

Quadrotors were controlled by defining desired roll and pitch angles, a desired yaw speed, and a desired thrust of the propellers. The thrust vector stayed constant and perpendicular with respect to the quadrotor frame. Tilting the quadrotor frame would result in an acceleration in the direction of tilt. A PID controller actuated the motors in order to move the body frame accordingly. Feedback was provided by an Inertial Measurement Unit (IMU) that measured angular rates and accelerations. From these sensor readings, the orientation can be calculated and used as feedback to the PID controller. Therefore, a correct simulation of the IMU was key to a correct simulation of the flight behavior.

The requirements for a realistic simulation of the IMU were:

  1. Realistic IMU acceleration and angular velocity data that includes noise, biases, scaling, and quantization effects.
  2. Since the IMU is not always in the center of gravity, translations and rotations defined with respect to the quadrotor frame have to be taken into account.

The calculation of the simulated IMU was performed in four steps.

  1. Obtain quadrotor state information from simulation
  2. Calculate IMU acceleration and angular velocity measurements
  3. Perform scaling, add noise and biases
  4. Perform quantization and limit output

For the first step we obtained the acceleration of the quadrotor, (a_{local}), gravity (a_{G,local}), angular velocity (\omega_{local}), and the derivative of the angular velocity (\dot{\omega}_{local}) from the simulation environment.

In a second step the acceleration a_{1} and angular velocity \omega_{1} was calculated, with T^V_I being the translation and R^V_I the rotation from vehicle reference frame V to inertial reference frame of the IMU I.

a_{1}=R^V_I (a_{local} + \omega_{local}\times (\omega_{local}\times T^V_I) + \dot{\omega}_{local} \times T^V_I -a_{G,local})

The angular velocity \omega_{1} was calculated by adjusting the frame of reference of the measurements obtained from simulation.

\omega_{1} =R^V_I (\omega_{local})

For the third step the measurements were scaled, biases introduced, and additive noise applied. Noise was defined using a gaussian distribution \mathcal{N}_{a}(0, \sigma_{a}), \mathcal{N}_{\omega}(0,\sigma_{\omega}) for the acceleration and angular velocity. The scaling s_{a}, s_{\omega}, biases b_{a}, b_{\omega}, and deviations \sigma_{a},\sigma_{\omega} were defined by the user. \circ denotes point-wise multiplication.

a_{2} = ((a_{1}\circ s_{a}) + b_{a}) +\mathcal{N}_{a}

\omega_{2} = ((\omega_{1}\circ s_{\omega}) + b_{\omega}) +\mathcal{N}_{\omega}

The fourth and final step in the calculations was optional and allowed the user to simulate quantization and limit the output values of the sensor. Quantization was implemented by rounding the values to the nearest integer value. Real IMUs have an operating range and exceeding this will result in the sensor providing a maximum (or minimum) value. By defining limits this behavior can be reproduced.



A video that compares the virtual and real quadrotor flight and an analysis of the simulation environment including an in-depth comparison between simulated and real quadrotor flight can be found below.

Johannes Lächele, Antonio Franchi, Heinrich H. Bülthoff, and Paolo Robuffo Giordano (November-2012) SwarmSimX: Real-time Simulation Environment for Multi-robot Systems In: Simulation, Modeling, and Programming for Autonomous Robots, 3rd International Conference on Simulation, Modeling, and Programming for Autonomous Robots (SIMPAR 2012), Springer, Berlin, Germany, 375-387, Series: Lecture Notes in Computer Science ; 7628. Download

ps2pdf converter

converting ps or eps files to pdf always left me with the wrong cropping of the image/page and with a white border that messes up the formatiing. To avoid this I convert the files using the following command:

ps2pdf -dPDFSETTINGS=/prepress-dEPSCrop test.eps

Backup of Google Authenticator data

In case to got a new phone and want to move the Google Authenticator you will need to move the secrets from all the sites you added to the app. Or you are just curious what is actually being stored on your phone 🙂

Since I usually use the QR-code to create a new entry creating a backup is usually quite troublesome for me; I simply have no idea how to recreate the entries. But, its possible to download the apps database using adb. Well, that is if you have a rooted phone.

First you need to enable the adb USB-debugging somewhere in your settings. This depends on your phone, so you will need to look online on how to do it in your case.

After that you can connect using adb:

 :~$adb root

The root is important since otherwise you will not have access to the app-related database files. Next we can copy the authenticator database that includes all the entries of the app.

:~$ adb pull /data/data/
196 KB/s (16384 bytes in 0.081s)

Finally, we are able to open the sqlite3 database and print the info we need. I replace the actual output with some meaningless text, but its clear what the secrets are.

:~$ sqlite3 ./databases
SQLite version 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>select * from accounts;

And that was it. Now you only need to re-add the secrets in the new phones authenticator app and you're done.


Arduino Pro Micro issues

I just spent at least two hours trying to figure out how to get the Arduino Pro Micro running again. I will spare you the details of how I figured out what to do, so here is the solution:

sudo mv /usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service /usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service.disabled

Lets hope it keeps on working 🙂

Reading RC Receiver values (version 2)


in a previous post I briefly showed how to read the sum signal of a receiver that is able to output the signal. Although the code works quite well there are several issues with the code:

  1. calling pulseIn(SignalPin, HIGH) blocks until the corresponding pin is set to HIGH, which is a major waste of time, because no other calculations can be performed in the meantime
  2. I noticed that every now and then the readings start to glitch causing unwanted noise

To cope with the first issue I used  Arduino's external interrupt feature that calls a callback function for every rising edge. In addition I wrapped it in a class and defined it as a library for easy usage.

[update: 2013-07-28][update: 2013-08-02]
Continue reading Reading RC Receiver values (version 2)

Pitot tube

Some time ago I wrote something about getting a cheap GPS receiver, a cheap AHRS, and how to read values from a RC receiver. All those tools can be put together to control an autonomous vehicle of some sorts. If the vehicle is a small ground robot nothing more is needed, except the vehicle itself, of course.I do not own anything that is capable of driving around outdoors, but I do own a small airplane. Continue reading Pitot tube


As a Christmas present I got a very nice tool for my Canon 20D from my parents. Its the "Meike Battery Grip for Canon 20D" and besides holding two batteries or 9 AA batteries, it has a set off really nice additional features. It comes with a build-in clock and a IR receiver so you can take images with a remote control. It is really well built and feels nice when connected to the camera, as if its a natural part of the camera!

Continue reading Timelapse

e-paper display

I recently bought an e-paper display with a 2.7" screen size distributed by Embedded Artists. Since it does not consume any power between updates it is perfect to display status information for any kind of embedded technology. Since I am quite the Arduino fan my plan was to hook it up to one of them and simply use an existing software library to interface it. (Update available)(second Update)

Continue reading e-paper display

Reading RC Receiver values


Using a RC transmitter to be able to control aspects of a circuit controlled by an Arduino is a very nice feature. The first thing that comes to my mind is controlling stepper motors instead of servos, as they are way more precise. An easier example, but cool nonetheless, is mapping the input to a PWM signal for diming LEDs.

Reading the values of the channels of your RC receiver is not as complicated as I first thought.
That is, if you have a receiver that is able to output a PPM sumsignal.
I recently bought a RC set, the mx-10 of the HoTT series from Graupner.
The receiver GR-12 coming along with it is able to provide you with up to 16 channels! However, the mx-10 has 5 channels, so setting it to a higher value makes no sense in this case.

Continue reading Reading RC Receiver values