User avatar
MarkMutt
Posts: 16
Joined: Tue May 12, 2015 4:33 pm

Time Lapse Photography And avconv

Tue Oct 17, 2017 5:49 pm

Hi All,
I am doing some work with a Pi Zero W, a Pi Cam v2 and a USB stick
I did some rough calcs and a 64gb stick seems just big enough to take a 1280x720 shot every 12 seconds for 14 days (comfortably) and to hold the videos made on a day by day basis using avconv at a suitable compression.
I know that sometimes what happens at night is more like watching paint dry, but I was going to keep the pictures and re-run the video compile after I got home/had more time to cull the dead spots/had a more powerful machine available.
So, my issues are :-
  • 1. input photos to avconv with a YYYYMMDDHHmmss.jpg format instead of %04d.jpg, is this possible ? (easier to find images for particular times)
  • 2. my python script is written with heavy influences from other languages, could this be improved (Python <= 3 months ; - ( ).
  • 3. the script is meant to be 'flexible' to allow for different requirements but is based on a 24hr period, is that optimal/most flexible ?
  • 4. is this the best way to call raspistill for these requirements ? (the quickest framerate calc said every 12 secs (for me) so the -t 5000 was not an issue, though I've heard of people running TL every 2secs (so -t 1900 ???).
  • 5. the script waits to the end of 'the period' then starts (as a background task, so runs concurrently on a single processor (pi Zero)) avconv to get a 'rough cut' for review purposes, meanwhile restarts picture capture to a new folder for the next days photos (video conversion takes ~sub 4hrs and runs during the night as I use a crontab to start script at midnight). My issue is the command line used to call avconv. Is this the best way of doing this ?
  • 6. I used a Sandisk Ultrafit Thumb Drive and it got VERY hot given the virtual constant access, I fear early failure - Should I be using 'say' a 2 1/2" metal cased usb hard disk (circa 320GB are a mb/£ low point). I'd have to check that the Pi Zero could support the current draw, does anyone have experience of this ?
  • 7. I use 2 off Pi Zero's (for different window views). Rather than use a disk for each, should/could I set up a share on one Pi and connect the disk to that, then mount a fs in fstab to access it from the other pi ? Will it cope with the disk thrash that may ensue ? and what about WiFi bandwidth ?
  • 8. Whilst on holiday I made some changes and got 'better' compression results but my subsequent tests have not yielded more information. I thought I'd try different compression settings to get an acceptable quality at a smaller file size but i used the second bash script to generate these files with different settings -q (1 to 31) and then -crf_max (I assume 0 to 40ish) but they ALL came out at the same size and apparent quality, man avconv does not list ANY -crf information. Are there different builds out there ? or am I doing something wrong again ?
  • 9. I also used 'touch' to give me a flag to see if video coding had finished. I ssh from a tablet or access the folders via a samba share and wanted to check before shutting down. is this reasonable as it's only once per 'period' ? (USB write wear ???)
Please find below, my Python Script (feel free to rip off whatever you need/want ; - ) ) and the BASH script used to test (and fail) compression settings :-
Python

Code: Select all

#!/usr/bin/python3
#  FILE NAME: MuttTimeLapse.py   Ver 0.05
#     AUTHOR: MarkMutt 20170907
#  LAST EDIT: MarkMutt 20171008
#      Lines: 91
#
#   FUNCTION: Python Script to take sequential Time Lapse Shots and Videos
#
#  Example syntax:- No Syntax is required, but you do need to set variables
# and configure locations and access.
#
# Import required Modules
import os
import os.path # distinct from os 'aparently !'
import time
from datetime import datetime

# Set locations
sBseF = "/media/usb0/"           # Photos stored under this
sPhBse = "PC2"                   ### Machine being run on *changes per machine*
#sPhFnp = "img_"                 # Each Photo will be named this (+ a sequential/date suffix)
sPhFnp = "TLPic" + sPhBse + "_"  # Photo filename prefix (+ a sequential/date suffix)
sVPth = "/media/usb0/Video/"     # Video storage Location
sVFnp = "TLVid_" + sPhBse + "_"   # Video filename prefix (+ a sequential/date suffix, 20170900 will mean 31/08/2017)
# Define the size of the image required to capture. (if you can do this to match required video it save specifiying same, and issues with interpolation errors.
iW = 1280                        # Max = 2592 
iH = 720                         # Max = 1944
iFs = 20                         # number of secs between frames (plus time to take and process) not lower than 5 unless you change -t
iTlHrs = 24                      # number of hours for timelapse (will have 10 seconds removed)

while True:
    # Get time(NOW) to create meaningfull yet changing folder names
    dtn = datetime.now()
    iNYY = "%04d" % (dtn.year) 
    iNMM = "%02d" % (dtn.month) 
    iNDD = "%02d" % (dtn.day)
    iNHH = "%02d" % (dtn.hour)
    iNmm = "%02d" % (dtn.minute)
    iNss = "%02d" % (dtn.second)
    tEnd = time.time() + iTlHrs * 60 * 60 - 10 # sets time to end of capture (in seconds)
    
    # if doing day videos HH is not required, yet if doing 60min ones; then even mm shall be necessary.
    sPFldr = sBseF + "Photo_" + sPhBse + "_" + str(iNYY) + str(iNMM) + str(iNDD) + "/" # + str(iNHH) + str(iNmm) + str(iNss) + "/" # insert '+ "/" #' as required - NOTE: The '/' is VERY important
    os.mkdir(sPFldr)
    iSn = 1 # 1st Photo File Serial No.

    while time.time() < tEnd:
        # Alt1! Use serial file numbering
        tSn = "%04d" % (iSn)
        sPhFn = sPhFnp + tSn
        # Alt2! Capture the time(NOW) (different from start time) to form picture filename suffix
        #dtn = datetime.now()
        #iNYY = "%02d" % (dtn.year)
        #iNMM = "%02d" % (dtn.month) # include year and month in name, if your sequence requires it
        #iNDD = "%02d" % (dtn.day)
        #iNHH = "%02d" % (dtn.hour)
        #iNmm = "%02d" % (dtn.minute)
        #iNss = "%02d" % (dtn.second)
        #sPhFn = sPhFnp + iNDD + iNHH + iNmm + iNss # prefix, Day, Hour, Minute and Second
        # Capture image using raspistill
        # Set to capture with added sharpening, 'auto' white balance and average metering mode
        # Set these as required (read 'raspicam' documentation or use 'raspistill --help'.
        os.system("sudo nohup raspistill -t 5000 -w " + str(iW) + " -h " + str(iH) + " -o " + str(sPFldr) + sPhFn + ".jpg -sh 40 -awb auto -mm average >/dev/null 2>&1 &")
        
        # Increment File Serial iSn
        iSn += 1
        # Wait x (set by iFs variable) seconds before next capture, set at start
        time.sleep(iFs)
        
    else:
        # Alt1! - This generates sequential (and not previously used !) number
        #sVFns = "%03d" % (iVNo)
        #while os.path.isfile(sVPth + sVFnp + sVFns + ".avi"):
        #    iVNo += 1
        #    sFns = "%03d" % (iVNo)
        # Alt2! - This generates date/time stamp for filename
        dtn = datetime.now()
        iNYY = "%04d" % (dtn.year) 
        iNMM = "%02d" % (dtn.month) 
        iNDD = "%02d" % (dtn.day - 1) # This 'should be' yesterday ;-) # "%02d" % (dtn.day)
        iNHH = "%02d" % (dtn.hour)
        iNmm = "%02d" % (dtn.minute)
        iNss = "%02d" % (dtn.second)
        sVFns = str(iNYY) + str(iNMM) + str(iNDD) # + str(iNHH) + str(iNmm) + str(iNss) # insert '#' as required
        sVFn = sVFnp + sVFns
        if not os.path.isfile(sVPth + "working"):
            os.system("touch " + sVPth + "working")
        # set this as required, read 'man avconv' or use 'avconv --help'
        os.system("sudo nohup avconv -r 25 -i " + sPFldr + sPhFnp + "%04d.jpg -r 25 -y -an -vcodec libx264 " + sVPth + sVFn + ".avi >/dev/null 2>&1 &")
        if os.path.isfile(sVPth + "working"):
            os.remove(sVPth + "working")
BASH

Code: Select all

#!/bin/bash

#usage: avconv [options] [[infile options] -i infile]... {[outfile options] outfile}...
#rm /media/usb0/Video/timelapse.avi
#touch /media/usb0/Video/working
#avconv -i /media/usb0/Photo/Day_%05d.jpg -r 25 -y -an -vcodec libx264 /media/usb0/Video/timelapse.avi
#sleep 10
#rm /media/usb0/Video/working

#to set via quality use -q 1 = best, 31 = worst
#-crf sets bitrate and conflicts with -q, so -crf_max float may be better, file size (approx) halves with every 5, 

#avconv -r 30 -i /media/usb0/Photo/Day_%05d.jpg -r 30 -vcodec libx264 -vf w:1024 h:576 -an -y /media/usb0/Video/timelapse.avi
#avconv -r 30 -i /media/usb0/Photo/Day_%05d.jpg -r 30 -vcodec libx264 -vf scale=1024:576 /media/usb0/Video/timelapse.avi
#sudo avconv -r 25 -i /media/usb0/Photo_20170919/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 1280x720 -q 10 -an -y /media/usb0/Video/TLVid_PC2_20170919.avi &
#sudo avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 1024x576 -crf 32 -an -y /media/usb0/Video/TLVid_PC2_20171003.mov &
#sudo avconv -r 25 -i /media/usb0/Photo_20170923/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 1024x576 -q 14 -crf 32 -an -y /media/usb0/Video/TLVid_PC2_20170923.avi &
#sudo avconv -r 25 -i /media/usb0/Photo_20170919/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 14 -crf 33 -an -y /media/usb0/Video/TLVid_PC2_20170919.avi &
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 1 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q1.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 4 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q4.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 7 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q7.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 11 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q11.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 15 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q15.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 19 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q19.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 23 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q23.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 27 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q27.avi
#avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -q 31 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480q31.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 0 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm0.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 5 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm5.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 10 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm10.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 15 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm15.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 20 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm20.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 25 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm25.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 30 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm30.avi
avconv -r 25 -i /media/usb0/Photo_20171003/TLPC2_%04d.jpg -r 25 -vcodec libx264 -s 860x480 -crf_max 35 -an -y /media/usb0/Video/TLVid_PC2_20171003_860x480crfm35.avi
ALL the files from the above -q and -crf_max tests came out at 16,070 KB

I hope I've not missed off anything needed for analysis
Any comments/suggestions will be gratefully received ; - )
Mutt
Spent 20 years bashing at keyboards, all I get is broken keys ;-)

