jhall39 / ThetaS-video-remap

Generate maps for Theta S spherical video with ffmpeg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThetaS-video-remap

Example ➡️ Result

Generate maps for ffmpeg to convert of spherical video from the dual-full frame fish-eye images to equirectangular video.

Adapted from the example given for ffmpeg's RemapFilter, with support added for video captured with Ricoh Theta S devices.

Guide

Building

  1. Install ffmpeg, (make sure it's a recent version)
  2. Checkout the source of this repository
  3. Build: `$ gcc projection.c -lm -o project

Running

Create maps xmap.pgm and ymap.pgm for use with videos from Theta S devices:

$ ./project -x xmap.pgm -y ymap.pgm -h 960 -w 960 -c 1920 -r 960 -m theta --verbose

xmap ymap

This creates two ASCII encoded PGM files which act as a lookup table for ffmpeg to remap the video.

Apply the maps to the video R0014696.MP4:

$ ffmpeg -i R0014696.MP4 -i xmap.pgm -i ymap.pgm -q 0 -lavfi "format=pix_fmts=rgb24,remap" remapped.mp4

Known issues

The Lens mapping isn't perfect, I'm working on getting a more accurate mapping.

spinning camera stabilized wobble example

Stabilizing output videos via Hugin with Matthew Petroff's method reveals a wobble that would not be present if the mapping was perfect; Convieniently, I think i can use Hugin's Lens Calibration tools on the source frames to find a better mapping.

Useful Things for Spherical Video

Tag for upload

If you want to upload your video to youtube as a 360 video, make sure you encoded it as a .mp4, and use this tool from google. On linux, you can install python-tk and use the gui, or use it via command line.

The instructions there say to run python spatialmedia but there isn't anything called that, so replace spatialmedia with __main__.py and it works.

python __main__.py -i remapped.mp4 remapped_injected.mp4

Your file is now ready for YouTube/etc.

About

Generate maps for Theta S spherical video with ffmpeg

License:Other


Languages

Language:C 100.0%