WXforum.net
Weather Software => RaspberryPI Weather Software => Topic started by: plex on January 17, 2016, 09:51:46 AM
-
Hello
I'm a beginner with Raspberry Pi2, and I thought I easily could create time lapse, but I really could use some hints, or a recipe :)
Want I want to do:
Create a nice timelapse everyday - from sunrise to sunset. At sunset file video should be created, and uploaded to my website. I'm won't use a raspberry camera module, but an ip-camera.
The camera can do stills with the following format trough ftp: (here it's 1 min interval)
192.168.1.140_01_20160117100249271_TIMING.jpg
192.168.1.140_01_20160117100349274_TIMING.jpg
192.168.1.140_01_20160117100449277_TIMING.jpg
Also I can grab stills:
http://user:password@192.168.1.140/Stre ... /1/picture
Should I let the camera do the job taking stills, or is't more clever to use the pi?
What applications do I need for the job? list please :)
As far as I can google, the only encoder with gpu support is openmax - is that correct?
I recently migrated from WD to MB, so no more easy time lapse, or stills with overlay.
Thanks in advance
-
First of all,Meteobridge does a wonderful job of overlaying text (wx vars etc.) onto stills. Uses Imagemagick CONVERT to do it. (Which runs on the Pi BTW).
While you could use the IP cam within the Pi since it has its own FTP server I'd use that to put the files into a dir. Why complicate it using the Pi? You need mencoder if you want a AVI file. Get that and use this:
$mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o tlcam.avi -mf type=jpeg:fps=24 mf://@stills.txt
-
First of all,Meteobridge does a wonderful job of overlaying text (wx vars etc.) onto stills. Uses Imagemagick CONVERT to do it. (Which runs on the Pi BTW).
While you could use the IP cam within the Pi since it has its own FTP server I'd use that to put the files into a dir. Why complicate it using the Pi? You need mencoder if you want a AVI file. Get that and use this:
$mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o tlcam.avi -mf type=jpeg:fps=24 mf://@stills.txt
Hi Bushman
I think you are leading me in the right direction. However I have some issues getting the FTP running.
Thanks for advise
-
Run Pure-FTP on your Pi. The camera needs some place to send its files.
-
Run Pure-FTP on your Pi. The camera needs some place to send its files.
Got it running with proftpd - straight forward.
Now I just need to do the scripts, to automate the process :)
Good fun to play a Pi, and very learning - at least for me.
-
Great! I should take a look at proftpd. Be sure to post a link to a timelapse when you get it done.
-
Great! I should take a look at proftpd. Be sure to post a link to a timelapse when you get it done.
I'm pretty much stucked, as I can't figure out, how to rename a bunch of files in a shell command, so I can use them for encoding the timelapse.
This is what my ip camera is giving me:
192.168.1.140_01_20160118205122254_TIMING.jpg
192.168.1.140_01_20160118205222260_TIMING.jpg
192.168.1.140_01_20160118205322262_TIMING.jpg
I want to rename them to timelapse0000.jpg, timelapse0001.jpg and so on?
HELP :oops:
I've done it moving them to my Mac, and used nameChanger, but I need to figure out a way on the Pi.
Then I use gstreamer to encode, and I'm very impresses how fast the RPI2 is with use of it's GPU. 891 files in 111 seconds into a 1920x1080 183 Mb file - yes I don't need that high resolution for a webpage ;)
-
(Aside: the GPU in the RPi2 is unchanged from the previous version, but if you want faster processing allocate more memory to it)
There are a couple ways to do the renaming you want (although I am not sure why you want/need to). You can put the RENAME command in a loop that increments the files as TIMELAPSE0001, 0002, 0003, etc. You'll have to cron the process to fit inside the write timing.
Or you can watch the directory using the inotify-tool (sudo apt-get install inotify-tools) which contains wait and watch functions. Then process using code of your choice (REGEX, perlexpr etc.)
-
(Aside: the GPU in the RPi2 is unchanged from the previous version, but if you want faster processing allocate more memory to it)
There are a couple ways to do the renaming you want (although I am not sure why you want/need to). You can put the RENAME command in a loop that increments the files as TIMELAPSE0001, 0002, 0003, etc. You'll have to cron the process to fit inside the write timing.
Or you can watch the directory using the inotify-tool (sudo apt-get install inotify-tools) which contains wait and watch functions. Then process using code of your choice (REGEX, perlexpr etc.)
I've already allocated 256 Mb for the GPU.
Yes I know there´re several command to do it, but as I have 0 experience with linux, so it's not that easy.
The reason I want to rename the 1000 files everyday is simple because, I don't know how to feed the encoder with the output from my camera. It just need to start from lowest number ;)
location="timelapse%04d.jpg"
I've tried to make a list with the files, but that didn't work neither.
ls *.jpg > stills.txt
location="stills.txt"
-
This has ZERO to do with Linux - it all logic and your choice of method: OS, scripts, Python etc. Here's how to do it. :) Execute the command below in the directory where the JPGs are located. Note that you need to change "$n" if you want the file names to say TIMELAPSE or whatever as this renames them 1.jpg, 2.jpg
ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done
See these results from my Pi as a the full demo.
pi@raspberrypi ~/data $ ls
192.168.1.140_01_20160118205122254_TIMING.jpg
192.168.1.140_01_20160118205122255_TIMING.jpg
192.168.1.140_01_20160118205122256_TIMING.jpg
192.168.1.140_01_20160118205122259_TIMING.jpg
pi@raspberrypi ~/data $ ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done
pi@raspberrypi ~/data $ ls
1.jpg 2.jpg 3.jpg 4.jpg
-
This has ZERO to do with Linux - it all logic and your choice of method: OS, scripts, Python etc. Here's how to do it. :) Execute the command below in the directory where the JPGs are located. Note that you need to change "$n" if you want the file names to say TIMELAPSE or whatever as this renames them 1.jpg, 2.jpg
ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done
See these results from my Pi as a the full demo.
pi@raspberrypi ~/data $ ls
192.168.1.140_01_20160118205122254_TIMING.jpg
192.168.1.140_01_20160118205122255_TIMING.jpg
192.168.1.140_01_20160118205122256_TIMING.jpg
192.168.1.140_01_20160118205122259_TIMING.jpg
pi@raspberrypi ~/data $ ls | cat -n | while read n f; do mv "$f" "$n.jpg"; done
pi@raspberrypi ~/data $ ls
1.jpg 2.jpg 3.jpg 4.jpg
Thank you so much Bushman - it works perfectly. \:D/
However I don't know how to specify location with gstreamer.
If I do : location="timelapse%04d.jpg
GStreamer expect a 4 digit number starting with timelapse0000.jpg
How can I specify the right prefix?
Or can I modify your code, to adapt?
-
I am not familiar with Gstreamer but from what little I found via Google, you can change the name of the input file. My code would work as well, but with some minor modification to create a "mask" that fits what GS requires. Sorry.
-
I managed to find way, and now it's running with a cron job on the pi. Video is updated every hour, and after midnight the video is becoming a yesterday movie. Video is made from 30 sec stills, from my Hikvision DS-2CD2032-I.
The only little issue I have, is some greenish in the bottom of the video - something with the encoder :???:
Here is the result - be aware my host apparently have server problems, so page can load slowly:
http://www.vejrstationen.dk/weather28/index.php?p=303&wp=MB&lang=en (http://www.vejrstationen.dk/weather28/index.php?p=303&wp=MB&lang=en)
The only wish I have now, is weather data and clock overlay, but I guess in not that easy.
-
Not bad! http://kwlug.org/node/854 for overlay example.
-
The green bar, is a problem with H264 if resolution is not dividable with 16 - if anyone should have the same problem.
I'm so impressed with the Pi doing the time lapse - about 1450 stills @ 175 Mb copied to another folder, renamed and encoded in less than 2 min - video is 122 Mb.
With my old WD display setup, it took far more time, and the CPU was stressed, on my virtual PC.