I was in the office early this morning and saw the sun rising. I captured some video of it (my phone can do 30 minutes of 720p, though it doesn't look that good). However, the thirty minutes of video is rather boring to watch in real time. So I decided to speed up the video.
Speeding up the video was actually much more difficult that I thought it would
be (and I am somewhat acclimated to the troublesome nature of FFMPEG and
Mencoder). Anyway, in order to perform the speed up I used the FFMPEG filter
select
to only pass every nth frame. The large the n, the faster the
speed up. At the same time I chose to convert to WebM (the phone puts out
H.264+AAC and placed in an MPEG4 container format). This produces a video file
with only every nth frame, but the video just hangs for the time it would
have been displaying the other frames. To fix this, I then passed it through
another program, mencoder
. This program fairly similar to ffmpeg
in
purpose. The mencoder
program has a special option, -speed
, that will speed
up the video stream by a factor you specify. This means that if we use -speed n
then we should get the desired video frame rate. Refer to the man pages and
FFMPEG manual for more insight for what is happening here.
ffmpeg -i VID_20111025_071454.m4v -vf select='not(mod(n\,50))' -an temp.webm mencoder -ovc copy -oac copy -speed 50 temp.webm -o faster.webm
This would have been all it would take, however, since I am using Maverick Meerkat, the version of FFMPEG included doesn't have support for filters. This means that, ugh, you can't use the first command. Not unless you install a newer version. I avoid compiling libraries from source like the plague. Instead I added this PPA to my software sources and updated my software. This actually gave a lot of scary errors and almost tricked me into a dist-upgrade to Natty, (shame on you apt, I wouldn't do that to my worst enemy). But in the end, those commands did work (as evidenced by the videos).
The end result, we have a video where only every 50th frame show up in the output. This resulted in a pretty good effect. I didn't actually point the camera at the sunrise as that would cause problems with the contrast and I couldn't balance the camera on the window sill pointing that direction from my office. So it's not as dramatic as an actual sunrise.
I also captured another 30 minutes later that morning as the clouds forming as the air passed off the flatirons was a pretty cool dynamic effect.
Of course, all of this is kind of stupid (neat, to me, but stupid), as time-lapse is usually done by taking individual frames spaced seconds to minutes (or more) apart. Also, there are several options available on the Android Market. Though I wouldn't install them without researching the application and developers.