First Time Linux

Video creation

Video creation, editing and transcoding is a huge topic in itself and far too much for this webpage. Instead, this page will address how to create your own videos from scratch, using free tools. We'll discuss making time-lapse videos from still photos, and making tutorials or screencasts from recordings of your computer screen. In particular we'll look at how to make a video which can be uploaded to the web, for example to sharing sites like youtube.

We'll also look at making nice slideshows from photos together with background music, and preparing a DVD to show the output on a regular DVD player.

Video from stills

I wanted to create a time-lapse video a while ago, so I took a load of regular photos of the subject (in this case, a building site in progress), and looked for a way to convert them into a speeded-up movie. I made an effort to at least roughly line the photos up, but still they were not precise, so the first step was to line them up.

For the alignment I used hugin, which is normally used to stitch panoramic photos together but in this case I just wanted to stack the photos on top of each other. So I went through each pair of photos and tried to line up features one by one. Different lighting conditions (shadows) made this tricky, as did of course the changing features of the object, but after a while I had them all lined up in hugin.

The next step was to export them somehow from hugin, and the only option if I wanted all the separate frames was to export as tiff files. So from a directory full of jpegs, I now had a directory full of (aligned) tiff files. But how to turn these into a movie?

The answer in this case was avidemux, but there was another step required - avidemux can't load tiffs, so I needed to convert them all into jpegs again. This is easy with imagemagick and its convert command in a bash for loop. So now I had aligned jpegs. I think I also needed to use the rename command as well to get the filenames acceptable (it's a while ago now).

Lastly, avidemux could open all the jpegs in one go just by selecting the first one, and I could then specify the cropping (to remove the irregular black edges) and the frame rate, in order to finally export the avi file. Then this avi file can be viewed in any player or simply uploaded to youtube.

Tutorial movie

The attempts to make a tutorial movie for the GpsPrune tool took a few iterations to get reasonable results. So here are the attempts, one by one:

Using wink

The first attempt was made using wink, and despite the broken documentation I did manage to get some results out of it, making still grabs with a trigger key and adding notes afterwards. The export format is swf, which isn't as small as I expected it to be, but the restricted options made me look for another option.

Open Office Impress

The second attempt at the tutorial movie attempted to incorporate screengrabs (made with gimp or the gnome screenshot tool) into an OpenOffice Impress presentation, and then add my annotations or directions as I wished. I figured I could add other slide transitions and more options this way, and have more control over the presentation (after all, that's what it's for). The plan was to use the "export to swf" option to produce a flash movie, which could then be uploaded to youtube. Sadly, the export to swf didn't work at all, maybe this is a bug with version 2.4? In any case, it didn't work.

Gimp

The next attempt was using gimp - I could stack the screenshots together with any text or graphics I wanted, and put it all together into an animated gif. This worked fine, although it took far too much effort in the end. The result was good, with clean gif compression rather than messy jpeg compression, and I could tweak the frames to reduce the file size even more (deleting parts of the frame to just leave the bits which had changed). This gif was suitable for uploading to a regular html website, but not for youtube - youtube doesn't accept animated gifs as a supported format.

I tried various paths to convert my animated gif into an avi file or an mpeg file, using imagemagick and ffmpeg, but I couldn't get any satisfactory results out of it. So partial success but too intensive and no youtube support.

Recordmydesktop

The last attempt was to forget about making a tightly-compressed, compact animation and just go for a proper screen recording. For this I used gtk-recordmydesktop, which is just a simple gui wrapper around recordmydesktop. This saves the file as an ogg theora video, which is a large file (it includes all the video, not just occasional snapshots), but with a sensible capture area and reasonable settings it's fine. And the resulting ogv files are suitable for direct upload to youtube.

For the annotations I used a simple html page in a browser alongside the application to be recorded, and used a javascript timer to advance the annotations without having to click them. You can see the results at the youtube channel.

Note that for the demonstration of the 3d stuff, the output wasn't captured properly with the default settings - something to do with 3d acceleration. So for the 3d demo I had to change the settings in gtk-recordmydesktop to "Full shots at every frame" to get the 3d output.

Slideshow DVD

