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

# Timelapse   your holidays (Windows\Linux)
- URL: https://whatimade.today/timelapse-your-holidays/
- Published: 2015-12-18T16:35:40.000Z
- Updated: 2016-12-14T20:45:13.000Z
- Author: notamacuser
- Tags: Windows, Linux, ffmpeg, opencv, python, E-hanukkia, jewish, holidays, video, camera, timelapse, github, Hanukkah, hanukka, Hanukkia, Hanukkah Menorah, #Import 2026-11-07 09:43

Today I found in my *[github](https://github.com/dannyvai/?ref=whatimade.today)* a super simple python script for **timelapse videos** that I wrote a year ago.

It uses *opencv* to capture images from the camera and *ffmpeg* to create the video after taking all the pictures

It was created in Hanukkah you can read about it, if you like to know more : [Hanukkah (wikipedia)](https://en.wikipedia.org/wiki/Hanukkah?ref=whatimade.today)  
*(TL;DR : It's a Jewish holiday where you light candles each day for 8 days, one candle is always lit and another eight being lit gradually every passing day of the holiday)*

I just wanted to do a timelapse of the candles going off in the last day where the hanukkiah was full, so instead of downloading a free app to my phone I wanted to make my own thing so I've spent 20 minutes and wrote this script

> This entry was changed and added **windows** configuration manual to make it run on windows also, Also the code is more mature and better documented, plus i've added some more timelapse videos and will add more in the future

## Sample videos

Here are some timelapses that i've created before we dive deeper into the technicals

This was my first timelapse video using the pylapse :)

Here is the second one.. from this year

New video form Dec 15'

As a bouns here is another timelapse I did in vegas from the flamingo hotel

## The code

The script is super simple so I think there is no need to go over it..  
If someone will ask me to I'll add an explanation  
Here is the code:  
[https://github.com/dannyvai/pylapse/](https://github.com/dannyvai/pylapse/?ref=whatimade.today)  
The only file that matters is :  
[https://github.com/dannyvai/pylapse/blob/master/pylapse.py](https://github.com/dannyvai/pylapse/blob/master/pylapse.py?ref=whatimade.today)

How to run the script after downloading the code:  
to start a timelapse :  
`python pylapse.py -t True -f fps -e event-duration -v video-duration -w width -l height -c cam_idx`  
Not all the params are needed most of them have default values

> **fps** \- frames per second of the video output

> **video\_ duration** \- the length of the video we take (seconds)

> **event\_duration** \- the amount of time we want to timelapse (seconds)

> **cam\_idx** \- usually it's 0 but if you have more than 1 camera it can be 0/1/2.. depends on which camera id you want

> **height** \- the height of the picture in pixels (480,720,1080...) make sure the camera supports it

> **width** \- the width of the picture in pixels (640,1080,1920...) make sure the came supports it

So for instance we want a 30 second video of a sunset and the video will be 30fps with the resolution of 640x480.

Sunset takes about 15 minutes (which is 900 seconds) from start to finish I think so:  
`python pylapse.py -t True -f 30 -v 30 -e 900 -c 0 -l 480 -w 640`

There is another mode that you can preview the camera before starting the timelapse

It was useful to me when I used to do timelapse of sunsets and I needed to attach the camera to the window but I didn't know if I positioned the camera like I wanted.  
You can use it like this :  
`python pylapse.py -p True -l -c cam_idx height -w width`

For instance we would use it like this :  
`python pylapse.py -p True -c 0 -l 480 -w 640`

For now the code works on a linux environment with ffmpeg and python-opencv packages installed.  
**Just to clarify : The code does work on windows**  
But the script that takes all the pictures and turn them to a movie won't work

A bit about the ffmpeg command that creates the video from pictures  
This is how the script looks like:

`ffmpeg.exe -framerate <fps> -i <img_format_string> -c:v libx264 -r 20 -pix_fmt yuv420p out.mp4`

> fps - is the fps of the movie you wanted

> img\_ format\_string - it looks like `%0Xd.png` where X is the length of the number of the images the script creates

so for example if the script saved the images by this format:

> 00001.png

the length of the number is 5 (four zeros and the digit 1) so the img\_ format\_string would be `%05d.png`  
(which says basically that all the pictures that ends with a png extension and the number scheme is a five digit number leading by zeros so to represent the number 314 it will look like this : 00314.png)

**To install ffmpeg on linux or windows use this link:**

- [https://www.ffmpeg.org/download.html](https://www.ffmpeg.org/download.html?ref=whatimade.today)

**To install python-opencv**

- [For windows and fedora users](https://opencv-python-tutroals.readthedocs.org/en/latest/py%5Ftutorials/py%5Fsetup/py%5Ftable%5Fof%5Fcontents%5Fsetup/py%5Ftable%5Fof%5Fcontents%5Fsetup.html?ref=whatimade.today#py-table-of-content-setup)
- For Debian and Ubuntu users:
- `sudo apt-get install python-opencv`
- It should install everything needed

# The configuration to make it work on windows

in order to make it work on windows we need to download ffmpeg for windows from [official site](https://www.ffmpeg.org/download.html?ref=whatimade.today#build-windows)

After downloading the file we should extract it  
![downloaded ffmpeg from the site](https://whatimade.today/content/images/2015/12/extract_ffmpeg.png)

After extracting the folder we will rename it to ffmpeg to make it more accessible later.

After this we should go the ffmpeg folder we have extracted and get into the bin dir  
![inside the ffmpeg folder after extracting](https://whatimade.today/content/images/2015/12/ffmpeg_bin_folder.png)

After that we make sure that the ffmpeg executable exists  
![see this amazing file?](https://whatimade.today/content/images/2015/12/ffmpeg_exe.png)

So now that we downloaded ffmpeg and we made sure that it really has the ffmpeg executable,we are going to add this folder to the path environment variable  
That way you could just open the cmd.exe and use the ffmpeg from anywhere that way our python script will work on windows as well!

Here is an illustration of running ffmpeg from the cmd without being in the ffmpeg folder  
![illustration  of using ffmpeg anywhere](https://whatimade.today/content/images/2015/12/using_ffmpeg_from_anywhere.png)

So we need to go to my computer and right click on it  
Then go to properties  
![properties on my computer](https://whatimade.today/content/images/2015/12/my_computer_properties.png)

After that we need to go to advance system settings from the left corner of the window that just opened  
![advance system settings](https://whatimade.today/content/images/2015/12/my_computer_properties_advance_system.png)

Then we need to go to the environment variables window by clicking the environment variables button:  
![behold of this amazing button!](https://whatimade.today/content/images/2015/12/environment_variables.png)

Then we need to add the ffmpeg binaries folder to the **Path** environment variable:  
![finding the path environment variable](https://whatimade.today/content/images/2015/12/environment_variables_path.png)

my ffmpeg binaries folder was in D:\\ffmpeg\\bin\\

![editing the path variable](https://whatimade.today/content/images/2015/12/edit_path_environment_variable.png)

And that's it :)  
After opening a new cmd window that can run python scripts we can run the pylapse.py script

![here we run the pylapse on windows](https://whatimade.today/content/images/2015/12/running_windows8.png)

Hope you learned something or at least it will help you in any way...  
I'll be back with more features and fixes for windows and linux users  
So come back :)

*Related Project by *[Amir Avni](https://whatimade.today/author/amiravni/)* where he made an *[E-hanukkia](https://whatimade.today/the-e-hanukkia/)**