Create time lapse video from images: Difference between revisions

From WickyWiki
mNo edit summary
mNo edit summary
Line 29: Line 29:
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
ffmpeg -f concat -safe 0 -i "${sourcedir}/../files.txt" -r 25 -vcodec libx264 -crf 22 "${sourcedir}/../out.mp4"
ffmpeg -f concat -safe 0 -i "${sourcedir}/../files.txt" -r 25 -vcodec libx264 -crf 22 "${sourcedir}/../out.mp4"
</syntaxhighlight>
Speed the video up, the resulting file will be smaller:
<syntaxhighlight lang=bash>
ffmpeg -f concat -safe 0 -i "${sourcedir}/../files.txt" -vf "setpts=(PTS-STARTPTS)*0.4" -r 30 -vcodec libx264 -crf 22 "${sourcedir}/../out_43s.mp4"
</syntaxhighlight>
</syntaxhighlight>

Revision as of 21:50, 20 March 2019


Install ffmpeg:

sudo apt install ffmpeg

Create timelapse indexfile:

Format of the indexfile:

 file '/full/path/to/file1.jpg'
 file '/full/path/to/file2.jpg'
 ...

Create the indexfile:

sourcedir=$HOME/Pictures/timelapse
find "${sourcedir}" -iname "*.jpg" -type f | sort | sed "s/\(.*\)/file '\1'/g"  > "${sourcedir}/../files.txt"

Create the video:

ffmpeg -f concat -safe 0 -i "${sourcedir}/../files.txt" -r 25 -vcodec libx264 -crf 22 "${sourcedir}/../out.mp4"

Speed the video up, the resulting file will be smaller:

ffmpeg -f concat -safe 0 -i "${sourcedir}/../files.txt" -vf "setpts=(PTS-STARTPTS)*0.4" -r 30 -vcodec libx264 -crf 22 "${sourcedir}/../out_43s.mp4"