Skip to content

Instantly share code, notes, and snippets.

@zepinto
Last active April 2, 2019 16:06
Show Gist options
  • Save zepinto/606cc6317f6f76a67a31e23532a2a48b to your computer and use it in GitHub Desktop.
Save zepinto/606cc6317f6f76a67a31e23532a2a48b to your computer and use it in GitHub Desktop.
Bash script for depolarizing video for AMKOV AMK100s 360 camera
#!/bin/bash
if [ $# -le 0 ]
then
echo "Usage: ./script.bash <video_file>"
exit 1
fi
echo "Extracting matadata"
ffmpeg32 -i "$1" -f ffmetadata metadata.txt
echo "Extracting audio"
ffmpeg -i "$1" audio.mp3
echo "Converting video to frames"
mkdir frames
cd frames
ffmpeg -i "../$1" -qscale:v 2 -f image2 frame-%07d.jpg
cd ..
echo "Depolarizing frames"
for f in frames/frame-*.jpg; do echo "Processing $f..."; convert $f -crop 1212x1212+270+188 +distort DePolar 0 -background black -gravity north -extent 1906x1100 -quality 90% $f; done
echo "Creating video..."
ffmpeg -i audio.mp3 -framerate 30 -i 'frames/frame-%07d.jpg' -r 30 -c:v libx264 -c:a copy "$1.mp4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment