How to make a time-lapse movie from lots of very boring video?
November 18, 2014 11:32 AM   Subscribe

I'd like to make a time-lapse video from a bunch of very boring normal-speed video files produced by a cheap dash cam. What's the easiest way to do this?

The camera is a G1WC, a cheap Chinese-made dashcam which writes to MicroSD cards. I have a 32GB card, which holds about 5.5 hours of 1080p video. The video is saved as 3-minute MOV files (H.264) with sequential file names, each clip overlapping the preceding one slightly.

I'd like to make a time-lapse movie at a rate of, say, one timelapse frame every 1 realtime second (30x speedup). An occasional duplicated frame due to the overlap in the video file segments is OK. Don't care about audio.

This seems like it ought to be fairly straightforward to do with some commandline tools or scripts, and I've seen video projects that look like they've been created this way, but I haven't found any instructions and it seems like somebody must have done this before.

MacOS, Linux, and Windows solutions are all acceptable. Using thousands of dollars of commercial software is probably not, though I do have an old copy of Final Cut around somewhere (which, knowing Apple, probably won't work anymore though). Scripted or programmatic solutions using free tools are ideal.

(For the record I am not looking to do a time-lapse via another method, e.g. a DSLR with an intervalometer. I know I could do a time-lapse that way, but it wouldn't really do what I want it to do, which is use the HD dashcam I already have and the data it's already capturing to produce the occasional road-trip video.)
posted by Kadin2048 to Media & Arts (9 answers total) 4 users marked this as a favorite
 
iMovie comes bundled with the Mac OS and will do this.

There are PC applications that do the same thing.
 
posted by Herodios at 12:09 PM on November 18, 2014


Windows Movie Maker is basically the same deal as iMovie, but much more limited in scope. here's a video of doing exactly what you asked.
posted by xingcat at 12:37 PM on November 18, 2014


You should be able to do this with ffmpeg on the command line.

ffmpeg -i input.mov -filter:v "setpts=(1/30)*PTS" output.mov

Note: haven't tested it, found by googling "ffmpeg time lapse from movie".
posted by destructive cactus at 1:47 PM on November 18, 2014


I find the GoPro Studio app easier to use than iMovie for a lot of purposes, and it has this functionality baked in. The GoPro app is free.

However, your cheap dashcam .MOV files may or may not be recognized by the app depending on how they're encoded. You may need to convert them first.
posted by Invisible Green Time-Lapse Peloton at 2:41 PM on November 18, 2014


Try the search term "hyperlapse," which combines time-lapse with image stabilization.
posted by Sunburnt at 2:55 PM on November 18, 2014


That is indeed exactly what Microsoft's Hyperlapse is intended to do. This is distinct from Instagram's iPhone-only app named hyperlapse which uses the accelerometer data to do the stabilization. Unfortunately neither flavor of hyperlapse will help here since the MSFT version hasn't been commercialized yet as far as I know, and the Instagram version doesn't work on prerecorded material.

FFMPEG command line tool is probably the way to go here, as you may be able to batch the job to run on each file, you'll probably have to manually stitch the outputs together in final cut or another editor though.
posted by TwoWordReview at 3:49 PM on November 18, 2014


ffmpeg also has a 'concat' function that should work for joining the files.
posted by destructive cactus at 1:32 PM on November 19, 2014 [1 favorite]


Just an update ... thanks everyone for the suggestions. At the moment I am playing around trying to get a scripted solution using ffmpeg working. This is annoyingly complicated by the fact that most Linux distributions seem to ship with ancient versions of it by default.

But concatenating the short files, then filtering the output using the setpts option, seems to be the way to go. The only thing that I find a little inelegant about it is that you temporarily need twice as much disk space as the original files consume, or at least I have so far found no way to avoid this.

iMovie was a good thought that I really hadn't considered, and it's my #2 solution. However for the record, iMovie is no longer free—Apple now nicks you $15 for it.
posted by Kadin2048 at 1:47 PM on December 8, 2014 [1 favorite]


So just for posterity, here's the solution that seems to work the best, using the output from my particular camera (a G1W-C, sort of a generic $50 Chinese 1080p dashcam that outputs x264 encoded ".mov" files). This is a combination of suggestions given above.

ffmpeg seems to have issues with taking large numbers of files as input directly on the commandline, so the trick is to create a text file listing the files you want to merge, and then use that as input.

So to make a 20x timelapse from a whole directory of .mov files:
for f in *.mov; do echo "file $f" >> files.txt; done
[a file called "files.txt" is created]
ffmpeg -f concat -i files.txt -an -vcodec libx264 -filter:v 'setpts=0.05*PTS' dashcam.mov
[This assumes there are no spaces in the input filenames. If there are, you need more quoting in the for loop. You could also probably shoehorn this into a one-liner if you really wanted to via a subshell, but I don't mind the intermediate file.]

This dumps the audio (the -an option), because I couldn't find a good solution to speed up the audio without making it sound like garbage, and it's not that important anyway for what I want (road trip time lapses).

In a very pleasant surprise, due to the way this camera writes the files (valid timecode?), ffmpeg is actually smart enough to eliminate the duplicate frames that you'd normally get if you just ran the beginning of one recording into the end of another. At least, I think it is, because I don't notice any jerkiness in the output like I was expecting to see.

This is all very camera-dependent, though. The same commands, run against the MKV files produced by a Foscam IP camera, produce very nasty output and a slew of errors, all related to the broken way that the camera writes Matroska output (no valid timestamps). So depending on the type of dashcam you have, you may need to fudge around with some separate commands to preprocess the video. YMMV.
posted by Kadin2048 at 3:57 PM on December 29, 2014


« Older Economical home printer?   |   Please help me find earrings in this style Newer »
This thread is closed to new comments.