• 14Mar
    Categories: Linux, Open Source, Photography Comments Off

    I made this video for my other blog, of my street where I live in Bangkok.

    The video was quite a piece of work. I don’t have the hardware to do proper time lapse photography so I actually just took a 15 minute video and then cut it into frames. See I knew I could speed up a video in various programs on linux, such as kdenlive or kino or avidemux, but I knew that most of them would crash when trying to save a file with a massively high framerate, or they’d drop frames and look shitty. So it had to be broken into frames, processed, and then encoded into a video first at a high framerate, and then transcoded to a video with a normal frame rate so that software didn’t freak out.

    I tried a few techniques but I’ll just describe the one that worked for me. Firstly, because I only had 15 minutes of footage and I wanted at least a 2 minute video, I couldn’t speed it up all that much, so it wasn’t going to be one of those super high-motion traffic shots. Instead it looked quite sedate and the cars were in focus and detailed, even when sped up. I didn’t want this, so I looked for a way to blur the frames together. Ideally I would expect a good encoder to do this, like iMovie etc does on the Mac, but I was in Linux land with no such luxuries.

    Instead I found a guy who had written an unusual script to apply an IIR gaussian blur between consecutive frames, to give a sort of blurred motion effect. This helps make time lapse videos without large amounts of footage look a bit smoother. The script is available on github here, but you will have to alter it a bit to suit your filenames and such. Also, the blur factor is at 15 at first. Higher numbers give less blur, lower numbers more. I used 10 for my video. Also it used JPG files and I felt this was ruining the high definition of my video, so I just changed all references to “jpg” to “png” in the script and it used png files instead (though much slower). It also encoded the videos using ffmpeg and I wasn’t happy with the results of this, so I chose to use my own mencoder command which I give below.

    IIR Smoother (relies on ImageMagick)

    mencoder -ovc copy -mf w=640:h=360:fps=202:type=png ‘mf://out*.png’ -o timelapse.avi

    This 2 minute video was about 6.2 gb in size, and my editor (Kdenlive) was just choking on it, so I then ran another mencoder transcode to reduce it to a workable size.

    mencoder timelapse.avi -o finished.avi -ovc lavc -oac mp3lame -lavcopts vbitrate=4800:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=0.07:dark_mask=0.2:scplx_mask=0.1:tcplx_mask=0.1:naq -ofps 30

    Next time I would like to try doing higher definition video and trying some other tricks to reduce the encoding and preparation time, because this job took me a LONG time to achieve, but really only due to the experimentation involved in trying to find the best solution.

    I recommend you click the YouTube logo at the corner of this video and then watch it in full screen at high resolution. Afterwards is some photos I took the same night.

    DSC_7030.JPGDSC_7033.JPGDSC_7038.JPGDSC_7040.JPGDSC_7042.JPGDSC_7043.JPGDSC_7044.JPGDSC_7046.JPGDSC_7054.JPGDSC_7056.JPGDSC_7057.JPGDSC_7044.JPG
  • 03Dec
    Categories: Linux, Open Source Comments Off

    Ok, I know I haven’t posted anything technical in a while, but this is just something I wanted to be able to find again later, so here it is. Now I’ve never been a big fan of moving to 64 bit operating systems (other than Mac OS X which does it with ease). Other than a few rare, rare abilities which I am very unlikely to use, I don’t see the benefit of switching to 64 bit linux when it’s likely to introduce other problems. But other desktop linux users swore to me “No, it’s cool. There’s no problems I swear”. Dubiously, I installed 64 bit Fedora 16 on my Lenovo laptop, only to find on the first day that numerous binary only pieces of software like Skype and Picasa were simply not available in 64 bit versions and to get them to work you would have to install swathes of 32 bit libraries before they would work, muddying your pristine 64 bit system with 32 bit crap. Sigh. Liars. Linux users will tell you anything when it comes to promoting how bloody great their systems are.

    Anyway, Picasa was even more problematic than Skype because it uses WINE to run, so it wasn’t just a case of it needing 32 bit libraries because it installs a bunch of WINE libraries of its own. However with a bit of research I found that the solution was very simple.

    1. Install Picasa’s Repository

    Put this into a file called /etc/yum.repos.d/picasa.repo

    [google]
    name=Google – i386
    baseurl=http://dl.google.com/linux/rpm/testing/i386
    enabled=1
    gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

    2. Install Picasa

    yum install picasa

    3. Install WINE

    yum install wine

    4. Copy the necessary 64 bit wine files over top of Picasa’s crappy 32 bit ones

    cp -f /usr/bin/wine-preloader /opt/google/picasa/3.0/wine/bin/wine-preloader
    cp -f /usr/lib/wine/wininet.dll.so /opt/google/picasa/3.0/wine/lib/wine/wininet.dll.so

    And voila ! Your Picasa should now work perfectly without crashing on startup. Segfaults begone !