Skip to content

Instantly share code, notes, and snippets.

@npcardoso
Last active July 8, 2016 10:39
Show Gist options
  • Save npcardoso/2c2a41c3ed3dfa1e6a863fed250bd3ca to your computer and use it in GitHub Desktop.
Save npcardoso/2c2a41c3ed3dfa1e6a863fed250bd3ca to your computer and use it in GitHub Desktop.

Timelapse

Rename files

To rename the images so the name corresponds to its capture date, invoke the following command. This step is useful for both guaranteeing that the final movie is in the correct order and that duplicate images are removed.

exiftool '-filename<CreateDate' -d "%Y:%m:%d %H:%M:%S.%%le" -r .

Create file list

command ls -1tr *jpg | sort >| gopro.txt

Generate timelapse

The following script generates a timelapse using mencoder.

#!/bin/bash
if [[ $# != 2 ]]; then
    echo "Usage $0 <files.txt> <fps>" 2>&1
    exit 1
fi

FILES=$1
FPS=$2

mencoder -nosound -ovc lavc -lavcopts \
    vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 \
    -vf scale=1920:1080 -mf type=jpeg:fps=$FPS \
    mf://@$FILES -o gopro.mp4

To create the timelapse, invoke the script above as follows:

./timelapse gopro.txt 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment