<?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>gPhoto2 &#8211; Matthew Petroff</title>
	<atom:link href="https://mpetroff.net/tag/gphoto2/feed/" rel="self" type="application/rss+xml" />
	<link>https://mpetroff.net</link>
	<description>mpetroff.net</description>
	<lastBuildDate>Sat, 11 Mar 2017 23:51:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Automatic Camera Clock Synchronization under Linux</title>
		<link>https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/</link>
					<comments>https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/#comments</comments>
		
		<dc:creator><![CDATA[Matthew Petroff]]></dc:creator>
		<pubDate>Sun, 23 Aug 2015 23:35:07 +0000</pubDate>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[Canon]]></category>
		<category><![CDATA[geotagging]]></category>
		<category><![CDATA[gPhoto2]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[synchronization]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[udev]]></category>
		<guid isPermaLink="false">http://mpetroff.net/?p=1950</guid>

					<description><![CDATA[The one feature I really wish my DSLR had was geotagging. Since my camera lacks this feature, I need to record a GPS track with an external device from which positions can be extracted based on timestamps for geotagging. This &#8230; <a href="https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><span class="dropcap">T</span>he one feature I really wish my DSLR had was geotagging. Since my camera lacks this feature, I need to record a GPS track with an external device from which positions can be extracted based on timestamps <a href="https://github.com/metadirective/GPicSync">for</a> <a href="http://www.darktable.org/2012/09/geotagging-in-darktable/">geotagging</a>. This requires the camera&#8217;s clock to be set accurately, which I want anyway, but doing so manually in the camera&#8217;s menu is a bit of a pain. In the past I&#8217;ve only recorded GPS tracks for geotagging sporadically, as it required carrying around a dedicated GPS receiver. However, I finally bought a smartphone a few months ago, so I now always carry a device that&#8217;s capable of recording GPS tracks.<sup id="rf1-1950"><a href="https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/#fn1-1950" title="Transferring the recorded tracks to a computer is easier too." rel="footnote">1</a></sup> This caused me to revisit the clock synchronization problem.</p>
<p>Under Linux, <a href="http://www.gphoto.org/">gPhoto2</a> supports synchronizing the camera&#8217;s internal clock with the computer&#8217;s clock for many cameras, including mine, a Canon EOS Rebel T2i. As long as one&#8217;s computer is configured to use <a href="https://en.wikipedia.org/wiki/Network_Time_Protocol">NTP</a>, this results in quite accurate timestamps on photos. In my case, under Linux Mint 17, running this synchronization manually involves plugging in the camera, unmounting the camera after it gets automounted so gPhoto2 can access it, and then running the appropriate gPhoto2 command to synchronize the camera&#8217;s clock. To automate this process, one just needs to add a <code>udev</code> rule to run the clock synchronization command automatically, before the camera is mounted. I wrote such a rule. Since the rule responsible for mounting the camera is in <code>40-libgphoto2-6.rules</code>, the new rule that synchronizes the camera&#8217;s clock should be saved as <code>/etc/udev/rules.d/39-sync-camera-times.rules</code> so that it runs right before the camera is automounted. The contents of this file are as follows:</p>
<div class="highlighted-source default cfg">
<pre><span></span><span class="na">ACTION!</span><span class="o">=</span><span class="s">&quot;add&quot;, GOTO=&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
<span class="na">SUBSYSTEM!</span><span class="o">=</span><span class="s">&quot;usb&quot;, GOTO=&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
<span class="na">ENV{ID_USB_INTERFACES}</span><span class="o">=</span><span class="s">=&quot;&quot;, IMPORT{builtin}=&quot;usb_id&quot;</span><span class="w"></span>
<span class="na">ENV{ID_USB_INTERFACES}</span><span class="o">=</span><span class="s">=&quot;*:060101:*&quot;, RUN+=&quot;/usr/bin/gphoto2 --set-config syncdatetime=1&quot;</span><span class="w"></span>

<span class="na">LABEL</span><span class="o">=</span><span class="s">&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
</pre>
</div>
<p>Now the camera&#8217;s internal clock will be synchronized with the computer&#8217;s clock any time the camera is plugged in. Note that this sets the camera&#8217;s clock to UTC, which makes the most sense anyway as the EXIF time data doesn&#8217;t include a time zone.<sup id="rf2-1950"><a href="https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/#fn2-1950" title="In my opinion, this is a significant improvement over the automatic clock synchronization in Canon&#8217;s EOS Utility for Windows, which insists on syncing the camera&#8217;s clock to local time." rel="footnote">2</a></sup> I&#8217;ve tested the rule with a Canon EOS Rebel T2i under Linux Mint 17, but it should also work for any other camera for which gPhoto2 supports clock synchronization and under Ubuntu 14.04 and similar Linux distros. Obviously, gPhoto2 needs to be installed.</p>
<p>Edit (2017-03-11): The above no longer works on Linux Mint 18 / Ubuntu 16.04. The following contents of <code>/etc/udev/rules.d/39-sync-camera-times.rules</code> should be used instead:</p>
<div class="highlighted-source default cfg">
<pre><span></span><span class="na">ACTION!</span><span class="o">=</span><span class="s">&quot;add&quot;, GOTO=&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
<span class="na">SUBSYSTEM!</span><span class="o">=</span><span class="s">&quot;usb&quot;, GOTO=&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
<span class="na">ENV{ID_USB_INTERFACES}</span><span class="o">=</span><span class="s">=&quot;&quot;, IMPORT{builtin}=&quot;usb_id&quot;</span><span class="w"></span>
<span class="na">ENV{ID_USB_INTERFACES}</span><span class="o">=</span><span class="s">=&quot;*:060101:*&quot;, ENV{TZ}=&quot;Etc/UTC&quot;, RUN+=&quot;/usr/bin/gphoto2 --set-config datetime=now&quot;</span><span class="w"></span>

<span class="na">LABEL</span><span class="o">=</span><span class="s">&quot;sync_camera_time_rules_end&quot;</span><span class="w"></span>
</pre>
</div>
<p>For some reason, gPhoto now insists on doing a time zone conversion, which is why the time zone has to be explicitly set to UTC.</p>
<hr class="footnotes"><ol class="footnotes" style="list-style-type:decimal"><li id="fn1-1950"><p >Transferring the recorded tracks to a computer is easier too.&nbsp;<a href="https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/#rf1-1950" class="backlink" title="Return to footnote 1.">&#8617;</a></p></li><li id="fn2-1950"><p >In my opinion, this is a significant improvement over the automatic clock synchronization in Canon&#8217;s EOS Utility for Windows, which insists on syncing the camera&#8217;s clock to local time.&nbsp;<a href="https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/#rf2-1950" class="backlink" title="Return to footnote 2.">&#8617;</a></p></li></ol>]]></content:encoded>
					
					<wfw:commentRss>https://mpetroff.net/2015/08/automatic-camera-clock-synchronization-under-linux/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Content Delivery Network via Amazon Web Services: CloudFront: cdn0.mpetroff.net
Minified using Disk

Served from: mpetroff.net @ 2026-03-31 01:30:09 by W3 Total Cache
-->