<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Raspberry Pi Spy</title>
	<atom:link href="http://www.raspberrypi-spy.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.raspberrypi-spy.co.uk</link>
	<description>Raspberry Pi tutorials, scripts, help and downloads</description>
	<lastBuildDate>Wed, 12 Jun 2013 18:45:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Playing Videos On the Raspberry Pi Command Line</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/06/playing-videos-on-the-raspberry-pi-command-line/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/06/playing-videos-on-the-raspberry-pi-command-line/#comments</comments>
		<pubDate>Wed, 12 Jun 2013 18:45:39 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials & Help]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[mp4]]></category>
		<category><![CDATA[omxplayer]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1698</guid>
		<description><![CDATA[If you need to play video files and you don&#8217;t want to install a full media solution such as XBMC then you can play them directly from the command line using Omxplayer. This is a media player created by Edgar &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/06/playing-videos-on-the-raspberry-pi-command-line/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>If <img class="alignright size-thumbnail wp-image-1825" alt="Full HD Logo" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/full_hd_logo-150x150.png" width="150" height="150" />you need to play video files and you don&#8217;t want to install a full media solution such as XBMC then you can play them directly from the command line using Omxplayer. This is a media player created by Edgar Hucek specifically for the Raspberry Pi and it takes advantage of the Pi&#8217;s GPU.</p>
<p><strong>Installation</strong></p>
<p>Omxplayer is installed on the latest Raspbian image so you may already have it installed. If not you can install it using :</p>
<pre>sudo apt-get update
sudo apt-get -y install omxplayer</pre>
<p><span id="more-1698"></span></p>
<p><strong>Basic Usage</strong></p>
<p>To play a video file you just need to type :</p>
<pre>omxplayer myvideo.mp4</pre>
<p>If you are using HDMI you should use this command to pass audio over the HDMI interface :</p>
<pre>omxplayer -o hdmi myvideo.mp4</pre>
<p><img class="aligncenter size-full wp-image-1822" alt="HD Video With Omxplayer" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/omxplayer_hd_pi_video_pirates.jpg" width="700" height="500" /></p>
<p><strong>Other Command Line Options</strong></p>
<p>If you type :</p>
<pre>omxplayer</pre>
<p>you will be presented with a list of the available command line options :</p>
<pre>Usage: omxplayer [OPTIONS] [FILE]
Options :
-h / --help                print this help
-n / --aidx  index         audio stream index    : e.g. 1
-o / --adev  device        audio out device      : e.g. hdmi/local
-i / --info                dump stream format and exit
-s / --stats               pts and buffer stats
-p / --passthrough         audio passthrough
-d / --deinterlace         deinterlacing
-w / --hw                  hw audio decoding
-3 / --3d mode             switch tv into 3d mode (e.g. SBS/TB)
-y / --hdmiclocksync       adjust display refresh rate to match
                           video (default)
-z / --nohdmiclocksync     do not adjust display refresh rate to
                           match video
-t / --sid index           show subtitle with index
-r / --refresh             adjust framerate/resolution to video
-l / --pos                 start position (in seconds)
    --boost-on-downmix     boost volume when downmixing
    --subtitles path       external subtitles in UTF-8 srt form at
    --font path            subtitle font
                           (default: /usr/share/fonts/truetype/
                                      freefont/FreeSans.ttf)
    --font-size size       font size as thousandths of screen height
                           (default: 55)
    --align left/center    subtitle alignment (default: left)
    --lines n              number of lines to accommodate in the
                           subtitle buffer (default: 3)</pre>
<p><strong>Keyboard Shortcuts</strong></p>
<p>Here are the keyboard shortcuts that you can use to control features within the player :</p>
<pre>Space or p   Pause/Resume
q            Exit OMXPlayer
z            Show Info

-            Decrease Volume
+            Increase Volume

i            Previous Chapter
o            Next Chapter

Left Arrow   Seek -30
Right Arrow  Seek +30
Down Arrow   Seek -600
Up Arrow     Seek +600

1            Increase Speed
2            Decrease Speed

j            Previous Audio stream
k            Next Audio stream
n            Previous Subtitle stream
m            Next Subtitle stream
s            Toggle subtitles
d            Subtitle delay -250 ms
f            Subtitle delay +250 ms</pre>
<p>Omxplayer is particularly useful if you are <a title="Capturing HD Video With The Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/">creating videos with the Pi camera module</a> and want to playback the files from the command line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/06/playing-videos-on-the-raspberry-pi-command-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Setup A Web Server On Your Raspberry Pi</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/06/how-to-setup-a-web-server-on-your-raspberry-pi/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/06/how-to-setup-a-web-server-on-your-raspberry-pi/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 19:28:42 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Raspbian]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials & Help]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1705</guid>
		<description><![CDATA[This page aims to summarise the steps required to install a webserver with PHP support onto your Raspberry Pi. This will allow the Pi to server HTML and PHP pages to users on the same network. This is a useful &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/06/how-to-setup-a-web-server-on-your-raspberry-pi/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img class="alignright  wp-image-1761" alt="Lighttpd Webserver" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/lighttpd_logo-150x150.png" width="90" height="90" />This page aims to summarise the steps required to install a webserver with PHP support onto your Raspberry Pi. This will allow the Pi to server HTML and PHP pages to users on the same network. This is a useful mechanism to view images and/or data on the Pi from another device, whether that is a PC, laptop, tablet or mobile phone.</p>
<p><strong>Note :</strong> Before experimenting with network enabled features you should really make sure you have <a title="How to change the Raspberry Pi password" href="http://www.raspberrypi-spy.co.uk/2012/10/how-to-change-raspberry-pi-password/">changed your Pi password</a> from the &#8220;raspberry&#8221; default.</p>
<p><span id="more-1705"></span></p>
<h2>Step 1 &#8211; Install Lighttpd</h2>
<p>Lighttpd is a lightweight web server application that works well on the Pi. It can be installed using the following command :</p>
<pre>sudo apt-get -y install lighttpd</pre>
<h2><img class="alignright  wp-image-1763" alt="PHP" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/php_logo-150x150.png" width="90" height="90" />Step 2 &#8211; Install PHP</h2>
<p>Next we need to install PHP. The order in which php5-common, php5-cgi and php5 are installed is important so don&#8217;t change their ordering in the line below :</p>
<pre>sudo apt-get -y install php5-common php5-cgi php5</pre>
<p>Then enable the Fastcgi module which will handle the PHP pages :</p>
<pre>sudo lighty-enable-mod fastcgi-php</pre>
<p>Once these packages are installed we can restart the Lighttpd service to pick up the changes :</p>
<pre>sudo service lighttpd force-reload</pre>
<h2>Step 3 &#8211; Testing</h2>
<p>In order to test your new webserver you need to know the IP address your Pi has on your network. To do this run this command :</p>
<pre>sudo ip addr show</pre>
<p>You will see a block of information similar to this :</p>
<pre>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast
    state UP qlen 1000
    link/ether b1:11:ab:42:24:2c brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.45/24 brd 192.168.0.255 scope global eth0</pre>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/lighttpd_placeholder_page.png"><img class="size-medium wp-image-1758 alignright" alt="Lighttpd Placeholder Page" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/lighttpd_placeholder_page-300x192.png" width="300" height="192" /></a>The IP address in this example is 192.168.0.45. Take this IP address and enter it into the address bar of a web browser on another device.</p>
<p>If everything has worked you should see the default Lighttpd &#8220;Placeholder&#8221; web page. It&#8217;s not very exciting but it is easy to replace with your own page.</p>
<h2>Step 4 &#8211; Tweak Permissions</h2>
<p>Now we will adjust some permissions to ensure the &#8220;Pi&#8221; user account can write files to the location where Lighttpd expects to find web pages. The /var/www directory is currently owned by the &#8220;root&#8221; user. So let&#8217;s make the &#8220;www-data&#8221; user and group the owner of the /var/www directory.</p>
<pre>sudo chown www-data:www-data /var/www</pre>
<p>Now we will allow the &#8220;www-data&#8221; group permission to write to this directory.</p>
<pre>sudo chmod 775 /var/www</pre>
<p>Finally we can add the &#8220;Pi&#8221; user to the &#8220;www-data&#8221; group.</p>
<pre>sudo usermod -a -G www-data pi</pre>
<p>For these permissions to take effect it is best to reboot your Pi at this point using :</p>
<pre>sudo reboot</pre>
<h2>Step 5 &#8211; Replace the placeholder page</h2>
<p>Let&#8217;s browse to the /var/www directory and rename this default page :</p>
<pre>cd /var/www
mv index.lighttpd.html index.lighttpd.hxxx</pre>
<p>Now we can replace it with a new php page :</p>
<pre>sudo wget http://www.raspberrypi-spy.co.uk/archive/misc/lighttpd_test.php.txt -O /var/www/index.php</pre>
<p>The command above grabs a text file from this website, renames it as &#8220;index.php&#8221; and saves it to the /var/www directory. If you want to look at the test page first <a title="Lighttpd PHP Test Page" href="http://www.raspberrypi.org/archive/misc/lighttpd_test_page.txt" target="_blank">click here</a>.</p>
<p><strong>Note :</strong> The &#8216;-O&#8217; in the command is a capital letter O (O for Orange) not a zero or lowercase o.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/example_php_page.png"><img class="alignright size-medium wp-image-1811" alt="Example PHP Page" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/example_php_page-300x192.png" width="300" height="192" /></a>Refresh your browser and you should see the new page. If PHP is working OK you will see a summary of your PHP configuration.</p>
<p>You are now ready to populate /var/www with HTML, CSS, JS, PHP and image files just as you would for a normal website. These files could be created by your own programs which gives your projects and experiments a way to publish their data to other devices.</p>
<p>This is yet another great way for other devices to interact with your Pi.</p>
<p>If you want your Pi web server to be available on the internet (i.e. beyond your own network) you will need to follow some additional steps. I&#8217;m not covering them here but they usually involve &#8220;port forwarding&#8221; on your router to enable pages to be requested from your Pi by an external visitor.</p>
<h2>Optional Steps</h2>
<p>By default web servers communicate over port 80. If you want to change the port number that Lighttpd uses you can easily change it by editing the lighttpd.conf file :</p>
<pre>sudo nano /etc/lighttpd/lighttpd.conf</pre>
<p>then change the &#8220;server port&#8221; line to define your chosen port number  :</p>
<pre>server.port  = 40045</pre>
<p>Exit nano using CTRL-X followed by Y. To restart the server and get it to pick up this change use :</p>
<pre>sudo /etc/init.d/lighttpd restart</pre>
<p>You can now access your web server on another device on your network using :</p>
<pre>192.168.0.45:40045</pre>
<h2><a href="http://www.amazon.co.uk/exec/obidos/ASIN/1847192106/"><img class="alignright size-thumbnail wp-image-1815" alt="Lighttpd by Andre Bogus" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/amazon_lighttpd_andre_bogus-150x150.jpg" width="150" height="150" /></a>Recommended Book</h2>
<p>If you fancy reading a lot more about Lighttpd in a printed book then take a look at <a href="http://www.amazon.co.uk/exec/obidos/ASIN/1847192106/" target="_blank">&#8220;Lighttpd&#8221; by Andre Bogus</a>. This is also available as a <a href="http://www.amazon.co.uk/exec/obidos/ASIN/B005D6QDOI/" target="_blank">Kindle edition</a> as well if you prefer your reference material e-book style.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/06/how-to-setup-a-web-server-on-your-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Raspberry Pi Command Line Audio</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/#comments</comments>
		<pubDate>Wed, 05 Jun 2013 18:38:44 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials & Help]]></category>
		<category><![CDATA[aplay]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[mpg321]]></category>
		<category><![CDATA[sound]]></category>
		<category><![CDATA[wav]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1512</guid>
		<description><![CDATA[Things have moved on a bit with the Raspbian image since I wrote my Raspberry Pi Speakers &#38; Analog Sound Test post. So I decided to take another look as I wanted to start adding some audio to my experiments. &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Things have moved on a bit with the Raspbian image since I wrote my <a title="Raspberry Pi Speakers &amp; Analog Sound Test" href="http://www.raspberrypi-spy.co.uk/2012/06/raspberry-pi-speakers-analog-sound-test/">Raspberry Pi Speakers &amp; Analog Sound Test</a> post. So I decided to take another look as I wanted to start adding some audio to my experiments. I&#8217;m making slow progress with my remote controlled car project but I figured I might as well shoe-horn some audio in there as well.</p>
<p>One thing that has changed in the latest Raspian image is that the alsa sound drivers have improved and are enabled by default. So I decided to hook up a rechargeable powered speaker I had using a short 3.5mm jack plug lead and see if I could play some WAV and MP3 files.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_03.jpg"><img class="aligncenter size-medium wp-image-1776" alt="Rechargeable Powered Speaker" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_03-300x225.jpg" width="300" height="225" /></a></p>
<p><span id="more-1512"></span></p>
<p>The first thing to do is run :</p>
<pre>lsmod | grep snd_bcm2835</pre>
<p>and check snd_bcm2835 is listed. If it isn&#8217;t then run the following command :</p>
<pre>sudo modprobe snd_bcm2835</pre>
<p>If the module isn&#8217;t loaded automatically when you boot then you can force it to load by using the following process :</p>
<pre>cd /etc
sudo nano modules</pre>
<p>Then add &#8216;snd-bcm2835&#8242; so it looks like this :</p>
<pre class="brush: plain; title: ; notranslate"># /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be
# loaded at boot time, one per line. Lines beginning with &quot;#&quot; are
# ignored. Parameters can be specified after the module name.

snd-bcm2835</pre>
<p>By default the output is set to automatically select the default audio interface (HDMI if available otherwise analog). You can force it to use a specific interface using :</p>
<pre>amixer cset numid=3 n</pre>
<p>Where &lt;n&gt; is the required interface : 0=auto, 1=analog, 2=hdmi. To force the Raspberry Pi to use the analog output :</p>
<pre>amixer cset numid=3 1</pre>
<p>I usually have to do this if I boot the Pi with an HDMI cable plugged in. Otherwise it defaults to the 3.5mm jack automatically.</p>
<h2>Playing A WAV File Using aplay<strong><br />
</strong></h2>
<p>Everything should be ready to test some sound files. First up WAV. Use the following commands to grab some WAV files from my sound archive :</p>
<pre>wget http://www.freespecialeffects.co.uk/soundfx/sirens/police_s.wav
wget http://www.freespecialeffects.co.uk/soundfx/computers/bleep_01.wav</pre>
<p>To play it use :</p>
<pre>aplay police_s.wav</pre>
<p>If you are lucky the sound will play through your speakers or headphones.</p>
<h2>Playing An MP3 Using MPG321</h2>
<p>There are numerous ways to play MP3s from the command line but I tend to use MPG321. This can be installed using :</p>
<pre>sudo apt-get -y install mpg321</pre>
<p>Once installed we can grab an MP3 to experiment with :</p>
<pre>wget http://www.freespecialeffects.co.uk/soundfx/household/bubbling_water_1.mp3</pre>
<p>The MP3 file can be played using :</p>
<pre>mpg321 bubbling_water_1.mp3</pre>
<p>The volume can be adjusted using the &#8216;g&#8217; command line option. In the example below I set the volume to 50% :</p>
<pre>mpg321 -g 50 bubbling_water_1.mp3</pre>
<h2>Playing An MP3 Using Omxplayer</h2>
<p>You can also use the excellent Omxplayer to play MP3s. To get a list of options type :</p>
<pre>omxplayer</pre>
<p>It is installed by default in the latest Raspbian release but if you need to install it manually you can do so using :</p>
<pre>sudo apt-get -y install omxplayer</pre>
<p>To play a sound file you simply need to type :</p>
<pre>omxplayer bubbling_water_1.mp3</pre>
<p>The plus (+) and minus (-) keys can be used to adjust the volume of the playback.</p>
<p>This post covers basic audio playing from the command line. If you want to start playing lists of music then you should explore some of the more advanced media software available for the Pi. This includes XBMC and OpenElec.</p>
<p>In a future post I will cover playing audio within Python scripts using Pygame.</p>
<p>Here are some photos showing the rechargeable powered speaker I use for my Raspberry Pi command line audio tests :</p>

<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_01/' title='raspberry_pi_powered_speaker_01'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_01-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>
<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_03/' title='raspberry_pi_powered_speaker_03'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_03-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>
<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_02/' title='raspberry_pi_powered_speaker_02'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_02-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>
<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_04/' title='raspberry_pi_powered_speaker_04'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_04-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>
<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_06/' title='raspberry_pi_powered_speaker_06'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_06-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>
<a href='http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/raspberry_pi_powered_speaker_05/' title='raspberry_pi_powered_speaker_05'><img width="150" height="150" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/06/raspberry_pi_powered_speaker_05-150x150.jpg" class="attachment-thumbnail" alt="Rechargeable Powered Speaker" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/06/raspberry-pi-command-line-audio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://www.freespecialeffects.co.uk/soundfx/sirens/police_s.wav" length="66425" type="audio/wav" />
<enclosure url="http://www.freespecialeffects.co.uk/soundfx/computers/bleep_01.wav" length="5532" type="audio/wav" />
<enclosure url="http://www.freespecialeffects.co.uk/soundfx/household/bubbling_water_1.mp3" length="242544" type="audio/mpeg" />
		</item>
		<item>
		<title>Adding A Watermark Or Logo To A Timelapse Video Using Avconv</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/06/adding-a-watermark-or-logo-to-a-timelapse-video-using-avconv/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/06/adding-a-watermark-or-logo-to-a-timelapse-video-using-avconv/#comments</comments>
		<pubDate>Fri, 31 May 2013 23:33:24 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials & Help]]></category>
		<category><![CDATA[avconv]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[timelapse]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1738</guid>
		<description><![CDATA[The purpose of this post is to demonstrate how to add a logo to your time-lapse videos. The logo can be any graphic you can create and could easily be a watermark or text. The objective was to add my &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/06/adding-a-watermark-or-logo-to-a-timelapse-video-using-avconv/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The purpose of this post is to demonstrate how to add a logo to your time-lapse videos. The logo can be any graphic you can create and could easily be a watermark or text. The objective was to add my Raspberry Pi Spy logo to the bottom corner of a video at the same time I rendered my timelapse videos from the source images.</p>
<p>This article assume you&#8217;ve correctly <a title="Installing The Raspberry Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/">installed your camera module</a> and had a play with <a title="Taking Hi-Res Photos With The Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/">taking photos</a> with it.</p>
<p>Here is a list of the hardware and software I used :</p>
<ul>
<li>Raspberry Pi camera module connected to a Model B</li>
<li>Latest version of Raspbian on an 8GB SD card</li>
<li>Libav installed on my PC (<a href="http://libav.org/download.html" target="_blank">download here</a>)</li>
<li>Gimp installed on my PC (<a href="http://www.gimp.org/downloads/" target="_blank">download here</a>)</li>
<li>WinSCP installed on my PC (<a href="http://winscp.net/eng/download.php" target="_blank">download here</a>)</li>
</ul>
<p>Here is an example image from my sequence followed by the effect I was after with a logo in the bottom corner.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/timelapse_still.jpg"><img class="size-medium wp-image-1743 alignnone" alt="Timelapse Example - No Logo" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/timelapse_still-300x168.jpg" width="300" height="168" /></a> <a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/timelapse_still_watermark.jpg"><img class="size-medium wp-image-1744 alignnone" alt="Timelapse Example - With Logo" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/timelapse_still_watermark-300x168.jpg" width="300" height="168" /></a></p>
<p><span id="more-1738"></span></p>
<h2>Step 1 &#8211; Create time-lapse sequence</h2>
<p>To start off I needed a sequence of images so I used this command to get the Raspberry Pi camera to create an image every 30 seconds for 1 hour. This was a total of 120 images.</p>
<pre>raspistill -o timelapse_%04d.jpg -tl 30000 -t 3600000</pre>
<p>To speed things up I decided to create the video on my PC so I copied the 120 images from the Pi to the PC using WinSCP.</p>
<h2>Step 2 &#8211; Create logo overlay graphic</h2>
<p>Next I created my overlay image in <a href="http://www.gimp.org/" target="_blank">Gimp</a> that was 280&#215;280 in size and saved as a PNG file. This format is great because it allowed my logo to sit on a transparent background. This image was named &#8220;watermark.png&#8221; and copied into the same directory as the set of images from the Pi.</p>
<h2>Step 3 &#8211; Test video</h2>
<p>I used AVConv (part of the Libav library) to compile the MP4 videos. This is an alternative to using FFmpeg. This can be done on the Pi but it is much faster on the PC.</p>
<p>To get a quick feel for the video and decide on a frame rate I created an initial video using :</p>
<pre>avconv -r 5 -i timelapse_%04d.jpg
       -r 5 -vcodec libx264 -crf 20 -g 2
       -vf crop=2592:1458,scale=1280:720 timelapse.mp4</pre>
<h2>Step 4 &#8211; Final Video</h2>
<p>Once I decided the frame rate was OK it was time to re-render the video. This time I added the additional options to the AVConv command to overlay the logo on top of the video :</p>
<pre>avconv -r 5 -i timelapse_%04d.jpg
       -r 5 -vcodec libx264 -crf 20 -g 2
       -vf "movie=watermark.png [watermark];[in] crop=2592:1458,
            scale=1280:720 [cropped],[cropped][watermark]
            overlay=20:20 [out]" timelapse_logo.mp4</pre>
<p>Here is the final video complete with a brief rainbow and rain splattered window :</p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/MGdEWPPRDHo?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/06/adding-a-watermark-or-logo-to-a-timelapse-video-using-avconv/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating Timelapse Videos With The Raspberry Pi Camera</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/creating-timelapse-videos-with-the-raspberry-pi-camera/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/creating-timelapse-videos-with-the-raspberry-pi-camera/#comments</comments>
		<pubDate>Thu, 30 May 2013 08:02:01 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[avconv]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[mp4]]></category>
		<category><![CDATA[timelapse]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1675</guid>
		<description><![CDATA[In this post I will explain how I made some timelapse videos using the Raspberry Pi camera module. This is a two step process which involves getting the camera module to take a series of stills over a period of &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/creating-timelapse-videos-with-the-raspberry-pi-camera/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/Timelapse-Process.png"><img class="alignright size-thumbnail wp-image-1736" alt="Timelapse Process" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/Timelapse-Process-150x150.png" width="150" height="150" /></a>In this post I will explain how I made some timelapse videos using the Raspberry Pi camera module. This is a two step process which involves getting the camera module to take a series of stills over a period of time and then combining them into an MP4 video file.</p>
<p>We can use the &#8220;raspistill&#8221; utility to take a set of time lapsed photos as described in my <a title="Taking Hi-Res Photos With The Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/">Taking Hi-Res Photos With The Pi Camera Module</a> article. Make sure you have installed the camera and updated your operating system.</p>
<p><span id="more-1675"></span></p>
<h2>Step 1 &#8211; Taking the time-lapsed photos</h2>
<p>This command will take a photo every 60 seconds (60000 milliseconds) for 2 hours (7200000 milliseconds) resulting in a sequence of 120 images.</p>
<pre>raspistill -o myimage_%04d.jpg -tl 60000 -t 7200000</pre>
<p><!--more--></p>
<p>The &#8220;%04d&#8221; will result in a four digit number appearing in each filename.</p>
<pre>myimage_0001.jpg
myimage_0002.jpg
...
myimage_0119.jpg
myimage_0120.jpg</pre>
<h2>Step 2 &#8211; Combine images into MP4 video</h2>
<p>Once you&#8217;ve got your image sequence you will need a method to stitch them together. I decided to use &#8220;avconv&#8221;. You can install this useful library with the following command :</p>
<pre>sudo apt-get -y install libav-tools</pre>
<p>To construct the video file from your image sequence you use the command shown below. Although it appears on multiple lines for readability it should be entered as a single line on the command line :</p>
<pre>avconv -r 10 -i myimage_%04d.jpg 
       -r 10 -vcodec libx264 -crf 20 -g 15
       timelapse.mp4</pre>
<p>The video will be the full resolution of the default image size (2592&#215;1944).</p>
<p>To crop the images and create a more standard 1280&#215;720 resolution video you can use the following command :</p>
<pre>avconv -r 10 -i timelapse_%04d.jpg
       -r 10 -vcodec libx264 -crf 20 -g 15
       -vf crop=2592:1458,scale=1280:720
       timelapse.mp4</pre>
<p>The &#8220;vf&#8221; option defines a video filter. In this case two filters which crop the incoming image to 2592&#215;1458 and then scale them to 1280&#215;720.</p>
<p>The &#8220;r&#8221; option tells avconv to create a video with a frames per second of 10. It appears twice to prevent avconv dropping frames that it thinks are similar.</p>
<p>The &#8220;crf&#8221; option tells avconv to aim for a quality level of &#8220;20&#8243; which is a good starting point. Lowers values are better but will increase the file size.</p>
<p>The &#8220;-g&#8221; option sets the GOP value. The <a href="http://support.google.com/youtube/bin/answer.py?hl=en&amp;answer=1722171" target="_blank">YouTube Advanced Encoding Settings</a> page recommends that the GOP should be set to half the frame rate so this is set to 15.</p>
<p>The conversion process is very slow on the Pi compared to doing the same thing on a desktop PC. For long sequences with hundreds of frames I would recommend <a href="http://libav.org/download.html" target="_blank">downloading an appropriate version of Libav</a> on your desktop or laptop and build your MP4 files much faster!</p>
<h2>Results</h2>
<p>Here is a quick-n-dirty timelapse video I took out the window of my man-cave. It consists of 600 frames which were taken at a rate of 1 per minute for 10 hours. Nothing much happened in those 10 hours but it proved the Pi could do the job and that avconv could create the MP4. I got a PC to do the hard work!</p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/lASXBl6fY4I?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>When I&#8217;ve got the time I am going to make some more interesting timelapse videos. But that is for another day. Hopefully with better weather &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/creating-timelapse-videos-with-the-raspberry-pi-camera/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Capturing HD Video With The Pi Camera Module</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/#comments</comments>
		<pubDate>Tue, 28 May 2013 19:32:56 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[Raspbian]]></category>
		<category><![CDATA[avconv]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[mp4]]></category>
		<category><![CDATA[mp4box]]></category>
		<category><![CDATA[omxplayer]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1622</guid>
		<description><![CDATA[Not only can the Raspberry Pi camera capture photos but it can also capture full HD video at 1920&#215;1080. The official camera module has been optimised to use the full hardware media capabilities of the Pi&#8217;s processor which allows it &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-1579" title="Raspberry Pi Camera Module" alt="Raspberry Pi Camera Module" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_06-150x150.jpg" width="150" height="150" />Not only can the Raspberry Pi camera capture photos but it can also capture full HD video at 1920&#215;1080. The official camera module has been optimised to use the full hardware media capabilities of the Pi&#8217;s processor which allows it to handle video that a standard 700MHz would struggle to process.</p>
<p>To capture video you can use the &#8220;raspivid&#8221; utility. This should be available on the Pi assuming you followed my <a title="Installing The Raspberry Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/">Installing The Raspberry Pi Camera Module</a> guide and upgraded your operating system.</p>
<p><span id="more-1622"></span></p>
<p>I would recommend you use an 8GB or larger SD card as you will find the space useful once you start capturing video. Use the following command to check how much space you&#8217;ve got available :</p>
<pre>df -h</pre>
<p>This gives you something looking this example from my 8GB SD card :</p>
<pre>pi@raspberrypi ~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
rootfs          7.3G  3.4G  3.6G  49% /
/dev/root       7.3G  3.4G  3.6G  49% /
devtmpfs        180M     0  180M   0% /dev
tmpfs            38M  228K   38M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            75M     0   75M   0% /run/shm
/dev/mmcblk0p1   56M   19M   38M  33% /boot</pre>
<p>Here I&#8217;ve got over 3GB free which is enough for 30 mins for full HD video. With the default options you will need up to 115MB per minute of HD video.</p>
<p>Using &#8220;raspivid&#8221; is really easy and the following command will capture 5 seconds of footage :</p>
<pre>raspivid -o myvid.h264</pre>
<p>You want more than 5 seconds right? So you just add the &#8220;t&#8221; option and specify a time :</p>
<pre>raspivid -o myvid.h264 -t 60000</pre>
<p>This will give you 60 seconds (60000 milliseconds) of video. The default resolution is 1920&#215;1080 with a bitrate of 17Mbs giving files of 115MB per minute. To change the video resolution to 1280&#215;720 you can use :</p>
<pre>raspivid -o myvid.h264 -w 1280 -h 720</pre>
<p>and to set a custom bitrate you can use :</p>
<pre>raspivid -o myvid.h264 -w 1280 -h 720 -b 8000000</pre>
<p>where &#8220;8000000&#8243; is a bitrate of 8000Kbs (kilo bits per second) or 8Mb (8 mega bits per second). The default is usually 17000000. There is no right or wrong answer when it comes to bitrates. You have to experiment and decide what gives you an acceptable result.</p>
<p>As with <a title="Taking Hi-Res Photos With The Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/">capturing stills using raspistill</a> there are a number of other advanced options you can use.</p>
<pre>-?,   --help        : This help information
-w,   --width       : Set image width &lt;size&gt;. Default 1920
-h,   --height      : Set image height &lt;size&gt;. Default 1080
-b,   --bitrate     : Set bitrate. Use bits per second
                      (e.g. 10MBits/s would be -b 10000000)
-o,   --output      : Output filename &lt;filename&gt;
-v,   --verbose     : Output verbose information during run
-t,   --timeout     : Duration of video (in ms)
-d,   --demo        : Demo mode(cycle through range of camera
                      options, no capture)
-fps, --framerate   : Specify the frames per second to record
-e,   --penc        : Display preview image *after* encoding
                      (shows compression artifacts)
-p, --preview       : Preview window settings &lt;'x,y,w,h'&gt;
-f, --fullscreen    : Fullscreen preview mode
-n, --nopreview     : Do not display a preview window
-sh, --sharpness    : Set image sharpness (-100 to 100)
-co, --contrast     : Set image contrast (-100 to 100)
-br, --brightness   : Set image brightness (0 to 100)
-sa, --saturation   : Set image saturation (-100 to 100)
-ISO, --ISO         : Set capture ISO
-vs, --vstab        : Turn on video stablisation
-ev, --ev           : Set EV compensation
-ex, --exposure     : Set exposure mode (see Notes)
-awb, --awb         : Set AWB mode (see Notes)
-ifx, --imxfx       : Set image effect (see Notes)
-cfx, --colfx       : Set colour effect (U:V)
-mm, --metering     : Set metering mode (see Notes)
-rot, --rotation    : Set image rotation (0, 90, 180, 270)
-hf, --hflip        : Set horizontal flip
-vf, --vflip        : Set vertical flip</pre>
<p>Additional values that can be supplied for Exposure, Auto White Balance and Image Effects are shown below :</p>
<pre>Exposure  mode options  :   
off,auto,night,nightpreview,backlight,spotlight,sports,snow,beach,
verylong,fixedfps,antishake,fireworks   

AWB mode options :   
off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,
flash,horizon   

Image  Effect mode options :   
none,negative,solarise,sketch,denoise,emboss,oilpaint,h atch,
gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,
posterise,colourpoint,colourbalance,cartoon  

Metering Mode options  :   
average,spot,backlit,matrix</pre>
<p>You may need to flip and rotate your video depending on how you&#8217;ve mounted the camera module.</p>
<p>To list all available options you can type :</p>
<pre>raspivid | less</pre>
<p><strong>Convert Raw H264 Video Data To MP4</strong></p>
<p>The Pi captures video as a raw H264 video stream. This is great but many media players will refuse to play it unless it is &#8220;wrapped&#8221; in a suitable container format. Luckily it is easy to wrap the data and produce a standard MP4 video file which should play in most media players. To do this wrapping we will use MP4Box which you can install using :</p>
<pre>sudo apt-get update
sudo apt-get install -y gpac</pre>
<p>Once installed you can then use the following command to wrap your H264 video data in an MP4 container file. This will allow most media players to play the video.</p>
<pre>MP4Box -fps 30 -add myvid.h264 myvid.mp4</pre>
<p>This will give you a nice video at 30 frames per second that should play in most modern media players.</p>
<p><strong>Creating an MP4 File Using AVCONV</strong></p>
<p>It should also be possible to do this wrapping with AVCONV (an alternative to ffmpeg) but I didn&#8217;t have much luck with this method. It creates MP4 files but these weren&#8217;t recognised in most of my mediaplayers and when they were I had issues skipping through them. Here are the details for reference :</p>
<p>Install using :</p>
<pre>sudo apt-get install -y libav-tool</pre>
<p>Use this command to wrap data into MP4 container :</p>
<pre>avconv -r 30 -i myvid.h264 -vcodec copy myvid.mp4</pre>
<p>&#8220;-r 30&#8243; sets the frame rate which should be the same as the rate you used to capture the data. &#8220;-i myvid.h264&#8243; defines the input file. &#8220;-vcodec copy&#8221; makes it clear we do not want to re-encode or convert the data. &#8220;myvid.mp4&#8243; is the new output file.</p>
<p><strong>Playing Video Files With OMXPlayer</strong></p>
<p>In order to play your newly created MP4 files you can use OMXPlayer. This is installed by default on the latest Raspbian distribution but you can install manually using :</p>
<pre>sudo apt-get -y install omxplayer</pre>
<p>To play a video file you can use :</p>
<pre>omxplayer myvid.mp4</pre>
<p>To send audio via HDMI you can use :</p>
<pre>omxplayer -p -o hdmi myvid.mp4</pre>
<p>&#8230; but at this stage your video is unlikely to have any audio!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/capturing-hd-video-with-the-pi-camera-module/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Taking Hi-Res Photos With The Pi Camera Module</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/#comments</comments>
		<pubDate>Wed, 22 May 2013 20:11:06 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[time lapse]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1604</guid>
		<description><![CDATA[Taking photos with the Pi Camera Module is easy once you have plugged it in and made the correct configuration changes. In order to do this make sure you have read my Installing The Raspberry Pi Camera Module page. Once &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-1590" alt="pi_camera_module_17" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_17-150x150.jpg" width="150" height="150" />Taking photos with the Pi Camera Module is easy once you have plugged it in and made the correct configuration changes. In order to do this make sure you have read my <a title="Installing The Raspberry Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/">Installing The Raspberry Pi Camera Module</a> page.</p>
<p>Once you&#8217;ve completed the camera installation you won&#8217;t need to do it again and you can concentrate on taking photos and recording HD video.</p>
<p><span id="more-1604"></span></p>
<p><strong>Basic Photo Capture</strong></p>
<p>Capturing stills is done using the raspistill command line utiltity and is as easy as typing :</p>
<pre>raspistill -o myimage.jpg</pre>
<p><img class="alignright  wp-image-1577" alt="pi_camera_module_04" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_04-300x225.jpg" width="240" height="180" />This takes a photo which is then saved as &#8220;myimage.jpg&#8221;. By default the image is previewed on the screen and is captured after a 5 second delay. You can change the delay by using the &#8220;-t&#8221; option and supplying a time in milliseconds.</p>
<p>In the example below we take a photo with a delay of 3 seconds (3000 milliseconds) :</p>
<pre>raspistill -o myimage.jpg -t 3000</pre>
<p>This is a list of some of the more common options available when using raspistill :</p>
<pre>-?,   --help       : This help information
-w,   --width      : Set image width &lt;size&gt;
-h,   --height     : Set image height &lt;size&gt;
-q,   --quality    : Set jpeg quality &lt;0 to 100&gt;
-o,   --output     : Output filename &lt;filename&gt;
-v,   --verbose    : Output verbose information during run
-t,   --timeout    : Time (in ms) before taking picture
                    (if not specified, set to 5s)
-th,  --thumb      : Set thumbnail parameters (x:y:quality)
-d,   --demo       : Run a demo mode
-e,   --encoding   : Output format (jpg, bmp, gif, png)
-tl,  --timelapse  : Timelapse mode. Takes a picture every &lt;t&gt;ms

-p,   --preview    : Preview window settings &lt;'x,y,w,h'&gt;
-f,   --fullscreen : Fullscreen preview mode
-n,   --nopreview  : Do not display a preview window

-sh,  --sharpness  : Set image sharpness (-100 to 100)
-co,  --contrast   : Set image contrast (-100 to 100)
-br,  --brightness : Set image brightness (0 to 100)
-sa,  --saturation : Set image saturation (-100 to 100)
-ISO, --ISO        : Set capture ISO

-vs,  --vstab      : Turn on video stablisation
-rot, --rotation   : Set image rotation (90,180,270)
-hf,  --hflip      : Set horizontal flip
-vf,  --vflip      : Set vertical flip</pre>
<p>To get a full list of options that can be used type :</p>
<pre>raspistill | less</pre>
<p>Scroll using the arrow keys and press q to return to the command line.</p>
<p>Depending on how you position your camera you may need to use the &#8220;-rot&#8221; option to ensure your photos are the right way around.</p>
<p><strong>Time Lapse Photo Capture</strong></p>
<p>Another great feature of the utility is the easy capture of a series of images over a specified period of time. You could write your own software to do this but for speed you can&#8217;t beat the time lapse options provided :</p>
<pre>raspistill -o myimage_%d.jpg -tl 2000 -t 25000</pre>
<p>The -tl option sets the time between photos (in milliseconds) and the -t option sets the total time the sequence will last. So in this example a photo will be taken every two seconds (2000ms) for a total time of twenty five seconds (25000ms).</p>
<p>In this example we take a photo every minute (60000 milliseconds) for a total time of 2 hours (2 x 60 x 60 x 1000 milliseconds) :</p>
<pre>raspistill -o myimage_%d.jpg -tl 60000 -t 7200000</pre>
<p>The &#8220;%d&#8221; results in a sequence of numbered images being produced. In this case you would get images named :</p>
<pre>myimage_1.jpg
myimage_2.jpg
myimage_3.jpg
myimage_4.jpg
...</pre>
<p>If you change the &#8220;%d&#8221; to &#8220;%04d&#8221; you can pad the numbers with zeroes to always give four digits. I much prefer this as it gives you a sequence that looks like :</p>
<pre>myimage_0001.jpg
myimage_0002.jpg
myimage_0003.jpg
myimage_0004.jpg
...</pre>
<p>Much neater!</p>
<p>As I experiment with the camera I will add other posts and cover some more advanced techniques but until then have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/taking-hi-res-photos-with-the-pi-camera-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing The Raspberry Pi Camera Module</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/#comments</comments>
		<pubDate>Wed, 22 May 2013 19:55:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[camera]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1595</guid>
		<description><![CDATA[The Official Raspberry Pi camera module is here at last. The full specification can be found on my Official Raspberry Pi Camera Module page. This page aims to show how to get the camera connected and ready to go. Depending &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-1575 alignright" alt="pi_camera_module_02" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_02-150x150.jpg" width="150" height="150" />The Official Raspberry Pi camera module is here at last. The full specification can be found on my <a title="The Official Raspberry Pi Camera Module" href="http://www.raspberrypi-spy.co.uk/2013/05/the-official-raspberry-pi-camera-module/" target="_blank">Official Raspberry Pi Camera Module</a> page. This page aims to show how to get the camera connected and ready to go. Depending on the current state of your SD card this will take between 2 and 20 minutes.</p>
<p><span id="more-1595"></span></p>
<p><strong>Step 1 &#8211; Connect the camera to the Pi</strong></p>
<p>The camera ribbon cable connects to the special connector on the Pi next to the ethernet port. The easiest way to see how the cable is connected is to watch this video. It&#8217;s fairly easy you just need to be careful you don&#8217;t crease the ribbon cable.</p>
<p><a href="http://www.youtube.com/watch?v=GImeVqHQzsE">http://www.youtube.com/watch?v=GImeVqHQzsE</a></p>
<p><strong>Step 2 &#8211; Update the SD card<br />
</strong></p>
<p>In order to use the camera you must be using a recent operating system that knows that the camera exists. The easiest way to do this is to grab the latest Raspbian image from the RaspberryPi.org site and create a fresh SD card.</p>
<p>Regardless of what version of Raspbian you are using it is highly recommended to update the system using the following commands :</p>
<pre class="brush: plain; title: ; notranslate">sudo apt-get update</pre>
<pre class="brush: plain; title: ; notranslate">sudo apt-get-upgrade</pre>
<p>Depending on how up-to-date your SD card is the second process may take a while.</p>
<p><strong>Step 3 &#8211; Enable camera in raspi-config settings<br />
</strong></p>
<p>Reboot. If you are using a fresh image the raspi-config utility should load. If it doesn&#8217;t then you can run it manually using :</p>
<pre class="brush: plain; title: ; notranslate">sudo raspi-config</pre>
<p>Sekect the &#8220;Camera&#8221; option and press &#8220;Enter&#8221;.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_01.png"><img class="aligncenter size-medium wp-image-1599" alt="raspi_config_camera_01" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_01-300x171.png" width="300" height="171" /></a></p>
<p>Select &#8220;Enable&#8221; and press &#8220;Enter&#8221;.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_02.png"><img class="aligncenter size-medium wp-image-1600" alt="raspi_config_camera_02" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_02-300x171.png" width="300" height="171" /></a><br />
Select &#8220;Yes&#8221; and press &#8220;Enter&#8221;. Your Pi will reboot.</p>
<p><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_03.png"><img class="aligncenter size-medium wp-image-1601" alt="raspi_config_camera_03" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/raspi_config_camera_03-300x171.png" width="300" height="171" /></a></p>
<p>Updating your operating and enabling the camera using raspi-config did two things. It told your Pi that there is a camera attached and it added two command line utilities.</p>
<ul>
<li>raspistill</li>
<li>raspivid</li>
</ul>
<p>These allow you to capture still photos and HD video respectively.</p>
<p>You are now ready to start having fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/installing-the-raspberry-pi-camera-module/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To Disable The Red LED On The Pi Camera Module</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/how-to-disable-the-red-led-on-the-pi-camera-module/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/how-to-disable-the-red-led-on-the-pi-camera-module/#comments</comments>
		<pubDate>Sat, 18 May 2013 17:31:04 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[LED]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1636</guid>
		<description><![CDATA[The Pi camera module includes a red LED in one corner of the PCB. This lights up when the camera is active. It&#8217;s really useful in giving a visual indication that the camera is doing something and most of the &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/how-to-disable-the-red-led-on-the-pi-camera-module/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>The Pi camera module includes a red LED in one corner of the PCB. This lights up when the camera is active. It&#8217;s really useful in giving a visual indication that the camera is doing something and most of the time you will be glad it is there.</p>
<p>However there are a number of reasons you might wish it wasn&#8217;t.</p>
<p>In my testing here are some of the reasons it can get in the way :</p>
<ul>
<li><img class="size-medium wp-image-1637 alignright" alt="Pi Camera Module Red LED" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_red_led-300x169.jpg" width="300" height="169" />It can cause reflections on objects you are trying to photograph giving them a red glow.</li>
<li>For nature photography it scares animals.</li>
<li>For security applications it may draw unnecessary attention to the device.</li>
<li>It consumes power.</li>
</ul>
<p><span id="more-1636"></span></p>
<p>To disable the red LED you simply need to add the following line to your config.txt file :</p>
<pre>disable_camera_led=1</pre>
<p>To edit the config.txt file you can use Nano :</p>
<pre>sudo nano /boot/config.txt</pre>
<p>Use the arrow keys to scroll to the end of the file and add &#8220;disable_camera_led=1&#8243; to the last line. Press &#8220;CTRL-x&#8221; to quit. If prompted press &#8220;Y&#8221; followed by &#8220;Return&#8221; or &#8220;Enter&#8221;.</p>
<p>Reboot your Pi with &#8220;sudo reboot&#8221; and when you next use the camera the red LED will be disabled.</p>
<p>To enable the light again you can either use Nano to remove the line you added above or you can change it to &#8220;disable_camera_led=0&#8243;. Reboot the Pi and you will have your camera light back.</p>
<p><strong>GPIO Control</strong></p>
<p>Thanks to a hint by @TeamRaspi on Twitter I checked the schematics of the Rev 2 Pi and discovered that once disabled using the process above you can control camera LED using GPIO5. I tested this in Python and it works fine. Here is an example script that blinks the camera LED five times :</p>
<pre class="brush: python; title: ; notranslate">#!/usr/bin/env python
import time
import RPi.GPIO as GPIO

# Use GPIO numbering
GPIO.setmode(GPIO.BCM)

# Set GPIO for camera LED
CAMLED = 5

# Set GPIO to output
GPIO.setup(CAMLED, GPIO.OUT, initial=False) 

# Five iterations with half a second
# between on and off
for i in range(5):
  GPIO.output(CAMLED,True)  # On
  time.sleep(0.5)
  GPIO.output(CAMLED,False) # Off
  time.sleep(0.5)</pre>
<p>Here is a short clip showing the camera LED being turned on and off using Python :</p>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/ZPGNaFIUcSs?feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p><strong>UPDATE</strong> : Since the latest update to Raspbian the disable_camera_led feature appears to have stopped working. Hopefully it will be restored soon! The Python script still allows control of the LED.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/how-to-disable-the-red-led-on-the-pi-camera-module/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Pi Camera Module Mechanical Dimensions</title>
		<link>http://www.raspberrypi-spy.co.uk/2013/05/pi-camera-module-mechanical-dimensions/</link>
		<comments>http://www.raspberrypi-spy.co.uk/2013/05/pi-camera-module-mechanical-dimensions/#comments</comments>
		<pubDate>Fri, 17 May 2013 19:42:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Camera Module]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[dimensions]]></category>

		<guid isPermaLink="false">http://www.raspberrypi-spy.co.uk/?p=1626</guid>
		<description><![CDATA[Having played around with the Pi camera I quickly realised I needed to make some sort of stand for it. The module weighs almost nothing and is tiny so it can be quite hard to keep in one place when &#8230; <a href="http://www.raspberrypi-spy.co.uk/2013/05/pi-camera-module-mechanical-dimensions/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-1587" alt="pi_camera_module_14" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/pi_camera_module_14-150x150.jpg" width="150" height="150" />Having played around with the Pi camera I quickly realised I needed to make some sort of stand for it. The module weighs almost nothing and is tiny so it can be quite hard to keep in one place when you are experimenting. The Raspberry Pi Foundation apparently recommends <a href="http://en.wikipedia.org/wiki/Blu-Tack" target="_blank">Blu-tack</a>, based on cost, simplicity and plain, old fashioned versatility.</p>
<p>I thought it would be best to create a template that I could print out and use to create a camera holder without using the real module. That way I could get all the dimensions correct without worrying about squashing or dropping the module itself.</p>
<p>So here is a diagram showing the main module measurements.</p>
<p><span id="more-1626"></span></p>
<div id="attachment_1628" class="wp-caption aligncenter" style="width: 650px"><a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/Raspberry-Pi-Camera-Module-Diagram.png"><img class="size-large wp-image-1628" alt="Raspberry Pi Camera Module Diagram" src="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/Raspberry-Pi-Camera-Module-Diagram-853x1024.png" width="640" height="768" /></a><p class="wp-caption-text">Raspberry Pi Camera Module Diagram</p></div>
<p>The PCB is 25x24mm and is approximately 1mm thick. The distance between the reverse side of the PCB and the face of the camera is 6mm. The mounting holes will accept a 2mm machine screw according to various posts and photos I have seen.</p>
<p><strong>Printing</strong></p>
<p>You can either print the image above (click to get a bigger version) or use the <a href="http://www.raspberrypi-spy.co.uk/wp-content/uploads/2013/05/Raspberry-Pi-Camera-Module-Diagram.pdf">Raspberry Pi Camera Module Diagram PDF</a>. The image outline and the rectangle in the PDF are 50 x 60mm. You may need to set your printer driver to scale the diagram by 50% to ensure the module comes out 25mm wide.</p>
<p>If I manage to create a camera stand or mount that isn&#8217;t too embarrassing I will be sure to write an article about it and share photos.</p>
<p><strong>Disclaimer :</strong> I&#8217;ve attempted to measure and represent the measurements as best I can using a set of plastic calipers I got free on the cover of a magazine. Please check before cutting or drilling anything.</p>
<p>If there is anything incorrect please let me know and I will correct it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.raspberrypi-spy.co.uk/2013/05/pi-camera-module-mechanical-dimensions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