I wanted to make a nice DVD movie which could play in a normal DVD player on the television, making a smooth slideshow from holiday photos. A nice gift, don't you think? The effect I was trying to get is excellently demonstrated by the screensaver called "smoothslidesaver" on linux - smooth pan and zoom effects and fades are really effective. But how to create the same effect on a DVD?

I tried several methods, and came up with some seriously disappointing software (like qdvdauthor, dvdstyler, image2mpeg and so on). The final result I got is ok, but it could be better. But here's how it works:

dvd-slideshow

Firstly, and most obviously, sort out which photos to show and in what order. I took copies of all the photos and made crops and enhancements (eg brightening, gamma) using gimp as necessary. I also used krename to arrange the filenames in the right order, but that's not really necessary. I also made title slides using inkscape and exported those to png.

Next, I wrote little text files as input to dvd-slideshow, listing the filenames, durations, effects (pans/zooms) and transitions (fades, wipes). Then I ran dvd-slideshow for each section of the DVD, checking the previews first without audio and then doing high-quality outputs including multiplexed mp3 files. This gave me several vob files, one per section.

To create the DVD structure, you need not just these vob files but also two main directories, AUDIO_TS and VIDEO_TS, and additional text files with suffixes ifo and buf. I generated these using dvdauthor by making a simple xml configuration file (taken from their examples) listing the vobs.

One way to continue is to build an iso file from this directory structure using mkisofs or genisoimage (with the appropriate options) to build a single iso file, and then you can use any regular DVD-burning application like k3b or brasero to burn the iso as an image. Another way is to just use the wizard in k3b to create a new movie DVD project and add the contents of the VIDEO_TS directory into the project as required. Then burn it directly in one step instead of having to create an iso.

Summary: It works, but it seems to be limited to dvd resolution, and the zoom-pans are wobbly, probably due to some kind of rounding error when resizing images to the nearest pixel rather than fractions of a pixel. Not available for Debian Wheezy but is in the forthcoming Jessie.

Photofilmstrip

One good-looking application with lots of promise (not all of which is realised yet) is photofilmstrip - a small python-based application just for making slideshow videos. Unfortunately it suffers from some lacking features at the moment. You can't specify transitions, or fade-ins or fade-outs, you can't specify non-widescreen output, you can't extend the crop to wider than the image (to show portrait images) and so on. But development is ongoing so no doubt features will be added and refined.

Also you can't specify the same crop for the start and end of a segment, so you get small unintentional shifts unless you crop the photo first with gimp. But the method of specifying the zoom-and-pan effects graphically is perfect, and very easy to use. You just define your crop rectangles at the start and end, without having to bother with coordinates or percentages. Now if only the video output on the zooms wasn't so jerky...

Summary (2015): This program has improved a lot over the last few years, and although it's still surprisingly tricky to define a static picture, it can be done. Zooms are less wobbly now too, thanks to PIL's sub-pixel affine transformations. It still refuses to do borders though, so portrait-format photos are drastically cropped for widescreen videos. Perhaps an ImageMagick preparation step could be used to add borders to all the images in advance before passing to photofilmstrip, to get around this. Unfortunately, because it currently relies on mencoder, photofilmstrip has been removed from Debian Jessie, but changes to make it use gstreamer instead have already been done.

Other options

Some other ways of doing the same thing include imagination, a gui which looks impressive but seems to be limited to DVD format and seems to be no longer maintained, or more general animation / video tools like blender or cinelerra which can also produce slideshow movies. Also, digikam claims to be able to create a slideshow movie but this doesn't work here.

Photosplicer

I managed to get some good results using a python script and imagemagick to produce a bundle of still jpegs (1920 x 1080 @ 30fps), then used avconv (the successor to ffmpeg) to convert these stills into an mp4 file with h264 encoding. The zooms and pans are much smoother than dvd-slideshow, and the resolution and file format are perfect for showing on a modern tv (rather than limited to dvd resolutions). The major disadvantages are that it's a fairly limited script, commandline only with no gui, and it's really quite slow to render.

So should this thing which was just for my use be expanded into a real linux program for release? There would be a lot of things to improve, including at least a gui, as well as a batch processor, different resolutions and frame rates and background colours and other options, most of all multithreading to speed it up and an awful lot of error checking and warning messages and of course multilingual translations. All of which photofilmstrip already has. And because we already know that photofilmstrip has been updated to use gstreamer, it remains by far the most preferable solution.