2011-03-17

Some Assembly Required

We received the crib we bought from Sears two Saturdays ago, bright and early around 08:00. This week, we finally had the time to assemble it.


Total assembly time: about 01:30:00

We agree with the majority of the reviews on amazon.com: it's easy to assembly. The only difficulty we encountered was not realizing that we were screwing in some of the bolts in slightly crooked. After unscrewing them and trying again, it was fine. The mattress we bought fits perfectly.

Technical details of how I created the video after the break…
I took two videos over two nights with my Canon S90 which records in Quicktime (H.264, yuv420p, 640x480, 30 fps). On my Mac, I have ffmpeg installed via MacPorts. My goal was to combine the two movies together into a fast-forwarded version. The magic keyword was "timelapse". Following this guide, here's what I did:

  1. Extract one frame every 1.33 seconds from the first movie and write it into a series of PNG images. This will result in a speedup by a factor of 40 (0.75 fps = 30 fps / 40):
    $ ffmpeg -i MVI_1912.MOV -r 0.75 -f image2 1%05d.png
  2. Do the same on the second movie, but use a different filename convention to avoid clobbering the first set of frames:
    $ ffmpeg -i MVI_1913.MOV -r 0.75 -f image2 2%05d.png
  3. Get the filename of the last exported frame image from the first set of images (103399) and rename the second set of exported images to follow right after. ffmpeg won't encode a set of images unless the filenames are consecutive. This is a short Perl script:
    use File::Basename;
    foreach $f (@ARGV)
    {
       $base = basename($f, ".png");
       rename "${base}.png", ($base-19+103400) . ".png";
    }
  4. Now we have a timelapse of the entire movie in a set of PNG images. At this point, we can use ffmpeg to re-encode this back into a movie at 30 fps. But, I wanted to go back to regular speed just at the end, when we do a little high-five. So next, I deleted all the exported PNG frames from the point just as we were about to high-five. I then determined at what point in time in the second movie that we started to high-five (00:18:06) and extracted the frames at 30 fps:
    $ ffmpeg -i MVI_1913.MOV -ss 00:18:06 -r 30 -f image2 3%05d.png
  5. I then did a similar renaming of these images so they would also be consecutive.
  6. Now, we encode all the frames back into a movie at 30fps:
    $ ffmpeg -i 1%05d.png -sameq -r 30 output.mp4
  7. Next, I uploaded the resulting file to YouTube. To get the soundtrack, I used the AudioSwap feature and found a ragtime song that was approximately the length of our movie.
  8. Done!

2 comments:

  1. Pretty cool. It only took you 2 minutes to build a crib.

    Great site. I'm not even having a baby but I'm going to go out and buy a crib now.

    ReplyDelete
  2. Who knew a pregnant woman could move that fast???

    I am still smiling over here...

    ReplyDelete