The making of the Machynlleth Raspberry Jam video

On Saturday I went to Machynlleth for a “Raspberrry Jam”; these are get-togethers for people who like the Raspberry Pi low-cost computer (if you’ve not heard of the Raspberry Pi, then head here. They’re great. The idea of Raspberry Jams is that people who like the Raspberry Pi get together and share ideas about what they’re doing with them, they are a relatively new thing, and they’re great fun. My Pi arrived the day before the event and I forgot to buy a cable to attach it to my telly, so I didn’t have anything to show. So I took my camera, a Canon Powershot cheapo automatic point and shoot digital, and did some interviews with the people at the event. Then I stitched the short clips together into a video which you can watch here:

I think the video captures some of the enthusiasm of the event and shows the kinds of things people are doing, which is great. It was a bit of a pain to put together though so I thought I’d do a blog on how I did that, just in case there are any other linux users out there with Canon Powershots and an interest in making little videos.

WARNING: This post is about to get quite nerdy

It’s been some years since I did any video editing or compositing on linux – I do a lot of video processing for my research, but the cutting clips together stuff has never been my speciality. So first I looked for some software that could do it. I installed Kino, imported the first clip, and tried to trim it (cut a few seconds from the start and end so it made more sense, that kind of thing). The video cutting worked perfectly – but the audio track got completely mangled – jittery sound, out of phase with the video, occasional digital bleepybloopy bits.

So I tried some other software – OpenShot, AviDemux, Kdenlive, and Blender – and they all had the same problem. Right, I think to myself, this has to be a deeper problem with the audio track on these videos….

[Some hours pass in a haze of googling, installing codecs, loading the files into various packages, trying to trim the wobbly bits from the start and end of each clip. I discover a cryptic error message in the output of a couple of command line tools suggesting that it is indeed an audio codec problem, which I include here just in case someone in the future googles for it: Incompatible sample format 'u8' for codec 'libmp3lame', auto-selecting format 's16'.]

Normally I would avoid transcoding1 video at all cost, but I was running out of weekend (and also losing the will to live) so I gave in and decided to re-encode them, hoping that I could find some new encoding that fixed the buggy audio. I took my standard problem solving approach (trial and error) and after a few goes worked out a video conversion that could be imported into OpenShot. The video conversion package I used was avconv, which is a command-line video processing tool (forked from ffmeg) that’s just the bee’s knees, and the command I used was:

avconv -i input.avi -r 24 -same_quant output.avi

What this does is to force the frame rate to 24 frames/second, (-r 24) and to use the same quantization (-same_quant). This results in a video of roundabout the same quality. As it’s a command line, you can then wrap it in a small shell script to batch process all the files as follows – this deals with all of the .AVI files in the current directory, putting new, transcoded videos in a directory called outvids:

mkdir outvids
for i in *.AVI; do avconv -i $i -r 24 -same_quant outvids/$i; done

Once they were all done I realised that it was also possible to do the cutting on the command line, so I did – you need to work out the starting position in the video, and how much of the video you want to keep, then there’s an avconv line to do it. This is the line I used to trim 2.5 seconds from the clip of Trystan, keeping 50 seconds in total of video:

avconv -i MVI_0268.AVI -ss 2.5 -t 50 -same_quant trystan.avi

Basically, ss is start second, and t is the number of seconds you want to keep.

Once I had all the little clips tidied up in this way, I used OpenShot to glue them all together; it was simply a matter of dragging them to the timeline, and moving them around until they told a reasonably coherent story. OpenShot titles are not particularly configurable, but if you go for one of the simple options it looks fine. You can also add ordinary jpeg images to an openshot project, and they can be inserted as titles too.

1Transcoding is the practice of converting a video from one format to another. As video formats all involve lossy compression (some data is thrown away to make the files smaller) and all formats use slightly different compression, each time you convert from one format to another you lose a little bit of quality.

3 Comments


  1. Hello Hannah,
    I enjoyed your video and I am pleased that you chose to include the interview you made of me and the PI-STACK as part of it.

    I am a little surprised that the post ended up in uncategorized in the Raspberry Pi forum. Perhaps you could make another post in another category on the same forum to point to it so more Forum uses will get to see it as the quality is better than most videos that end up being posted! (I didn’t even cringe at my own totally unscripted performance!)


Leave a Reply

Your email address will not be published. Required fields are marked *