Gear 360 - Converting Spherical 360 video

Published: Jan 5, 2023 by Isaac Johnson

This is just a quick how-to since Samsung has seemingly abondened the Gear360.

I downloaded the Gear 360 Active Director software to my host.

However, in all cases, it renders just black. Perhaps an older CPU or different OS would work.

/content/images/2023/01/samsung360-01.png

Using Linux

I’m mostly following this guide with a few tweaks.

I pulled the videos off the camera with a Micro-USB cable and put them in all in C:/RAW360.

Our videos are spherical left right 360 videos as such:

/content/images/2023/01/samsung360-02.png

I needed to create a map image for remapping.

$ git clone https://github.com/raboof/dualfisheye2equirectangular.git
$ cd dualfisheye2equirectangular/
$ gcc -o projection projection.c -lm

# create the mapping files
$ ./projection -x xmap_dokicam_video.pgm -y ymap_dokicam_video.pgm -h 1280 -w 2560 -r 1280 -c 2560 -b 35 -m samsung_gear_360

Should you have trouble creating them yourself, I put a copy here: xmap_dokicam_video.zip

FFMpeg

The FFMpeg bundled with Ubuntu is too old for some features. I ended up downloading the latest from their static builds

$ cd /tmp
$ cp /mnt/c/Users/isaac/Downloads/ffmpeg-release-amd64-static.tar.xz ./
$ tar xvf ffmpeg-release-amd64-static.tar.xz
$ sudo mv ffmpeg-5.1.1-amd64-static /usr/local/
$ sudo mv /usr/bin/ffmpeg /usr/bin/ffmpeg.old
$ sudo ln -s /usr/local/ffmpeg-5.1.1-amd64-static/ffmpeg /usr/local/bin/ffmpeg
$ ffmpeg version
ffmpeg version 5.1.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  ...

The next step is to take the spherical video and convert it

$ ffmpeg -i /mnt/c/RAW360/360_0243.MP4 -i xmap_dokicam_video.pgm -i ymap_dokicam_video.pgm -filter_complex remap /mnt/c/RAW360/360_0243b.MP4

/content/images/2023/01/samsung360-03.png

Note: if you had the camera sideways, you might need to “roll” it so they are really left/right.. you can see an old forum post here, but essentially you just add ‘roll’ to your video filter; e.g. -vf v360=dfisheye:e:ih_fov=189:iv_fov=189:roll=-90

I needed to rotate (since I pushed the camera down the ice fishing hole upside down)

$ ffmpeg -i /mnt/c/RAW360/360_0243b.MP4 -vf "transpose=1, transpose=1" /mnt/c/RAW360/360_0243c.MP4

Note: there are two common ways to rotate; either rotate 90, then again ie. -vf "transpose=1, transpose=1" or 180d (e.g. -vf "rotate=PI:bilinear=0"). You can read a lot more on this here

I’ll then chain them between 3 folders.

$ cd /mnt/c/RAW360/ && find . -type f -name \*.MP4 -exec ffmpeg -i /mnt/c/RAW360/{} -i /home/builder/dualfisheye2equirectangular/xmap_dokicam_video.pgm -i /home/builder/dualfisheye2equirectangular/ymap_dokicam_video.pgm -filter_complex remap /mnt/c/FIXED360/{} \; -print

$ cd /mnt/c/FIXED360 && find . -type f -name \*.MP4 -exec ffmpeg -vf "transpose=1, transpose=1" /mnt/c/FIXEDR360/{} \; -print

/content/images/2023/01/samsung360-04.png

Small, but here is a 1sec clip of each:

  1. raw: /content/images/2023/01/samsung360-07.MPG
  2. converted: /content/images/2023/01/samsung360-08.MPG
  3. converted and rotated: /content/images/2023/01/samsung360-09.MPG

Notes

There are some other ways to convert I experimented with… the ‘-t 5’ does just 5 seconds so you can check out videos.

There are a lot of parameters for ffmpeg (the docs page practically crashes my browser)

$ ffmpeg -t 5 -i /mnt/c/RAW360/360_0243.MP4 -vf v360=dfisheye:e:ih_fov=208 -y /mnt/c/RAW360/360_0243e.MP4
$ cd /mnt/c/RAW360/ && find . -type f -name \*.MP4 -exec ffmpeg -t 5 -i /mnt/c/RAW360/{} -vf v360=dfisheye:e:ih_fov=208 -y /mnt/c/FIXED360/$ cd /mnt/c/RAW360/ && find . -type f -name \*.MP4 -exec ffmpeg -t 5 -i /mnt/c/RAW360/{} -vf v360=dfisheye:e:ih_fov=189:iv_fov189 -y /mnt/c/FIXED360/{} \; -print
$ cd /mnt/c/RAW360/ && find . -type f -name \*.MP4 -exec ffmpeg -t 5 -i /mnt/c/RAW360/{} -vf v360=dfisheye:e:ih_fov=189:iv_fov=189 -y /mnt/c/FIXED360/{} \; -print
$ cd /mnt/c/RAW360/ && find . -type f -name \*.MP4 -exec ffmpeg -t 5 -i /mnt/c/RAW360/{} -vf v360=dfisheye:e:id_fov=180 -y /mnt/c/FIXED360/{} \; -print

One very close approximation was:

ffmpeg -i /mnt/c/RAW360/360_0244.MP4 -vf v360=dfisheye:e:id_fov=270,unsharp -y -c:v libx264 -profile:v high -preset:v medium -tune:v film -movflags +faststart /mnt/c/FIXED360/360_0244xx.MP4

/content/images/2023/01/samsung360-05.png

samsung

Have something to add? Feedback? You can use the feedback form

Isaac Johnson

Isaac Johnson

Cloud Solutions Architect

Isaac is a CSA and DevOps engineer who focuses on cloud migrations and devops processes. He also is a dad to three wonderful daughters (hence the references to Princess King sprinkled throughout the blog).

Theme built by C.S. Rhymes