{"id":4610,"date":"2024-04-28T12:00:49","date_gmt":"2024-04-28T19:00:49","guid":{"rendered":"https:\/\/www.cloudacm.com\/?p=4610"},"modified":"2024-04-27T09:54:34","modified_gmt":"2024-04-27T16:54:34","slug":"360-tiled-video-with-ffmpeg","status":"publish","type":"post","link":"https:\/\/www.cloudacm.com\/?p=4610","title":{"rendered":"360 Tiled Video with FFMpeg"},"content":{"rendered":"<p>This post will expand on the topic of tiling video that was covered in this post, <a href=\"https:\/\/www.cloudacm.com\/?p=3026\">https:\/\/www.cloudacm.com\/?p=3026<\/a>.\u00a0 The video sourced in this post are directional and is well suited for creating a 360 degree view of surroundings.<\/p>\n<p><iframe loading=\"lazy\" title=\"FFMpeg Video Tiling\" src=\"https:\/\/player.vimeo.com\/video\/934517508?dnt=1&amp;app_id=122963\" width=\"640\" height=\"274\" frameborder=\"0\" allow=\"autoplay; fullscreen; picture-in-picture; clipboard-write; gyroscope; accelerometer\"><\/iframe><\/p>\n<p>The original video from each camera is 1080p, so the first step in this example is to reduce the resolution to 25 percent.\u00a0 This command was run to make that adjustment.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\">### Resize videos to 1\/4 of original ###\r\nffmpeg -i DriverSide_Original.MOV -vf \"scale=iw*.25:ih*.25\" DriverSide.MOV\r\nffmpeg -i Front_Original.MOV -vf \"scale=iw*.25:ih*.25\" Front.MOV\r\nffmpeg -i PassengerSide_Original.MOV -vf \"scale=iw*.25:ih*.25\" PassengerSide.MOV\r\nffmpeg -i Rear_Original.MOV -vf \"scale=iw*.25:ih*.25\" Rear.MOV<\/pre>\n<p>Since these will be tiled videos, there will be gaps and overlaps from each.\u00a0 To make the viewing a bit easier to watch, a black frame was created around each of the videos with the following command.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\">###   Drawing a black frame around each video   ###\r\n\r\nffmpeg -i DriverSide.MOV -vf drawbox=x=0:y=0:w=480:h=270:t=1:color=black@1 EXP2_BOX_DriverSide.MOV\r\nffmpeg -i Front.MOV -vf drawbox=x=0:y=0:w=480:h=270:t=1:color=black@1 EXP2_BOX_Front.MOV\r\nffmpeg -i PassengerSide.MOV -vf drawbox=x=0:y=0:w=480:h=270:t=1:color=black@1 EXP2_BOX_PassengerSide.MOV\r\nffmpeg -i Rear.MOV -vf drawbox=x=0:y=0:w=480:h=270:t=1:color=black@1 EXP2_BOX_Rear.MOV<\/pre>\n<p>Now the videos can be tiled to create a single video with the full view.\u00a0 This command was used.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bash\">###   Side by side of Rear and DriverSide   ###\r\n\r\nffmpeg -i \"EXP2_BOX_Rear.MOV\" -vf \"[in] scale=iw:ih, pad=2*iw:ih [left];movie=EXP2_BOX_DriverSide.MOV, scale=iw:ih [right]; [left][right] overlay=main_w\/2:0 [out]\" \"EXP2_BOX_RearDriverSide.MOV\"\r\n\r\n###   Side by side of Front and PassengerSide   ###\r\n\r\nffmpeg -i \"EXP2_BOX_Front.MOV\" -vf \"[in] scale=iw:ih, pad=2*iw:ih [left];movie=EXP2_BOX_PassengerSide.MOV, scale=iw:ih [right]; [left][right] overlay=main_w\/2:0 [out]\" \"EXP2_BOX_FrontPassengerSide.MOV\"\r\n\r\n###   Full round   ###\r\n\r\nffmpeg -i \"EXP2_BOX_RearDriverSide.MOV\" -vf \"[in] scale=iw:ih, pad=2*iw:ih [left];movie=EXP2_BOX_FrontPassengerSide.MOV, scale=iw:ih [right]; [left][right] overlay=main_w\/2:0 [out]\" \"EXP2_BOX_FullRound.MOV\"\r\n<\/pre>\n<p>The cameras also have audio which was edited in Audacity to represent their left, center, or right positions.\u00a0 This command was used to add the audio file to the video.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\">###   Replace audio in final video from combined camera audio   ###\r\n\r\nffmpeg -i \"EXP2_BOX_FullRound.MOV\" -i \"Drive.wav\" -c:v copy -map 0:v:0 -map 1:a:0 \"EXP3_AUDIO_FullRound.MOV\"<\/pre>\n<p>Adding to video to Vimeo required some additional work to allow the platform to represent it as a 360 degree video.\u00a0 Refer to Vimeo&#8217;s help article on what these steps are.\u00a0 At the time of this post, this link provided those details, <a href=\"https:\/\/help.vimeo.com\/hc\/en-us\/articles\/12426105907729-Upload-360-video\">https:\/\/help.vimeo.com\/hc\/en-us\/articles\/12426105907729-Upload-360-video<\/a>.\u00a0 Since the processed video thus far has a resolution of 1920 x 270, padding was needed so the final video had a 2:1 projection ratio with 1920 x 1080 being the final resolution.\u00a0 This command was used to add the padding.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"bat\">###   Pad video to support Vimeo 360 projection   ###\r\n\r\nffmpeg -i \"EXP3_AUDIO_FullRound.MOV\" -vf \"pad=width=1920:height=1080:x=0:y=405:color=black\" \"EXP4_360_FullRound.MOV\"<\/pre>\n<p>Tiling video with FFMpeg is a simple method to create 360 degree videos from low cost cameras.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post will expand on the topic of tiling video that was covered in this post, https:\/\/www.cloudacm.com\/?p=3026.\u00a0 The video sourced in this post are directional and is well suited for creating a 360 degree view of surroundings. The original video from each camera is 1080p, so the first step in this example is to reduce the resolution to 25 percent.\u00a0 This command was run to make that adjustment. ### Resize videos to 1\/4 of original ### ffmpeg -i DriverSide_Original.MOV -vf&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/www.cloudacm.com\/?p=4610\"> 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":[1],"tags":[],"class_list":["post-4610","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/4610","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=4610"}],"version-history":[{"count":13,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/4610\/revisions"}],"predecessor-version":[{"id":4612,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=\/wp\/v2\/posts\/4610\/revisions\/4612"}],"wp:attachment":[{"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4610"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4610"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloudacm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4610"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}