Getting the Christmas geek on.

Firstly, I wish all readers a very happy Christmas. Or you can call it Saturnalia if you prefer.
Recently I saw this video, and I was struck by the creativity and level of effort invested by the creator. I could talk in great detail about how stepper motors can be driven at different rates to give different sounds. I could talk talk about how the simplicity of the harmonies of the sinusoidal waves give a pleasing and elegant sound – to my ears at least.
Over-riding all that is the idea that House of the Rising Sun is (for me) a classic song, from the days when musicians actually worked for a living, and wrote good music. Your mileage and musical tastes may vary.
Since I first saw that last week, I had an idea rolling around my head. There is a point in the video where that charming old oscilloscope is showing a sum of two waveforms, and the faster wave seems to be being modulated by a much slower wave. It’s at the 4 minute 20 mark from the start.
For me, this seems to be an ideal source to make an animated GIF.
I downloaded the entire video from youtube, and used the open source video editor PiTiVi to cut out the frames I wanted to re-use.
So I have a short mp4 file, and to convert it to individual frames I used mplayer:
mplayer -vo png oscope.mp4
In this command I specify that the Video Output should be in the PNG format, and to use the “oscope.mp4” file as in the input.
This gives a bunch of PNG files, all of the form “f00000001.png” where the number part increments.
The next step is to convert them to an animated GIF. I’d have liked to have used Peter Hartley’s InterGIF, but I couldn’t find find it in the standard Ubuntu repositories, and I couldn’t get it to compile on my Ubuntu box. That’s a problem for another day (or I can move the GIF files to my RISC OS box and use the RISC OS version of InterGIF).
I used ImageMagick which I installed on my Ubuntu box a long time ago:
convert -delay 3 -loop 0 f*.png OscopeLarge.gif
What this does is to take all the files which begin with “f” and are type PNG, and convert them in to a GIF file with a delay of 3 hundredths of a second between them, and that they should loop forever.
That gives a 13Mb GIF file. It’s very nice, but it’s a bit big for folk who like an ‘old skool’ animated GIF.
Going back to ImageMagick, and using the resize option:
convert -delay 3 -loop 0 -resize 640x360 f*.png OscopeMed.gif
convert -delay 3 -loop 0 -resize 320x180 f*.png OscopeSml.gif
These commands give the Medium and Small versions, which have sensible sizes of 3.5Mb and 997Kb respectively.

I’ve run the animated GIFs through Peter Hartley’s InterGIF. The medium version was reduced from 3.5Mb to 2.7Mb, and the small version was reduced from 997kb to 692kb. That’s about three-quarters in both cases. I’ve substituted the files on the server, as it will ease the load for my provider.


Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: