====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
peripherals:camera:timelapse [2016/06/20 01:39]
admin
peripherals:camera:timelapse [2017/03/01 18:19]
admin [Convert / Modify images before combining]
Line 14: Line 14:
 ===== PiCamera Timelapse Code ===== ===== PiCamera Timelapse Code =====
  
-Before going further, be sure to have the [[peripherals:​camera#​picamera|picamera python library installed]] on your Raspberry Pi. +Before going further, be sure to have [[:​peripherals:​camera#​activating_the_camera|the camera activated]] and the [[peripherals:​camera#​picamera|picamera python library installed]] on your Raspberry Pi. 
  
 ==== Python Script ==== ==== Python Script ====
Line 170: Line 170:
 </​Code>​ </​Code>​
  
-===== Poxer Management =====+===== Power Management =====
  
 A timelapse system will often have to work as a standalone solution, running on batteries. Therefore it's probably interesting to consider reducing it's power consumption. Some possible options to do this are described in [[:​power|the Power Management page of this wiki]]. A timelapse system will often have to work as a standalone solution, running on batteries. Therefore it's probably interesting to consider reducing it's power consumption. Some possible options to do this are described in [[:​power|the Power Management page of this wiki]].
Line 260: Line 260:
 ---- ----
 ==== 4- Process files on the Raspberry Pi ==== ==== 4- Process files on the Raspberry Pi ====
-----+**Note:** all recommendations hereafter are based on a [[:​os:​minibian|Minibian install]] (2016-03-12-jessie), it is supposedly very close to Raspbian but we haven'​t have the opportunity (yet) to test if all works the same on Raspbian. 
 + 
 +=== A View image files with FIM === 
 + 
 +There is a nice piece of software called [[http://​www.nongnu.org/​fbi-improved/​|FIM]] that allows to visualize image files straight into the Linux shell! 
 + 
 +We'll follow the [[http://​www.nongnu.org/​fbi-improved/​|Download and build instructions]] from the FIM website: 
 + 
 +<​Code:​bash |Download and install FIM> 
 +> wget http://​download.savannah.nongnu.org/​releases/​fbi-improved/​fim-0.5-rc1.tar.gz 
 +> wget http://​download.savannah.nongnu.org/​releases/​fbi-improved/​fim-0.5-rc1.tar.gz.sig 
 +> gpg --search '​dezperado autistici org' 
 +# import the key from a trusted keyserver by following on screen instructions 
 +> gpg --verify fim-0.5-rc1.tar.gz.sig 
 +</​Code>​ 
 + 
 +We'll need a few additional packages to go on: 
 +<​Code:​bash |Install FIM required packages:>​ 
 +> apt-get install gcc gcc-c++ g++ build-essential flex bison libreadline-dev libexif-dev 
 +> ./configure  
 +> make -j 6 
 +> make install 
 +</​Code>​ 
 + 
 +**Notes:​** 
 +  * although ''​libreadline-dev''​ was installed we had to use the ''​--disable-readline''​ option to be able to configure 
 +  * we used ''​make -j 6''​ to take advantage of the 4 cores in the Pi3 ([[https://​www.raspberrypi.org/​forums/​viewtopic.php?​f=29&​t=103001|see this]]) 
 + 
 +=== B - Install ffmpeg on The RasPi ===
  
 This will require us to install ffmpeg on the Raspberry Pi. The process for doing this is described on [[http://​www.jeffreythompson.org/​blog/​2014/​11/​13/​installing-ffmpeg-for-raspberry-pi/​|jeffreythompson.org'​s blog]]. This will require us to install ffmpeg on the Raspberry Pi. The process for doing this is described on [[http://​www.jeffreythompson.org/​blog/​2014/​11/​13/​installing-ffmpeg-for-raspberry-pi/​|jeffreythompson.org'​s blog]].
Line 291: Line 319:
  
 We now have a //​my_timelapse.mp4//​ movie which is full HD (1920×1080). We now have a //​my_timelapse.mp4//​ movie which is full HD (1920×1080).
 +
 +==== Convert / Modify images before combining ====
 +----
 +
 +Sometimes it may be suitable to adjust,​convert or otherwise modify images before they are integrated as a movie.
 +
 +[[https://​www.imagemagick.org/​script/​convert.php|ImageMagick]] offers a set of command line tools that can be used to manipulate images from the command line. In the following example, we're going to ''​convert''​ all captured images to grayscale, it's also called desaturate. Therefore, we'll be using the imagemagick ''​[[https://​www.imagemagick.org/​script/​convert.php|convert]]''​ command. To enhance the output result, we'll also make use of the ''​-normalize''​ option.
 +
 +Here is how to **convert a single file**:
 +<​Code:​bash|Single file conversion>​
 +> convert my_originals/​img01.jpg -colorspace Gray -normalize my_converted/​img01.jpg
 +</​Code>​
 +
 +Here is how to **batch convert multiple files** at once:
 +<​Code:​bash|Multiple files conversion>​
 +> for f in my_originals/​*.jpg ; do convert "​$f"​ -colorspace Gray -normalize "​my_converted${f%my_originals}"​ ; done
 +</​Code>​
 +
 +Another interesting usage of ImageMagick here would be to "water mark" all images before integrating them into the movie, your timelapses can be "​signed"​ using this method.
 ==== MP4 Optimization for Web Streaming ==== ==== MP4 Optimization for Web Streaming ====
 ---- ----
Line 298: Line 345:
 ---- ----
  
-Using all of the above, sticking the camera equipped Raspberry Pi to my bedroom window with the Romoss battery pack charged at 45% here is what came out as the final timelapse video:+Using all of the above, sticking the camera equipped Raspberry Pi to my bedroom window with the Romoss battery pack charged at 45% here is what came out as the final timelapse video. Please note that it is the original video here which was cut in length (only showing a selected 50secs sequence) but hasn't been optimized for web streaming, you can play it full screen to judge of the effective quality (1920x1080): 
 + 
 +{{:​peripherals:​camera:​boulevard2-cut.mp4}}