back

ffmpeg: v360 ball

In the v360 filter there are many projection formats, here I'm going to use the "ball" format. To make a flat video in ball format I decided to make 360 equirectangular images with 1° horizontal increase*. Starting from the left, position -180 to 180 (the yaw range in v360).
ffmpeg v360 filter

Introduction to Bash Shell Scripting, Flavio Copes
Bash - Getting started with Bash

To make a batch, use bash as follows:

#!/bin/bash 
yaw=-180
# degrees, range -180 to 180, start from -180.
frame=1 # start from 1, number of images.
while [ $frame -lt 361 ] # (-lt = less than) loop from 1 to 360 frames, then stop.
  do
    ffmpeg -i a/input.png -hide_banner -vf v360=input=e:output=e:yaw="$yaw" b/"$frame".jpg
    yaw=$((yaw + 1)) # increase yaw by whole number.
    frame=$((frame + 1)) # increase image number.
done 

Then, add 00 to image 1-9, add 0 to 10-99 for the next step (or use a file renamer):

a=1
for i in *.jpg; do
new=$(printf "%03d.jpg" ${a})
echo renaming ${i} ${new}
mv ${i} ${new}
let a=a+1
done

Make a high quality intermediate movie from the jpeg files:
(and with that movie you can experiment with other formats).

ffmpeg -i b/%03d.jpg -c:v prores_ks -profile:v 3 -vendor apl0 -bits_per_mb 8000 -r 30 -pix_fmt yuv422p10le proRes422.mov

And to make the final mp4 video use:

ffmpeg -i proRes422.mov -hide_banner -vf "v360=input=e:output=ball,scale=2048:2048" ball.mp4



Equirectangular input, the Buddha hall, National Museum, Phnom Penh, 2007.



Output "ball.mp4", 14s at 30fps.

* to increase the number of frames, I have to leave bash as it only accepts full numbers. I would use Black Magic Design's DaVinci Resolve / Fusion to directly make the intermediate movie in any length.

back