You are not logged in.
Pages: 1
so I'm creating some bash scripts for controlling my camera and it creates a file called Capture.jpg. because I need the files in a seperate folder and in order(so the can easily be compiled into my stopmotion) I would like to copy the file into the other folder as Capture1.jpg then Capture2.jpg then Capture3.jpg...
how would I do this?
Last edited by XenoZergNid (2014-01-24 21:34:06)
Offline
Post the script in question.
I guess you first create Capture.jpg and then rename it to Capture0000.jpg, next one will get renamed to Capture0001.jpg etc.
Offline
well that will work, the only problem is that I don't know how to store the number it will be renamed too. heres the script:
#captures the image from the camera to the file
capture 'capture Capture.jpg'
#copy the file to the new file. how should I get the right number?
cp './Capture.jpg' './pictures/pic'1'.jpg'
#for onion skinning; isn't related to this problem
capture 'vfalign transparent ./Capture.jpg'
exit 0
Offline
man date
Offline
If you're going to call this script by hand only a few times, you can enter the number yourself.
Is it going to be called automatically e.g. every 5 seconds or ...?
You can simply use the date and time (with seconds) as the directory name.
Offline
@Karol
The stopmotion will be 15 fps so a 30 second film will be 450 pictures.
@jasonwryan
how would I write that line?(I'm relativly new to bash script)
cp './Capture.jpg' './pictures/pic' how do I write the output of date +"%d-%M-%S" here? '.jpg'
Offline
$ touch capture.jpg
$ cp capture.jpg capture-$(date "+%s").jpg
$ cp capture.jpg capture-$(date "+%s").jpg
$ cp capture.jpg capture-$(date "+%s").jpg
$ ls
capture-1390508060.jpg capture-1390508064.jpg capture-1390508065.jpg capture.jpg
Offline
thank you very much! problem solved.
Offline
In the unlikely case that you want to capture more than one iamge per second, use
date +%s.%N
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Please remember to mark the thread as solved https://bbs.archlinux.org/viewtopic.php?id=130309
Offline
Also, why the middle man?
Why `capture Capture.jpg` then `cp Capture somefilename`. Why not just `capture somefilename`? Or more specifically
while true; do
capture /path/to/images/img_$(date +%s).jpg
sleep 1
done
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
OP mentions
capture 'vfalign transparent ./Capture.jpg'
No idea what id does, maybe he needs Capture.jpg for something.
I agree that if he wants to use bash all the way, Trilby's suggestion of continuous loop and sleep is perfect.
Offline
If you save the date output to a variable then the watermark could be added during the loop, or, if the processing delay would be too great, it could be done in bulk after the capture loop is completed.
Last edited by WorMzy (2014-01-23 22:15:46)
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Online
Pages: 1