{"id":3055,"date":"2017-08-07T00:00:03","date_gmt":"2017-08-07T07:00:03","guid":{"rendered":"http:\/\/192.168.3.4\/?p=3055"},"modified":"2018-01-09T06:51:50","modified_gmt":"2018-01-09T14:51:50","slug":"ffmpeg-time-lapse-and-slow-motion","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=3055","title":{"rendered":"FFMpeg Time Lapse and Slow Motion"},"content":{"rendered":"<p>Interpolation doesn&#8217;t just slow down, speed up, or increases FPS for better overall appearance.<br \/>\nIt fills in the gaps between frames by mathematically guessing were pixels belong between each frame. Here is a source clip that I&#8217;ll be processing.<\/p>\n<p><iframe loading=\"lazy\" title=\"FFMpeg Pre Interpolation Source\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/A3MJKdTp9yQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>This command increases a 18 second segment from 30 FPS to 120 FPS<\/p>\n<pre>ffmpeg -ss 00:47:08 -i 201207140948.MOV -t 00:00:18 -c copy 201207140948_Seg.MOV\r\nffmpeg -i 201207140948_Seg.MOV -vf minterpolate=fps=120 201207140948_Seg_120fps.MOV\r\n<\/pre>\n<p><iframe loading=\"lazy\" title=\"FFMpeg Interpolation at 120 FPS\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/E4_0snRTJe8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>The results look the same at first glance, but when viewed intently, there are details not available in the original. The video looks more live.\u00a0 However, uploading it to the internet introduces some losses, so you&#8217;ll just have to take my word for it.<\/p>\n<p>Now, lets slow motion it down so it runs 1\/4th the original speed (thanks <a href=\"http:\/\/blog.grio.com\/2012\/01\/fast-and-slow-motion-video-with-ffmpeg.html\">http:\/\/blog.grio.com\/2012\/01\/fast-and-slow-motion-video-with-ffmpeg.html<\/a> and <a href=\"https:\/\/trac.ffmpeg.org\/wiki\/How%20to%20speed%20up%20\/%20slow%20down%20a%20video\">https:\/\/trac.ffmpeg.org\/wiki\/How%20to%20speed%20up%20\/%20slow%20down%20a%20video<\/a>)<\/p>\n<pre>ffmpeg -i 201207140948_Seg_120fps.MOV -vf setpts=4*PTS -an 201207140948_Seg_30fps.MOV\r\n<\/pre>\n<p><iframe loading=\"lazy\" title=\"FFPmeg Interpolation Slow Motion\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/F7u3KI_vDjM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>Here you can see some of the artifacts introduced with the interpolation. If we were to slow down the original, we would notice the motion gaps between each frame captured by the camera. This allows us to electronically make up the missing frames and create a more smooth appearance.<\/p>\n<p>Now lets speed things up so the entire 1 hour 10 minute video runs for 15 seconds. The PTS variable is multiplied by a fraction of the original, 70 minutes or 4200 second clip. Since I want to end up with 15 seconds as a result I divide the 4200\/15 to get my 280 value below. This is basiclly saying make my output 1\/280 the length of the original.<\/p>\n<pre>ffmpeg -i 201207140948.MOV -vf setpts=1\/280*PTS -an 201207140948_RealFast.MOV\r\n<\/pre>\n<p><iframe loading=\"lazy\" title=\"FFMpeg Time Lapse\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/_TlY4qitbfI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<p>FFMPeg&#8217;s interpolation feature make it a contender against other commercial products I&#8217;ve used in the past. The scripting function and community support put it out ahead.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Interpolation doesn&#8217;t just slow down, speed up, or increases FPS for better overall appearance. It fills in the gaps between frames by mathematically guessing were pixels belong between each frame. Here is a source clip that I&#8217;ll be processing. This command increases a 18 second segment from 30 FPS to 120 FPS ffmpeg -ss 00:47:08 -i 201207140948.MOV -t 00:00:18 -c copy 201207140948_Seg.MOV ffmpeg -i 201207140948_Seg.MOV -vf minterpolate=fps=120 201207140948_Seg_120fps.MOV The results look the same at first glance, but when viewed intently,&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=3055\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,6,3],"tags":[],"class_list":["post-3055","post","type-post","status-publish","format-standard","hentry","category-computer-vision","category-raspberry-pi","category-rd"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3055","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3055"}],"version-history":[{"count":5,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3055\/revisions"}],"predecessor-version":[{"id":3060,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/3055\/revisions\/3060"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}