RDS
Posts: 712
Joined: Tue Oct 06, 2015 8:17 am
Location: Lancashire, UK

Re: Time Lapse Photography And avconv

Wed Oct 18, 2017 10:13 pm

I save my pictures (Python3) using the date and time information, using the following code.

Code: Select all

import datetime as dt
filename=(dt.datetime.now().strftime('%Y%m%d - %a %H:%M'))
camera.capture('/home/pi/pictures/' + str(filename) + '.jpg')
and it saves pictures with filenames such as:
20171018 - Wed 22:30.jpg

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Time Lapse Photography And avconv

Wed Oct 18, 2017 10:46 pm

Nice !

I did the same thing but in 2013 with a Webcam and the first Pi!

viewtopic.php?f=63&t=8659&p=290591&hili ... p4#p290591

User avatar
MarkMutt
Posts: 16
Joined: Tue May 12, 2015 4:33 pm

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 9:58 am

RDS - Thanks for the comment, I will explore that to improve the code around file naming with human readable date codes and even put it in a function to reuse code ; - ))))

danj - cool, use of Web cam, though I'm trying to use standard modules /equipment to broaden the support and availability to idiot newbies like me. ; - ))))

Its not like I'm not being selfish (as I will benefit from comments and suggestions given) but I've also seen adverts for time lapse services costing circa £300 per month ! So for less than 1 months money, any reasonably competent person, following instructions, should be able to do it themselves. Also, it's a fun hobby too.
Some people travel to some very exotic locations and though a good picture is worth a thousand words, a good video (without you having to attend said equipment) can really capture the mood and grandeur of a classic sunrise /sunset. Or you may want to record the building of your house /extension.

