Last active
March 12, 2022 14:21
-
-
Save coderofsalvation/d89c23afce7d1d37e401e7006e7c87e3 to your computer and use it in GitHub Desktop.
convert cardboard camera vr files to oculus quest stereo mp4 using ffmpsg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: | |
# * put this script in a folder (`./renderall` e.g.) | |
# * chmod 755 renderall | |
# * convert carboard camera pictures to same folder using this tool: https://github.com/AbosaSzakal/CarboardCamera-Converter | |
# * run ./renderall | |
# * voila..mp4 files are now in directory /out | |
fps=25 | |
test -d out && rm -rf out | |
mkdir out | |
for i in *.jpg; do | |
slug="${i/.jpg/}" | |
out=out/${slug/\.vr-converted/}.mp4 | |
codec="-c:v libx264 -crf 18 -x264-params mvrange=511 -maxrate 50M -bufsize 25M -pix_fmt yuv420p -movflags faststart -c:a aac -b:a 192k" | |
ffmpeg -framerate $fps -i $slug.jpg -vf scale=5760:5760,eq=brightness=0.07,vibrance=intensity=1.5:gbal=4 ${codec} -r $fps -t 1 /tmp/tmp.mkv -y | |
ffmpeg -stream_loop -1 -i /tmp/tmp.mkv -i $slug.mp4 -map 0:v -map 1:a ${codec} -r $fps -shortest -tune stillimage $out | |
cd spatial-media | |
python3 spatialmedia -i --stereo=top-bottom ../$out ../$out.2 | |
mv ../$out.2 ../$out | |
cd - | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment