{"id":2741,"date":"2015-01-02T16:00:05","date_gmt":"2015-01-02T16:00:05","guid":{"rendered":"http:\/\/johnjohnston.info\/blog\/?p=2741"},"modified":"2022-12-19T20:15:18","modified_gmt":"2022-12-19T20:15:18","slug":"flickr-2014-and-diy-pummelvision","status":"publish","type":"post","link":"https:\/\/johnjohnston.info\/blog\/flickr-2014-and-diy-pummelvision\/","title":{"rendered":"Flickr 2014 and DIY pummelvision"},"content":{"rendered":"<p><iframe loading=\"lazy\" src=\"\/\/player.vimeo.com\/video\/115794075\" width=\"640\" height=\"480\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>A few years back I used pummelvision to make <a href=\"https:\/\/vimeo.com\/18003815\">a video of all of my flickr photos<\/a>. Pummelvision was an online service where you pointed it to your flickr stream and it built a video for you and posted to vimeo. It could also take input from tumblr and facebook.<\/p>\n<p>I though it might be interesting to make a similar video for my photos this year. However going to look for pummelvision drew a blank, the company had closed. I then though It might be interesting to try to create a similar video. From my memory and looking at my old video, pummelvision made a video with no transitions and very fast. As far as I remember it just used one tune. I downloaded my old video from vimeo and extracted the audio file using QuickTime pro. I took a guess that the frame rate was about 6 photos per second.<\/p>\n<h3>Grabbing the images<\/h3>\n<p>I guess there a few ways to grab all your photos from flickr, but this is how I did it. If I was doing it frequently I&#8217;d look into automating it, but this was a once off, or once a year if I do it again.<\/p>\n<p>Flickr&#8217;s api would allow you to do this, but it seemed a bit excessive to try and write a pile of code. The Flickr API has a section to test all of the command so I headed to: <a href=\"https:\/\/www.flickr.com\/services\/api\/explore\/flickr.photos.search\">Flickr Api Explorer &#8211; flickr.photos.search<\/a>. There I put my own user ID in, set the min_date_taken and max_date_taken, increased the per_page to 500 and added the large photo url to the extras field.<\/p>\n<p>This produced an xml file will all the information:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/johnjohnston.info\/blog\/wp-content\/uploads\/2015\/01\/flickr_xml.png\" alt=\"Flickr xml\" width=\"620\" height=\"300\" \/><\/p>\n<p>I then extracted the 397 urls from the text. There will be many ways to do this, but I am experimenting with the Sublime Text application at the moment, it found &amp; selected all of the https: occurrences and the with cmd-shift-right arrow expanded the selection to the quotes. One copy got all of the files!<\/p>\n<p>Once I had a list of urls I edit those so that each line was:<\/p>\n<p><code> curl \"https:\/\/farm4.staticflickr.com\/3897\/14598292323_ae6462fa07_b.jpg\" &gt;  image_183.jpg<\/code><\/p>\n<p>With the numbers out the image sequential and padded to 3 characters, eg image_001.jpg, image 002.jpg etc. I also numbered then in reverse so the oldest photo would be first.<\/p>\n<p>I saved this text as a file, dl.sh and moved into the terminal:<\/p>\n<pre><code>cd path\/to\/thefolder\nchmod +x dl.sh\n.\/dl.sh<\/code><\/pre>\n<p>This code set the dl.sh file to executable and then ran it, the terminal filled with text and the folder with images. Curl is the command-line tool for downloading files.<\/p>\n<h3>Sizing images<\/h3>\n<p>Downloading the large size gave a folder full of images but some where landscape and some portrait, ie 1024\u2006\u00d7\u2006768 or 768 x1024\u2006I need the images to all be the same size. So i used the sips utility to first resize them, <code>sips --resampleHeight 768 *.jpg<\/code>, then to pad the portrait ones: <code>sips --padToHeightWidth 786 1024 *.jpg<\/code><\/p>\n<p>Which gives me pictures like this for the portrait ones:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/johnjohnston.info\/blog\/wp-content\/uploads\/2015\/01\/img_076_toad.jpg\" alt=\"Img 076 toad\" width=\"100%\" \/><\/p>\n<h3>Making the movie<\/h3>\n<p>I discounted using iMove, moviemaker or the like as I wanted something quick (not necessary quick this time&#8230;) and that could be automated. I am also not sure in iMovie can show as fast as 6 per second. (Update, a quick look shows iMove can set speed to fractions of a second per frame.)<\/p>\n<p>I though of a couple of ways to make the move, using Quicktime pro or ffmpeg. Quicktime pro proved the easiest option, opened the app and <strong>File<\/strong> -&gt; <strong>Open Image sequence&#8230;<\/strong>, choose 6 frames per second, then all I had to do was save the movie.<\/p>\n<p>Unfortunately Quicktime pro has been replace by Quicktime and it is a <a title=\"Lion Tips | John's World Wide Wall Display\" href=\"http:\/\/johnjohnston.info\/blog\/lion-tips\/\">bit of a bother<\/a> to get your old QT pro working if you had paid for a license. So I though I&#8217;d figure out ffmpeg too.<\/p>\n<h3>With great power comes great complexity<\/h3>\n<p><a href=\"https:\/\/www.ffmpeg.org\/\">FFmpeg<\/a> is <em>A complete, cross-platform solution to record, convert and stream audio and video.<\/em> It is a command line application and has a lot of variables. I can usually find out the right command with a bit of google. This one took quite a lot of google and failures. Most of these failures came from me trying to set a framerate, which lead to skipped frames. Eventually I dropped the idea of using the framerate options and got a very (too) fast video with this:<\/p>\n<p><code>ffmpeg -f image2  -i IMG_%03d.jpg  -c:v libx264 -pix_fmt yuv420p  out.mp4<\/code><\/p>\n<p>Note to self, in the -i, iput option IMG_%03d.jpg means all the images with 3 numerals, eg 001, 002&#8230; 375<\/p>\n<p>I then slowed it down a little with this:<\/p>\n<p><code>ffmpeg -i out.mp4 -filter:v \"setpts=4.0*PTS\" 2014-flickr-show.mp4<\/code><\/p>\n<p>And added the audio:<\/p>\n<p><code>ffmpeg -i 2014-flickr-show.mp4 -i pum.mp3 -map 0 -map 1 -codec copy  -codec:a aac -strict experimental -b:a 192k  -shortest 2014-flickr-show-audio.mp4<\/code><\/p>\n<p>It took a fair bit of google to get the audio right too, the <em>-codec:a<\/em> option seems to sort things out.<\/p>\n<h3>Whys and Wherefores<\/h3>\n<p>As noted above, I could have done most of this with iMovie. But by using ffmpeg or QT pro, I&#8217;ve the opportunity to play, learn and possibly end up with an automated system. It would seem well within the realms of possibility to have a script that used the flickr api to download a bunch of images, perhaps for a year or with a tag and make a movie from them.<\/p>\n<p>I&#8217;ve now figured out how to do most of this by piecing together the above fragments and finding out a bit about loops and renaming files, but I&#8217;ve no idea of how to create a bash script that will replace my hard coded tags, usernames ect with input, more to learn.<\/p>\n<h3>Once you have a lot of jpgs<\/h3>\n<p>You might as well do other things with them: <a title=\"Flickr 2014 by John Johnston, on Flickr\" href=\"https:\/\/www.flickr.com\/photos\/troutcolor\/15981810668\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/farm9.staticflickr.com\/8625\/15981810668_ceba95f3dd_z.jpg\" alt=\"Flickr 2014\" width=\"640\" height=\"480\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few years back I used pummelvision to make a video of all of my flickr photos. Pummelvision was an online service where you pointed it to your flickr stream and it built a video for you and posted to vimeo. It could also take input from tumblr and facebook. I though it might be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[443,639,88,1609,80,442,84],"post_format":[],"class_list":{"0":"post-2741","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-wwwd","7":"tag-bash","8":"tag-ffmpeg","9":"tag-flickr","10":"tag-flickr-year","11":"tag-fun","12":"tag-shell","13":"tag-video","14":"kind-article","16":"h-entry","17":"hentry"},"better_featured_image":null,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p57zFQ-Id","jetpack_likes_enabled":false,"jetpack_sharing_enabled":true,"kind":false,"_links":{"self":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/2741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/comments?post=2741"}],"version-history":[{"count":5,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/2741\/revisions"}],"predecessor-version":[{"id":17426,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/posts\/2741\/revisions\/17426"}],"wp:attachment":[{"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/media?parent=2741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/categories?post=2741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/tags?post=2741"},{"taxonomy":"post_format","embeddable":true,"href":"https:\/\/johnjohnston.info\/blog\/wp-json\/wp\/v2\/post_format?post=2741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}