So I would encourage even savage criticism of my methods, if it helps me and others to achieve a more bullet proof solution. Though maybe I should have used python 2 so Dougie could have a go at that ; - )

Cheers
Mutt
Spent 20 years bashing at keyboards, all I get is broken keys ;-)

kaksi
Posts: 92
Joined: Tue Mar 10, 2015 6:19 am

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 2:42 pm

I have a useful function (just slightly adapted what I found on internet):

Code: Select all

def darkness():
  if brightness==0:
    return 0
  im=Image.open(jpg_name)
  pixels=(im.size[0]*im.size[1])
  hist=im.convert('L').histogram()
  br=float(sum([i2*hist[i2] for i2 in range(256)]))/pixels
  if(br<brightness):
    os.remove(jpg_name)
  return(int(br))
Probably, it will need
import Image #needs sudo apt-get install -y python-imaging

A good value for brightness is 35, if it is less, it is not worth to keep the image.
0 if I take as many images as I can.

kaksi
Posts: 92
Joined: Tue Mar 10, 2015 6:19 am

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 3:25 pm

MarkMutt wrote:
Tue Oct 17, 2017 5:49 pm
  • 5. the script waits to the end of 'the period' then starts (as a background task, so runs concurrently on a single processor (pi Zero)) avconv to get a 'rough cut' for review purposes, meanwhile restarts picture capture to a new folder for the next days photos (video conversion takes ~sub 4hrs and runs during the night as I use a crontab to start script at midnight). My issue is the command line used to call avconv. Is this the best way of doing this ?
