Create time lapse video from images: Difference between revisions
From WickyWiki
mNo edit summary |
mNo edit summary |
||
| Line 11: | Line 11: | ||
Create timelapse indexfile: | Create timelapse indexfile: | ||
<syntaxhighlight lang=bash> | <syntaxhighlight lang=bash> | ||
| Line 36: | Line 28: | ||
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" | 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> | ||
= Options = | |||
Input indexfile 'files.txt': | |||
-f concat -safe 0 -i "files.txt" | |||
These options allow for this indexfile format: | |||
file '/full/path/to/file1.jpg' | |||
file '/full/path/to/file2.jpg' | |||
... | |||
Video filter. Speedup video by (1 / 0.4): | |||
-vf "setpts=(PTS-STARTPTS)*0.4" | |||
Output framerate: | |||
-r 30 | |||
Output codec and quality setting 'Constant Rate Factor'. For x264, this means setting a value somewhere between 18 and 26 for this CRF. The default is 23, and higher values will give you worse quality. | |||
-vcodec libx264 -crf 22 | |||
Sources: | |||
* https://superuser.com/questions/431953/convert-old-videos-to-have-smaller-sizes | |||
* https://davidwalsh.name/video-speed | |||
* https://stackoverflow.com/questions/10366138/how-to-specify-unordered-image-list | |||
Revision as of 22:30, 20 March 2019
Install ffmpeg:
sudo apt install ffmpeg
Create timelapse 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 (x 1/0.4), 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"
Options
Input indexfile 'files.txt':
-f concat -safe 0 -i "files.txt"
These options allow for this indexfile format:
file '/full/path/to/file1.jpg'
file '/full/path/to/file2.jpg'
...
Video filter. Speedup video by (1 / 0.4):
-vf "setpts=(PTS-STARTPTS)*0.4"
Output framerate:
-r 30
Output codec and quality setting 'Constant Rate Factor'. For x264, this means setting a value somewhere between 18 and 26 for this CRF. The default is 23, and higher values will give you worse quality.
-vcodec libx264 -crf 22
Sources: