> ## Content Index
> Fetch the complete content index at: https://www.oransblog.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to create timelapse from VERY large timelapse datasets 10k+ images using command line
- URL: https://www.oransblog.com/timelapse/
- Published: 2021-05-04T04:09:55.000Z
- Updated: 2026-10-29T05:57:08.000Z
- Description: I have a time-lapse with over 20k of images and any program I use crashes or grinds to a halt at the slightest interface click.
- Author: Oran C
- Tags: timelaspe, tutorial, #Import 2026-11-12 01:14

Last update 20210609

I have a time-lapse with over 20k of images and any program I use crashes or grinds to a halt at the slightest interface click.

I've tried using `adobe premier pro` took over 4 mins for every click.

I've tried a custom program I found on line but its super inflexible.

Here I gave in and I'm trying using the dreaded dragon that is 

# `FFMEPG`

![](https://www.oransblog.com/content/images/2021/05/image-3.png)

### [Creating a Time-Lapse Video Through the Command-Line (Using FFmpeg)](https://medium.com/@sekhar.rahul/creating-a-time-lapse-video-on-the-command-line-with-ffmpeg-1a7566caf877?ref=oransblog.com)

```bash
ffmpeg -framerate 30 -pattern_type glob -i "folder-with-photos/*.JPG" -s:v 1440x1080 -c:v libx264 -crf 17 -pix_fmt yuv420p my-timelapse.mp4

```

#### my version

```bash
ffmpeg -framerate 30 -pattern_type glob -i "*.jpg" -s:v 640x480 -c:v libx264 -crf 17 -pix_fmt yuv420p timelapse_20210503.mp4
```

quote from article: on what the different tags actually do. They only one that matters is 

`-s:v 1440x1080` my version is `-s:v 1440x1080`

```bash
framerate: the number of images to render per second in the video
pattern_type: we set this to glob to tell ffmpeg to use all the images that match the pattern in the following parameter.

i: a pattern that matches all the input photos in your timelapse. Note that this, as with most other things on a UNIX command line, is case sensitive.

s:v: The size of the output video. Ensure that the aspect ratio matches your photos to avoid skewing the images (we’ll talk about cropping later).

c:v: The output video codec (here, H264). More on this later.

crf: A parameter specific to the H264 codec that determines the quality/compression. More on this later.

pix_fmt: this needs to be set to yuv420p to allow many players, such as Quicktime to play the video (the FFmpeg docs say *dumb* players, I’ll be more forgiving). More on this later.
```

#### 

![](https://www.oransblog.com/content/images/2021/05/image-2.png)

![](https://www.oransblog.com/content/images/2021/05/image-1.png)

# this took like 10 seconds! the other ones took over 30 mins!

# Bonus! I now schedule this to run every night so i dont have to do this manually!

### Note: im running raspberry pi with some non-rasbian stuff but commands should work just as well for your systems

### They normal way crontab! its anoying because i have to adjust a weird config file that i forget where it is.. blah blah complain. so here where a standard linux command comes in

# `watch` !

`watch is used to run any designated command at regular intervals.`

its go its own web page!

[How to use the watch command, by The Linux Information Project (LINFO)](http://www.linfo.org/watch.html?ref=oransblog.com)

#### So the command 

`watch -n 86400 <ffmpeg here>`

```sh
watch -n <your time> <your command/script>
```

source: https://stackoverflow.com/a/34753926 

What is this magic number?

![](https://www.oransblog.com/content/images/2021/05/image-4.png)

### This means the ffempg will run once every day

update: 20210609

Note: this watch command turned out not to work very well. :(. not totally sure why. 

# the full command

```bash
tmux new -s timelapse
cd ./path/to/timelapse/pictures
ls
watch -n 86400 ffmpeg -framerate 30 -pattern_type glob -i "*.jpg" -s:v 640x480 -c:v libx264 -crf 17 -pix_fmt yuv420p timelapse_v1_`date "+%Y-%m-%d"`.mp4

In my case it was
watch -n 86400 ffmpeg -framerate 30 -pattern_type glob -i "./Camera1/stills/*.jpg" -s:v 640x480 -c:v libx264 -crf 17 -pix_fmt yuv420p ./timelapse_converted/timelapse_v1_`date "+%Y-%m-%d"`.mp4

(ctrl+"b") then "d"
```

![](https://www.oransblog.com/content/images/2021/05/image-5.png)

 This took a while because its running on a raspberry pi 3 

# How to run as a cron job

```bash
dietpi-cron
```

![](https://www.oransblog.com/content/images/2021/06/image-8.png)

change weekly to be a time you want

# modify the `/etc/cron.`weekly`/*` files

[Cron job - DietPi](https://dietpi.com/phpbb/viewtopic.php?t=120&ref=oransblog.com)

```bash
ls /etc/cron.weekly/
nano /etc/cron.weekly/convert_timelaspe.sh

# Copy this into the shell

#------------------------------------
#!/bin/bash

echo "Run convertion command jpg's to mp4"

#Run convertion command jpg's to mp4
echo "Converstion running"

ffmpeg -framerate 30 -pattern_type glob -i "/mnt/downloads/pi-cam/Camera1/stills/*.jpg" -s:v 640x480 -c:v libx264 -crf 17 -pix_fmt yuv420p /mnt/downloads/pi-cam//timelapse_converted/timelapse_v1_`date "+%Y-%m-%d"`.mp4 -y  || exit 0
echo "Converstion complete"

#------------------------------------
chmod +x /etc/cron.weekly/convert_timelaspe.sh
chmod 777 /etc/cron.weekly/convert_timelaspe.sh
ls -hal /etc/cron.weekly/convert_timelaspe.sh
./etc/cron.weekly/convert_timelaspe.sh

CTRL + c to close early
```

![](https://www.oransblog.com/content/images/2021/06/image-9.png)

To test the command

```bash
 ./etc/cron.weekly/convert_timelaspe.sh
```

Awesome it worked!

![](https://www.oransblog.com/content/images/2021/06/image-10.png)

# how to see logs for cron in dietpi

```bash
journalctl | grep cron
```

![](https://www.oransblog.com/content/images/2021/06/image-11.png)

try viewing live the logs

`tail -l | journalctl | grep cron`

![](https://www.oransblog.com/content/images/2021/06/image-12.png)

```
ls /etc/cron*
```

Notes: tis is all done for weekily cron's to test i used `./etc/cron.daily/convert_timelaspe.sh` instaead of   
`/etc/cron.weekly/convert_timelaspe.sh`

I dont feel like waiting around for 1 week to test stuff :).

### Bonus: 

#### How to watch the size of the output movie change to see if its done

```
watch ls -la /mnt/downloads/pi-cam/timelapse_converted/

or if you like normal kbs
watch ls -lah /mnt/downloads/pi-cam/timelapse_converted/

```

---

#### How to count number of file in a directory 

(my case to check how many photos are in my timelapse) a normal ls takes a few mins to complete!

```
ls /mnt/downloads/pi-cam/Camera1/stills/ | wc -l
```

![](https://www.oransblog.com/content/images/2021/06/image-13.png)

### WOW 32.4k photos!

---

### How to switch and see running tmux sessions

```
QUICK SETUP
>tmux new -s <NAMEHERE>

#Navigate windows
#next | prev
ctrl+b n
ctrl+b p

show bacground sessions
>tmux list-sessions

enter detached session
>tmux attach -t <NAMEHERE>

tmux attach -t timelapse
ctrl+b d
```

# Author:

```bash
by oran collins
github.com/wisehackermonkey
oranbusiness (symbol that rymes with ate) gmail.com
20210609

```