I took another approach. From time to time, I connect with WinSCP (or putty) and I download the pictures. Then I use mencoder. Even on an old desktop, it is a question of half an hour. Besides, it avoids the directory management - not a big deal, but I prefer it as simple as possible.

The best way would be to check the RPI whether the remote is available and make him send the pictures. One day, I will do it, unfortunately, I have quite a lot of urgent troubles.

A final though: I remember the first pictures on a VGA monitor in 640x480. They were SO beautiful!!! A very poor quality on a modern monitor. So I take all snaps in the highest resolution, even if my present monitor cannot cope with it.

User avatar
MarkMutt
Posts: 16
Joined: Tue May 12, 2015 4:33 pm

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 5:29 pm

kaksi - Hi and thanks for contributing. From the quick look I've taken, your code could analyse a passed image, determine a general level of brightness and then test against a threshold to delete said image ... move to next image ...
How would that work in a situation where you are deliberately taking picture of sunsets and sunrises ? Even when I do find the night bit boring, it would seem churlish to chop the video immediately rather than let you settle into that realisation. so maybe I could run a counter of consecutive dark pictures before deleting them but then there is the issue about sunrises which requires the opposite. So We'd have to process them both ways and only delete the overlap ?

What I'd be more interested in is a % change detection (a bit like motion sense but a 'more' sensitive) so more than (say) 20 shots without change, subsequent ones get deleted. Need to see shadows rotate as the sun moves so the change threshold would be quite low. But then Night shots of cities etc. would come alive when people switch lights on/off in their offices/apartments. I'll have to look into that.

I notice you mention mencoder in your second post though if I was on holiday I wouldn't have a computer with me (other than the Pi's ; - ) ). I have to ssh from a tablet. My wife already thinks I carry enough junk. So ... given the USB memory stick heat issue, I'm going to explore using a hard disk. I also find it a major hassle to log on to each WAP so following advice on this forum I'm going to use the Pi 2 I carry (for Music/Video) as the Router/WAP and then I can attach the hard disk to that (rather than using a Pi Zero, AND not having it hanging off a zero stuck high on a window AND possibly over loading the polyfuse). The Zero's could save the pictures straight to a mounted Samba share on the Pi 2 (or should I just jun a check every hour to look for files older than 1 minute in a given folder and move them across ... in case the Pi 2 is not available ? (say the wife unplugged it to use the charger)) and when the folder is complete get the Pi 2 to use it's 4 cores compiling the video with either avconv or mencoder ??? (I think I've seen a Pi installation topic on mencoder recently).
There would be an issue about (with my two Pi Zero's) running 2 compilations together, or I'd need to add a folder to a 'ToDo' list and have the control script take them off the list when done ???
Hmmm ! food for thought and also a challenge (i.e. maybe I can't do it ; - ( )

Cheers
Mutt
Spent 20 years bashing at keyboards, all I get is broken keys ;-)

kaksi
Posts: 92
Joined: Tue Mar 10, 2015 6:19 am

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 8:21 pm

MarkMutt wrote:
Thu Oct 19, 2017 5:29 pm
kaksi - Hi and thanks for contributing. From the quick look I've taken, your code could analyse a passed image, determine a general level of brightness and then test against a threshold to delete said image
Black images are not very interesting, especially when you make a video. Than there is the question of space.
MarkMutt wrote:
Thu Oct 19, 2017 5:29 pm
How would that work in a situation where you are deliberately taking picture of sunsets and sunrises ?
Quite well, you have to adjust "brightness". To be frank, there was a log noting the brightness. 35 is about the good value that the sunset gets black and turns to sunrise without a long black passage. Sure it depends on the frequency and on the fps of your video.
MarkMutt wrote:
Thu Oct 19, 2017 5:29 pm

Even when I do find the night bit boring, it would seem churlish to chop the video immediately rather than let you settle into that realisation. so maybe I could run a counter of consecutive dark pictures before deleting them but then there is the issue about sunrises which requires the opposite. So We'd have to process them both ways and only delete the overlap ? What I'd be more interested in is a % change detection (a bit like motion sense but a 'more' sensitive) so more than (say) 20 shots without change, subsequent ones get deleted. Need to see shadows rotate as the sun moves so the change threshold would be quite low. But then Night shots of cities etc. would come alive when people switch lights on/off in their offices/apartments. I'll have to look into that.
Interesting idea, just a day only has 24 hours.

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Time Lapse Photography And avconv

Thu Oct 19, 2017 11:45 pm

If you are interrested to use a setup with battery I made a simple system to power up the Raspberry Pi , take a picture and shutdown. The I2C timer will wake up the Pi and do another cycle.

viewtopic.php?f=65&t=166853&p=1075093&h ... e#p1074313

User avatar
MarkMutt
Posts: 16
Joined: Tue May 12, 2015 4:33 pm

Re: Time Lapse Photography And avconv

Fri Oct 20, 2017 10:37 pm

danj,
I am very interested in your post about the real time clock, it looks like genius AND cheap !
Though I'm not at my main PC (just using a tablet) and have not translated it from the French (my French is quite poor ; - ) ). Some bits of your circuit diagram seem a little indistinct but I think I get the gist.
What I don't understand is how the clock knows to wake the pi ?
Forgive my ignorance as it will probably become apparent when I do translate it.
What I have in my head though is a conflict between using it as 1. A stand alone battery set up. 2. A ups for an isolated unit that has a power source (but may be flakey). 3. A fully battery operated system allowing exchange of battery in a hot swap situation. But in all instances reducing power draw to a minimum ; - )
Cheers
Mutt
Spent 20 years bashing at keyboards, all I get is broken keys ;-)

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Time Lapse Photography And avconv

