back

stereo panorama with movement
in one cube face with ffmpeg

The idea is to make a 360° stereo panorama video (or timelapse in this case as the video is restricted to 16x9 format with these cameras) where there is movement in only one area. That's in one of the six cubic faces that makes the sphere stereo panorama. Using PTGui and a late version of FFMpeg ≥ 4.3. Here with still image formats to the final movie. The one-line commands here should work on Mac and Linux, and on PC with minor changes.

I take 8x2 still images around and from the final fixed position, an extra sequence of 18x2 images when the dancers walk over the stage.

This is a proof of concept. Also to show that ffmpeg can be a tool in projects like this.



eq5.jpg. Here in the forward cubic face, in red, is where movement will happen.



5_12_348.jpg. Careful adjustment of the camera rotation would have given the dancers more space to move in. Here is an adjustment of -12° yaw. Postprocessing the video is more work or not possible.



13f.jpg. Here is a b/w anaglyph cubic stereo face from my test.



studio0202d1.mp4

Here is the test in flat anaglyph HD format, 9 sec at 2fps. You can see where the dancers gets cut off at the edge of the forward cubic face.

8 photos x 2 round, no zenith or nadir + 18 x 2 for the movement in the final camera position.

Hardware:
2 x Sony a 6300, APS-C, 1.5 half-frame.
2 x Nikon AF-S Fisheye-Nikkor 10.5mm f/2.8G ED.
2 x Metabones N/F-E Adapter Nikon G -> Sony E-mount.
2 x Sony RM-VPR1 cables from Nodal Ninja (via Pano Society) with a home made release box - with a switch to allow camera settings to be adjusted when connected.
Cameras in portrait format, slightly toe-in, rotated on the left camera's no-parallax point. Old Manfrotto rotator. Smallrig and other Arca Swiss compatible parts. Image at the bottom of this page.

Software:
December 2020
PTGui Pro 12 beta 14, following the Zakato_stereo_webinar with Antonio Victor Garcia-Serrano: https://www.youtube.com/watch?v=bOoHpd9T_e4&feature=youtu.be
Next time I will try Thomas Sharples's multipatch technique.
GNU bash, version 5.1.4-release
FFMpeg 4.3.1, command-line tool (minimum for v360 filter)
BBEdit 12.6.7 (Mac) or other text editor
NameChanger or other file renamer
MacOS 10.13, on a very modest MacBook Air i5

It helps to rename/renumber the photos from the two cameras before combining them to stereo, or reset frame numbers in the cameras before shooting, also syncronize date/time on the cameras.

Combining a panorama for the left eye and a panorama for the right eye to stereo:
ffmpeg hstack filter
ffmpeg vstack filter
ffmpeg -i left.tif -i right.tif -filter_complex "vstack" above_below.tif

ffmpeg -i left.tif -i right.tif -filter_complex "hstack" side_by_side.tif

To desaturate (black and white) the stereo panorama:
ffmpeg hue filter
ffmpeg -i stereo.tif -vf "hue=s=0" stereo_black_white.tif

And to make the anaglyph:
ffmpeg stereo3d filter
ffmpeg -i above_below.tif -vf "stereo3d=abl:arcd" abl_anaglyph.tif

ffmpeg -i side_by_side.tif -vf "stereo3d=sbsl:arcd" sbsl_anaglyph.tif

The new filter "v360" converts 360° videos/images between various formats. Here I'm converting an equirectangular panorama to a cubemap/strip in 6x1 format (horizontal).
ffmpeg v360 filter
v360 filter, cubemap face names: right 'r', left 'l', up 'u', down 'd', forward 'f', back 'b'. Default value is 'rludfb'. Any order is possible (but not usable). To get the forward cubemap face first or last in the cubemap, set order thus:
ffmpeg -i anaglyph.tif -vf 'v360=input=e:output=c6x1:out_forder=fbrlud' cubemap_fbrlud.tif

ffmpeg -i anaglyph.tif -vf 'v360=e:c6x1:out_forder=brludf' cubemap_brludf.tif

(I've added a set of 6 small (480x480 px) cubic faces to play with - if you have ffmpeg installed and have not used the v360 filter, see cubemap, cube faces and equirectangulars "mono".)

Untile the cubemap to it's six faces:
ffmpeg untile filter
ffmpeg -i cubmap.tif -vf untile=6x1 dir/%d.tif

or keep the "brlud" part of the cubemap intact, with cubemaps of 12000x2000 px:
ffmpeg -i cubemap_brludf.tif -vf "crop=10000:2000:0:0" cubemap_brlud.tif

To extract the forward cube faces, with cubemaps of 12000x2000 px. (Or use the untile filter.)
ffmpeg crop filter
ffmpeg -i cubemap.tif -vf "crop=2000:2000:8000:0" face05f.tif

Convert the other five cube faces separately to video with a duration of 9 sec at 2 fps:
ffmpeg -loop 1 -framerate 2 -i 1.tif -c:v libx264 -t 9 -pix_fmt yuv420p 1.mov

Reassemble the (video) cube faces.
ffmpeg tile filter
v360 filter names cube faces: 'r' right, 'l' left, 'u' up, 'd' down, 'f' forward, 'b' back. Default value is 'rludfb'. Rename each cube face if needed, right to 1.mp4, left to 2.mp4 etc. Then reassemble them with only 'f', 'forward', '5', having actual movement.

ffmpeg -i dir/1.mov -i dir/2.mov -i dir/3.mov -i dir/4.mov -i dir/5.mov -i dir/6.mov -filter_complex 'hstack=inputs=6' dir/cubemap123456.mov



cubemap123456.mov

ffmpeg's v360 filter can convert the cubemap video back to equirectangular video after reassembly:
ffmpeg -i cubemap123456.mov -vf v360=c6x1:e equirectangular.mp4

Alternatively make 18 equirectangular pngs, as a sequence of 01.png to 18.png, convert to a movie:
ffmpeg -framerate 2 -i dir/%02d.png -vf format=yuv420p -c:v libx264 -preset slow -crf 18 dir/studio0202d.mp4

ffmpeg scale filter
To scale the movie to HD format for this page:
ffmpeg -framerate 2 -i dir/equirectangular.mp4 -vf "scale=hd1080" -pix_fmt yuv420p -c:v libx264 -preset slow -crf 18 dir/studio0202d1.mp4
Which you see above.



20210213_1.jpg. The rig is not optimal when changing memory cards or batteries. But to shoot video they should be positioned side by side like here (not one vertically flipped) or "rolling shutter" will give problems, fast movement across the frame in normal horizontal video is bad enough. Wishing for a Sony Alpha 6xxx with global shutter.

back