{"id":14977882,"url":"https://github.com/mrmebailey/pitimelapse","last_synced_at":"2025-10-28T07:30:31.832Z","repository":{"id":44051518,"uuid":"399580933","full_name":"mrmebailey/pitimelapse","owner":"mrmebailey","description":"Shell Script for automating time-lapse video creation from images","archived":false,"fork":false,"pushed_at":"2022-04-28T16:58:44.000Z","size":842,"stargazers_count":4,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T12:44:06.605Z","etag":null,"topics":["ffmpeg","picamera","raspberry-pi","raspberry-pi-camera","time-lapse"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrmebailey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-24T19:24:16.000Z","updated_at":"2022-02-15T16:08:06.000Z","dependencies_parsed_at":"2022-08-26T05:10:21.479Z","dependency_job_id":null,"html_url":"https://github.com/mrmebailey/pitimelapse","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmebailey%2Fpitimelapse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmebailey%2Fpitimelapse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmebailey%2Fpitimelapse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrmebailey%2Fpitimelapse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrmebailey","download_url":"https://codeload.github.com/mrmebailey/pitimelapse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238608280,"owners_count":19500351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","picamera","raspberry-pi","raspberry-pi-camera","time-lapse"],"created_at":"2024-09-24T13:56:29.221Z","updated_at":"2025-10-28T07:30:31.314Z","avatar_url":"https://github.com/mrmebailey.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"[This document is formatted with GitHub-Flavored Markdown.    ]:#\n[For better viewing, including hyperlinks, read it online at  ]:#\n[https://github.com/mrmebailey/pitimelapse/blob/main/README.md]:#\n\n* [Overview](#Overview)\n* [Prerequisites](#prerequisites)\n* [Enable Camera](#enable-camera-module)\n* [Install Apache 2](#install-apache)\n* [Install ImageMagick](#imagemagick)\n* [Install Video software](#ffmpeg)\n* [Install piLapse](#install-pilapse)\n* [VNC Install](#vnc-install-pi-hd-lens-only)\n* [Camera Focus](#camera-focus-pi-hd-lens-only)\n* [First Time Lapse](#first-time-lapse)\n\n# Overview\nShell Script for automating time-lapse video creation from images, hosts on an Apache Web Server for easy viewing.\n\nAnother over a much shorter period in HD which was taken every 10 minutes.\n\n[![SC2 Video](https://img.youtube.com/vi/qcc47tjRBUc/0.jpg)](https://www.youtube.com/embed/qcc47tjRBUc)\n\nHere's an example time-lapse video I recorded of chilli peppers growing over a 7 month period (click to view on YouTube):\n\n[![SC2 Video](https://img.youtube.com/vi/c2NePLQ2OQk/0.jpg)](https://www.youtube.com/embed/c2NePLQ2OQk)\n\n\nThere are other examples in my \u003ca href=\"https://www.youtube.com/channel/UCq2082CCgrotqy21P-IxtTw\"\u003eTimelapses\u003c/a\u003e playlist on YouTube.\n\n\n# Prerequisites\n## Enable Camera Module\nFirst, make sure the camera interface is enabled, if you don't, you'll see the message `Camera is not enabled. Try running 'sudo raspi-config'`:\n\n  1. Run `sudo raspi-config`\n  2. Go to 'Interfacing Options'\n  3. Select 'Camera'\n  4. Select 'Yes' for enabling the camera\n  5. Select 'Finish' in the main menu and then 'Yes' to reboot the Pi\n\n## Install Apache\n\nUpdate the package lists first ;\n\n```bash\nsudo apt update\nsudo apt-get install apache2 -y\n```\nAdjust the Apache permissions to allow the pi user to write so the script does not need to run\nas root and remove the default index.html so we see the pictures in the web root.\n\n```bash\nsudo usermod -a -G www-data pi\nsudo chown -R -f www-data:www-data /var/www/html\nsudo chmod g+w /var/www/html\nsudo rm /var/www/html/index.html\n```\n\n## Imagemagick\n\nRequired to add timestamps to the jpg files\n\n```bash\nsudo apt-get install imagemagick\n```\n\nCheck it installed by checking the version\n\n```bash\nconvert --version\n```\n\n\n## ffmpeg\n\nInstall ffmpeg\n\n```bash\nsudo apt install -y ffmpeg\n```\n\nCheck it installed by checking the version\n\n```bash\nffmpeg -version\n```\n\n# Install piLapse\n\nInstall Pi-Lapse as Pi\n\n```bash\ncd ${HOME}\ncurl -LJO https://raw.githubusercontent.com/mrmebailey/pitimelapse/v1.1/timeLapse.sh\nchmod 755 ./timeLapse.sh\n```\n\nCheck it downloaded fine ;\n\n```bash\n./timeLapse.sh\n```\nYou should see the output \n\n```bash\nThis script will create a folder in the HTML Root with the project name and is intended to run from cron.\n\nUsage: ./timeLapse.sh [Project-Name] [WIDTH] [HEIGHT] [QUALITY]\n\nExample below...\n\n./timeLapse.sh my_first_lapse 1024 768 30\n```\n\n# VNC Install Pi HD lens Only\nBecause the Pi runs headless we need to use VNC to logon to the Pi in order to focus the camera as no display is attached.\n```bash\nsudo apt update\nsudo apt install realvnc-vnc-server realvnc-vnc-viewer\n```\nNow we need to enable VNC in raspi-config\n```bash\nsudo raspi-config\n```\nNavigate to Interfacing Options.\n\nScroll down and select VNC › Yes.\n\nThe final configuration item is to allow direct capture mode in VNC Viewer highlighted below, if this is not done then live capture will just hang.\n\n![Alt Image text](/resources/direct_capture.png?raw=true \"Direct Capture\")\n\n# Update Pi HDMI Settings for Live streaming over VNC\nEdit the file /boot/config.txt and uncomment the line below otherwise you may experience the cannot display VNC Desktop error.\n```\n# uncomment if hdmi display is not detected and composite is being output\nhdmi_force_hotplug=1\n```\n\n# Camera Focus Pi HD lens Only\nConnect to the pi by downloading VNC Viewer and execute raspistill in live mode using the \ncommand below.\n\n```bash\nraspistill -t -0\n```\n\n![Alt Image text](/resources/vnc_camera_command.png?raw=true \"Camera Command\")\n\nFocus the camera on your subject in live view, do not forget to lock off the lens screws and to exit this you must use CNTL ^C from the terminal, ensure you do this before moving onto the next steps as only one process can access the camera at any one time.\n\n![Alt Image text](/resources/vnc_focus.png?raw=true \"Camera Command\")\n\n\n# First Time Lapse\nNow we have the script we can start testing, execute this command which will create the first picture and the project directory in the web root for us.\n\n```bash\n./timeLapse.sh my_first_laspe  1024 768 30 \n```\n\nIf there was an issue with the camera or it is not connected properly you will get the error now, check the connections and that you have enabled the camera properly.\nIt is also worth noting that you will need to cancel the live view mode executed above as only one process can access the camera at any one time.  You can do this by hitting CNTL ^C.\n\n```bash\nls -ltr /var/www/html/my_first_laspe/\n```\n\n```bash\ntotal 244\n-rw-r--r-- 1 pi pi 247283 Sep 30 11:12 1.jpg\n```\n\nNow when we run the script the second time it will create picture number 2 and build the videos with the data overlay.\n\n```bash\n./timeLapse.sh my_first_laspe  1024 768 30\nls -ltr /var/www/html/my_first_laspe/\n```\n\nThe output will look like this.\n\n```bash\ntotal 592\n-rw-r--r-- 1 pi pi 247283 Sep 30 11:12 1.jpg\n-rw-r--r-- 1 pi pi 248216 Sep 30 11:12 2.jpg\n-rw-r--r-- 1 pi pi  31630 Sep 30 11:13 timelapse.mp4\n-rw-r--r-- 1 pi pi  33383 Sep 30 11:13 timelapse_banner.mp4\n-rw-r--r-- 1 pi pi  33383 Sep 30 11:13 timelapse_banner_static.mp4\n```\n\nNow visit the pi with a browser and check your pictures and video all work...\n```bash\nhttp://\u003cPI IP ADDRESS\u003e\n```\n\n![Alt Image text](/resources/pi_first_proj.png?raw=true \"Camera Command\")\n\nThe final part is to define the crontab entry, now the settings here will depend on the quality you want which is not currently tuneable but essentially the smoother the timelapse the more pictures you need but depends on how quickly your target lapse environment changes.\n\nSo, for example to catch ice melting that out be each minute in a house as it will only last about 30 or 40 minutes.  The chilli peppers growing over months I found each hour was enough to show the plants growing.\n\nChill flowers came and went within 2-3 days but that required a medium of every 10 minutes but experiment.\n\nIn this example we will run every minute and show a melting lolly so let's get started....\n\nAdd the cron entry by executing the below command.\n\n```bash\n(crontab -l ; echo \"* * * * * /home/pi/timeLapse.sh my_first_laspe  1024 768 30\") | crontab\n```\n\nYou can remove it or hash it out when you are done with this command\n\n```bash\n ( crontab -l | grep -v -F \"/home/pi/timeLapse.sh my_first_laspe  1024 768 30\" ) | crontab -\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmebailey%2Fpitimelapse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrmebailey%2Fpitimelapse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrmebailey%2Fpitimelapse/lists"}