Tue Oct 24, 2017 11:10 pm

I'm using an RTC time clock which is connected to the I2c and has an alarm IRQ pin. This pin enable me to power up the PI with a DC/DC converter.

After The Raspberry PI boot and the OS is up and running, the crontab script point by the @reboot command line will be executed. This script takes a snap shot picture, calculate and set the next alarm and shutdown the PI.

The magic is the GPIO pin that you could set to be a power control which is linked directly, with the Alarm pin of the RTC , to the DC/DC converter enable pin.

dtoverlay=gpio-poweroff,gpiopin=25,active_low="y" in config.txt

When the Shutdown is done the GPIO pin will disable the DC/DC converter and remove the power to the PI. Because the RTC has is own battery it is still running and when the alarm is reached the alarm pin will power up the DC/DC to do another capture cycle.

P.S. some RTCs don't have an interrupt pin which is needed.

I should do a proper schematic. maybe later this month.

User avatar
MarkMutt
Posts: 16
Joined: Tue May 12, 2015 4:33 pm

Re: Time Lapse Photography And avconv

Wed Oct 25, 2017 12:07 am

danj,
Yes it is very clever, even genius (in my book anyway ; - ) ).
I mean you no disrepect but you limit how far your ingenuity can be apreciated by just posting in French.
This does not just have uses in photography but in all kinds of circumstances.
You should post this as an independent topic as I am sure many people would find a use for this.
But I also agree you should write it up and draw a proper schematic.
You say independent battery for the rtc, so you use (say) a big D cell (1.5v) for the rtc and ... anything you like for the pi supply li-po with an upswing or 6v (4 x D cells or even a gel-pack brick) with a buck converter ?
What is current draw of the rtc with the pi off ?
Cheers
Mutt
Spent 20 years bashing at keyboards, all I get is broken keys ;-)

danjperron
Posts: 3390
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Time Lapse Photography And avconv

Wed Oct 25, 2017 11:33 am

I bought the PiFace RTC. It has is own cr1220 battery cell.
Just google "raspberry PI RTC".

The DS3231 should work! I didn't test it but I do have some. It's cheap and the standby current is around 70µA.

The independent battery was a 12V gell cell to power up the system.

This setup is quite simple and was a 2 hours setup for proof of concept.
I do have other projects that I post on https://github.com/danjperron
and on the Forum!

rhubarbdog
Posts: 64
Joined: Mon Dec 11, 2017 9:58 pm

Re: Time Lapse Photography And avconv

Sat Feb 03, 2018 5:20 am

RDS wrote:
Wed Oct 18, 2017 10:13 pm
I save my pictures ...

Code: Select all

import datetime as dt
filename=(dt.datetime.now().strftime('%Y%m%d - %a %H:%M'))
camera.capture('/home/pi/pictures/' + str(filename) + '.jpg')
and it saves pictures with filenames such as:
20171018 - Wed 22:30.jpg
Just a quick note. If your using this code to name your files i'd modify the second line so there are no spaces in your filenames

Return to “General discussion”