User avatar
Mettauk
Posts: 238
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 11:36 am

the top code works fine

Code: Select all

raspistill -w 1280 -h 720 -x -n -tl 1000 -t 7200000 -o /media/KINGSTON/tlCAP/tl_%05d.jpg
But this fails..

Code: Select all

raspistill -w 1280 -h 720 -x -n -tl 1000 -t 7200000 -o /media/KINGSTON/tlCAP/tl$(date +"%d%m%Y_%H%M-%S").jpg
Is there a way to use datetime rather than just numbers as datetime would mak image hunting much easier?
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

achrn
Posts: 421
Joined: Wed Feb 13, 2013 1:22 pm

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 11:48 am

I don't know whether there's a shortcut specific to raspistill, but in general you can use backwards-single-quote marks (which might be on the key to the left of your '1' key). They generally cause the command inside the quotes to be executed and the result substituted before processing whatever is outside the quotes.

so:

Code: Select all

raspistill -w 1280 -h 720 -x -n -tl 1000 -t 7200000 -o /media/KINGSTON/tlCAP/tl_`date +%d%m%Y_%H%M-%S`.jpg
is worth a try.

User avatar
Mettauk
Posts: 238
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 12:46 pm

achrn wrote:I don't know whether there's a shortcut specific to raspistill, but in general you can use backwards-single-quote marks (which might be on the key to the left of your '1' key). They generally cause the command inside the quotes to be executed and the result substituted before processing whatever is outside the quotes.

so:

Code: Select all

raspistill -w 1280 -h 720 -x -n -tl 1000 -t 7200000 -o /media/KINGSTON/tlCAP/tl_`date +%d%m%Y_%H%M-%S`.jpg
is worth a try.
It produces the same problem, one image only rather than a rolling quantity of jpg images with datetime names.

My guess is the video core will only output images as name/number. Using date messes with output as date is coming from the processor???? :?
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

User avatar
algorithm
Posts: 198
Joined: Mon Nov 25, 2013 9:09 pm
Location: Flatland

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 12:54 pm

Backticks is the same as $(). The difference between your 2 examples is the first one provides a template to raspistill to use for numbering, while the second just runs the date command first so doesn't provide any template to raspistill. If you want raspistill to tag images by date rather than number, you need to modify the C code and compile your own version. Otherwise, you need to wrap the raspistill command in a script (bash/python/php/whatever) that takes care of the renaming by date.

User avatar
Mettauk
Posts: 238
Joined: Mon Dec 10, 2012 12:40 pm
Location: Zarg

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 1:19 pm

snip...
If you want raspistill to tag images by date rather than number, you need to modify the C code and compile your own version. Otherwise, you need to wrap the raspistill command in a script (bash/python/php/whatever) that takes care of the renaming by date.

An example of HOW to do this would be very welcome
As humans we have been the same for a very very long time, technology changes how we do... not who we are as people.

User avatar
DougieLawson
Posts: 39560
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 1:23 pm

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26842
Joined: Sat Jul 30, 2011 7:41 pm

Re: Using DateTime as a file name with timelapse -tl

Thu May 08, 2014 1:24 pm

Indeed - get dates in to the timelapse filenames would require a change to the C code of Raspivid - at the moment it just has the ability to use a file number. Sorry, I don't have time to do that right now.

Failing that, as mentioned above, write a script that does the timelapse stuff for you, and provide the dated filename. I think there is documentation on this here http://www.raspberrypi.org/learning/timelapse-setup/
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

M_P
Posts: 51
Joined: Sun Jan 06, 2013 5:40 pm

Re: Using DateTime as a file name with timelapse -tl

Sun Oct 19, 2014 7:27 am

I'm next to useless when it comes to programming but here's what I did. It doesn't set a date on the filenames but instead creates a directory with the date and time and dumps the timelapse images into it. Makes it a little easier to sort through them at least.

Code: Select all

import time
import os

getthetime = time.strftime("%Y%m%d-%H%M%S")

#Create the folder with the full path
mydir = "/mnt/"+getthetime
os.makedirs(mydir)

#Put together the line to run Raspistill
runstill = ("raspistill -tl 2000 -t 60000 -o "+mydir+"/pic%04d.jpg")

os.system(runstill)
There's a "/mnt" in front of the date because that's where I've got a USB drive mounted to hold the pictures.

tallika_fan
Posts: 5
Joined: Thu Mar 26, 2015 1:26 pm

Re: Using DateTime as a file name with timelapse -tl

Wed Jul 08, 2015 8:07 am

M_P wrote:I'm next to useless when it comes to programming but here's what I did. It doesn't set a date on the filenames but instead creates a directory with the date and time and dumps the timelapse images into it. Makes it a little easier to sort through them at least.

Code: Select all

import time
import os

getthetime = time.strftime("%Y%m%d-%H%M%S")

#Create the folder with the full path
mydir = "/mnt/"+getthetime
os.makedirs(mydir)

#Put together the line to run Raspistill
runstill = ("raspistill -tl 2000 -t 60000 -o "+mydir+"/pic%04d.jpg")

os.system(runstill)
There's a "/mnt" in front of the date because that's where I've got a USB drive mounted to hold the pictures.

I've just implemented this code on my machine swapping out the /mnt for the local system. so far so good.
Cheers
Pete

marciano
Posts: 26
Joined: Mon Oct 23, 2017 10:54 pm

Re: Using DateTime as a file name with timelapse -tl

Tue Oct 24, 2017 4:37 pm

Using exiftool it is possible to get dataTime from metadata and rename files

Return to “Camera board”