<?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>Bricodage</title>
	<atom:link href="https://simon.duhem.fr/blog/feed/" rel="self" type="application/rss+xml" />
	<link>https://simon.duhem.fr/blog</link>
	<description>I wrote a script!</description>
	<lastBuildDate>Mon, 04 May 2015 21:05:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1.1</generator>
	<item>
		<title>Share a panorama on Instagram</title>
		<link>https://simon.duhem.fr/blog/lab/share-a-panorama-on-instagram/</link>
		<comments>https://simon.duhem.fr/blog/lab/share-a-panorama-on-instagram/#comments</comments>
		<pubDate>Mon, 04 May 2015 21:05:10 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[Instagram]]></category>
		<category><![CDATA[panorama]]></category>

		<guid isPermaLink="false">http://simon.duhem.fr/blog/?p=119</guid>
		<description><![CDATA[Last week, my mom tried to share a panorama picture on Instagram and here is what she shared : Pictures on Instagram are squares so it&#8217;s not adapted for a panorama. Here is a solution I already see but I it&#8217;s clearly not the right solution : So my idea was to make a video that goes from the &#8230; <a href="https://simon.duhem.fr/blog/lab/share-a-panorama-on-instagram/" class="more-link">Continue reading <span class="screen-reader-text">Share a panorama on Instagram</span></a>]]></description>
				<content:encoded><![CDATA[<p>Last week, my mom tried to share a panorama picture on Instagram and here is what she shared :</p>
<figure id="attachment_123" style="width: 300px;" class="wp-caption alignnone"><a href="http://simon.duhem.fr/blog/wp-content/uploads/965623347038236792_232640619.jpg"><img class="wp-image-123 size-medium" src="http://simon.duhem.fr/blog/wp-content/uploads/965623347038236792_232640619-300x300.jpg" alt="Instagram Picture" width="300" height="300" data-wp-pid="123" /></a><figcaption class="wp-caption-text">Instagram Picture</figcaption></figure>
<p>Pictures on Instagram are squares so it&#8217;s not adapted for a panorama.<br />
Here is a solution I already see but I it&#8217;s clearly not the right solution :</p>
<figure id="attachment_125" style="width: 300px;" class="wp-caption alignnone"><a href="http://simon.duhem.fr/blog/wp-content/uploads/20150416_175131_640.jpg"><img class="size-medium wp-image-125" title="" src="http://simon.duhem.fr/blog/wp-content/uploads/20150416_175131_640-300x300.jpg" alt="A solution" width="300" height="300" /></a><figcaption class="wp-caption-text">A solution</figcaption></figure>
<p>So my idea was to make a video that goes from the left to the right within the panorama picture.<br />
I wrote the following script using FFmpeg :</p>
<pre><small>ffmpeg -loop 1 \
-i 640.png \
-i panorama_picture.jpg \
-filter_complex "[1:v]scale=-1:640[scaled];[0:v][scaled]overlay=x='-((w-640)*t/15)':y=0[out]" -map '[out]' \
-shortest -t 15 -y \
panorama_video.mp4</small></pre>
<p>I used a 640x640px transparent PNG to set the video format and apply the filter. The panorama image is scaled at 640px height and animated during a 15 second loop.</p>
<p>Here is the result :</p>
<div class="jetpack-video-wrapper"><div style="width: 640px; " class="wp-video"><!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->
<video class="wp-video-shortcode" id="video-119-1" width="640" height="640" preload="metadata" controls="controls"><source type="video/mp4" src="http://simon.duhem.fr/blog/wp-content/uploads/output.mp4?_=1" /><a href="http://simon.duhem.fr/blog/wp-content/uploads/output.mp4">http://simon.duhem.fr/blog/wp-content/uploads/output.mp4</a></video></div></div>
]]></content:encoded>
			<wfw:commentRss>https://simon.duhem.fr/blog/lab/share-a-panorama-on-instagram/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://simon.duhem.fr/blog/wp-content/uploads/output.mp4" length="623116" type="video/mp4" />
		</item>
		<item>
		<title>Share a track on Instagram</title>
		<link>https://simon.duhem.fr/blog/lab/share-a-track-on-instagram/</link>
		<comments>https://simon.duhem.fr/blog/lab/share-a-track-on-instagram/#comments</comments>
		<pubDate>Sun, 22 Feb 2015 19:58:37 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Lab]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[Instagram]]></category>
		<category><![CDATA[lab]]></category>

		<guid isPermaLink="false">http://simon.duhem.fr/blog/?p=64</guid>
		<description><![CDATA[I discovered the SOUNDS. app through this Ed Banger Instagram post. I&#8217;m currently working at Deezer and so I instantly wanted to do the same thing using our API. FFmpeg The idea is to create a video by combining an audio file with an image and it looks like the easiest way to do it is to use FFmpeg. I quickly &#8230; <a href="https://simon.duhem.fr/blog/lab/share-a-track-on-instagram/" class="more-link">Continue reading <span class="screen-reader-text">Share a track on Instagram</span></a>]]></description>
				<content:encoded><![CDATA[<p>I discovered the <a title="SOUNDS. App | Instasound and Snapsound | Discover and Share Music on Instagram &amp; Snapchat" href="https://www.soundsapp.co/">SOUNDS. app</a> through <a title="ED BANGER / BUSY P (@edrec) • Instagram photos and videos" href="http://instagram.com/p/t-CfRSPzWn/?modal=true">this Ed Banger Instagram post</a>. I&#8217;m currently working at <a title="Deezer - Encore plus de musique à découvrir" href="http://www.deezer.com/">Deezer</a> and so I instantly wanted to do the same thing using <a title="Deezer for developers" href="http://developers.deezer.com/api/">our API</a>.</p>
<h3>FFmpeg</h3>
<p>The idea is to create a video by combining an audio file with an image and it looks like the easiest way to do it is to use <a title="FFmpeg" href="https://www.ffmpeg.org/">FFmpeg</a>.<br />
I quickly found <a title="ffmpeg: 1 image + 1 audio file = 1 video - Stack Overflow" href="http://stackoverflow.com/questions/5887311/ffmpeg-1-image-1-audio-file-1-video">a topic on Stack Overflow</a> with the solution.</p>
<p>FFmpeg was already installed on my server but the version was too old to make it work. I even tried to <a title="Deb Multimedia Packages::Home" href="http://www.deb-multimedia.org/">update it</a>&#8230;<br />
The good thing is FFmpeg provides <a title="FFmpeg Static Builds" href="http://johnvansickle.com/ffmpeg/">static builds</a>, so I used this solution instead and it works fine.</p>
<h4>Optimization</h4>
<p>When I looked at the file generation log I noticed the frame rate was around 25 fps which is not logical, since we are using one image for the whole video.<br />
With the option <strong>-r</strong> you can set the frame rate to get one frame for the whole video. e.g. -r 0.033 for a 30s video (1/30).<br />
In my case my file went from 1093kB to 655kB.  It saves 40% !</p>
<p>Here is my final command line :</p>
<pre>ffmpeg \
-loop 1 -i INPUT_IMAGE_FILE.jpg \
-i INPUT_AUDIO_FILE.mp3 \
-strict experimental -c:a aac -b:a 128k \
-c:v libx264 -tune stillimage -pix_fmt yuv420p -r 0.033 \
-shortest -t 30 -y \
OUTPUT_VIDEO_FILE.mp4</pre>
<h3>Deezer API</h3>
<p>Now that I knew how to generate the video, I just had to do it with the Deezer API. All I had to do was get the album image cover and the mp3 preview for the desired track, which is all stored in t<a title="Deezer API - track" href="http://developers.deezer.com/api/track">he Deezer track object</a>.</p>
<p>So <a title="smndhm/sound-image" href="https://github.com/smndhm/sound-image">I wrote a script</a> to create the video simply by giving the Deezer track ID.<br />
It&#8217;s available on my GitHub where I explain how it works.</p>
<p>→ <a href="http://simon.duhem.fr/lab/sound-image/api.php?track_id=89697477">See JSON response</a> | <a href="http://simon.duhem.fr/lab/sound-image/static/video/55d394255962c20ba2a4b987c98afd82.mp4">video file</a><br />
→ <a title="smndhm/sound-image" href="https://github.com/smndhm/sound-image">Get it on GitHub</a>.</p>
<h4>Limitations</h4>
<p>I now have an API like script that creates a video based on the Deezer track ID.</p>
<p>But this is where I stopped.  I could not find a way to share the generated video.<br />
The Instagram API doesn&#8217;t provide a method to publish media. It&#8217;s only possible through the app.</p>
<p>To share my video on Instagram I had to generate it from my desktop, download the file, send it by email to myself, and save it on my phone from the mail app. Now it&#8217;s ready to be shared from my phone&#8217;s camera roll&#8230; Sigh.</p>
<h3>Next step</h3>
<p>For me, the next step would be to create an iOS or Android app to make this script useful. I&#8217;m not going to do it, but if someone is interested let me know&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>https://simon.duhem.fr/blog/lab/share-a-track-on-instagram/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://simon.duhem.fr/lab/sound-image/static/video/55d394255962c20ba2a4b987c98afd82.mp4" length="503836" type="video/mp4" />
		</item>
		<item>
		<title>Download friends&#8217; Instagram pictures</title>
		<link>https://simon.duhem.fr/blog/lab/download-friends-instagram-pictures/</link>
		<comments>https://simon.duhem.fr/blog/lab/download-friends-instagram-pictures/#comments</comments>
		<pubDate>Wed, 11 Feb 2015 22:55:18 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[Instagram]]></category>
		<category><![CDATA[lab]]></category>

		<guid isPermaLink="false">http://simon.duhem.fr/blog/?p=66</guid>
		<description><![CDATA[This Christmas my wife and I wanted to offer an album with our Instagram pictures.  You can find websites that let you import your own Instagram pictures but won&#8217;t let you import other users&#8217; pictures.  This is such a shame, since my wife and I both have so many pictures of our kids&#8230; But the thing is, &#8230; <a href="https://simon.duhem.fr/blog/lab/download-friends-instagram-pictures/" class="more-link">Continue reading <span class="screen-reader-text">Download friends&#8217; Instagram pictures</span></a>]]></description>
				<content:encoded><![CDATA[<p>This Christmas my wife and I wanted to offer an album with our Instagram pictures.  You can find websites that let you import your own Instagram pictures but won&#8217;t let you import other users&#8217; pictures.  This is such a shame, since my wife and I both have so many pictures of our kids&#8230;</p>
<p>But the thing is, these websites get your user token through the Instagram authentication, and with this same token, we can get access to the media of the users you follow.</p>
<p>So to get to my wife&#8217;s pictures, <a title="Instagram | Lab | Simon Duhem" href="http://simon.duhem.fr/lab/instagram/">I wrote a script</a> ! <img src="https://simon.duhem.fr/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" />  It&#8217;s available on my lab, and with it, you will be able to download your own pictures as well as those of your friends.</p>
<p>→ <a title="Instagram | Lab | Simon Duhem" href="http://simon.duhem.fr/lab/instagram/">Try the script</a>.</p>
<p><strong>All generated zip files are deleted hourly.</strong></p>
]]></content:encoded>
			<wfw:commentRss>https://simon.duhem.fr/blog/lab/download-friends-instagram-pictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How should I re-arrange my Instagram filters</title>
		<link>https://simon.duhem.fr/blog/lab/how-should-i-re-arrange-my-instagram-filters/</link>
		<comments>https://simon.duhem.fr/blog/lab/how-should-i-re-arrange-my-instagram-filters/#comments</comments>
		<pubDate>Fri, 23 Jan 2015 14:39:44 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[Instagram]]></category>
		<category><![CDATA[lab]]></category>

		<guid isPermaLink="false">http://simon.duhem.fr/blog/?p=7</guid>
		<description><![CDATA[Since filters can now be organized on Instagram, I put &#8216;Mayfair&#8217; and &#8216;X-Pro II&#8217; at the top of my list because I knew those were the ones I used the most. Then I started wondering which filters I should put after them. So I added an Instagram extension to my PHP OAuth classes and wrote a &#8230; <a href="https://simon.duhem.fr/blog/lab/how-should-i-re-arrange-my-instagram-filters/" class="more-link">Continue reading <span class="screen-reader-text">How should I re-arrange my Instagram filters</span></a>]]></description>
				<content:encoded><![CDATA[<p>Since <a href="http://blog.instagram.com/post/105365538947/141216-five-new-filters">filters can now be organized on Instagram</a>, I put &#8216;Mayfair&#8217; and &#8216;X-Pro II&#8217; at the top of my list because I knew those were the ones I used the most. Then I started wondering which filters I should put after them.</p>
<p>So I added an Instagram extension to my <a title="smndhm/php-oauth" href="https://github.com/smndhm/php-oauth">PHP OAuth classes</a> and wrote <a title="Instagram | Lab | Simon Duhem" href="http://simon.duhem.fr/lab/instagram/">a script</a> which gives me the order of which filters I&#8217;m using the most.<br />
You can try it &#8211; you just have to connect to your Instagram account and accept permissions.</p>
<p>→ <a title="Instagram | Lab | Simon Duhem" href="http://simon.duhem.fr/lab/instagram/">Try the script</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://simon.duhem.fr/blog/lab/how-should-i-re-arrange-my-instagram-filters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello blog!</title>
		<link>https://simon.duhem.fr/blog/news/hello-blog/</link>
		<comments>https://simon.duhem.fr/blog/news/hello-blog/#comments</comments>
		<pubDate>Thu, 08 Jan 2015 13:53:24 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://simon.duhem.fr/blog/?p=1</guid>
		<description><![CDATA[I started 2015 by making some simple scripts using the Instagram API, the Imagick PHP extension, and FFmpeg.  I found it interesting and it made me want to share them&#8230; Which is why I am starting this blog !]]></description>
				<content:encoded><![CDATA[<p>I started 2015 by making some simple scripts using the <a title="Instagram Developer Documentation" href="http://instagram.com/developer/">Instagram API</a>, the <a title="PHP: ImageMagick - Manual" href="http://php.net/manual/en/book.imagick.php">Imagick</a> PHP extension, and <a title="FFmpeg" href="https://www.ffmpeg.org/">FFmpeg</a>.  I found it interesting and it made me want to share them&#8230;</p>
<p>Which is why I am starting this blog ! <img src="https://simon.duhem.fr/blog/wp-includes/images/smilies/icon_wink.gif" alt=";)" class="wp-smiley" /></p>
]]></content:encoded>
			<wfw:commentRss>https://simon.duhem.fr/blog/news/hello-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
