Skip to content

Instantly share code, notes, and snippets.

@DevStefIt
Created April 3, 2023 21:42
Show Gist options
  • Save DevStefIt/6c552f63d6770974550d2cdf770e69f4 to your computer and use it in GitHub Desktop.
Save DevStefIt/6c552f63d6770974550d2cdf770e69f4 to your computer and use it in GitHub Desktop.
360 video
from tkinter import Tk
from tkinter.filedialog import askopenfilename
from pathlib import Path
import subprocess
Tk().withdraw()
input_file = Path(askopenfilename(title='Load video file', initialdir=f"{Path.home()}"))
input_projection = 'equirect'
output_projection = ['c3x2', 'c6x1', 'c1x6',
'eac',
'flat', 'gnomonic', 'rectilinear',
'dfisheye',
'barrel', 'fb', 'barrelsplit',
'sg',
'mercator',
'ball',
'hammer',
'sinusoidal',
'fisheye',
'pannini',
'cylindrical',
'perspective',
'tetrahedron',
'tsp',
'he', 'hequirect',
'equisolid',
'og',
'octahedron',
'cylindricalea']
for index, op in enumerate(output_projection):
command = f'ffmpeg -i "{input_file}" -filter:v "v360={input_projection}:{op}" -c:a copy -c:v libx264 -crf 18 -preset slower "{input_file.parent}\output\{input_file.name}-{op}.mp4"'
subprocess.run(command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment