#!/bin/sh
set -e  # exit immediately on any error so failures aren't silent

yum install -y tar
yum install -y xz
yum install -y zip
yum install -y gzip
yum install -y wget

cd /usr/local/bin
mkdir -p ffmpeg
cd /usr/local/bin/ffmpeg

wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz.md5
md5sum -c ffmpeg-release-amd64-static.tar.xz.md5
tar -xf ffmpeg-release-amd64-static.tar.xz

ln -sfn /usr/local/bin/ffmpeg/ffmpeg-*-amd64-static/ffmpeg /usr/bin/ffmpeg
ln -sfn /usr/local/bin/ffmpeg/ffmpeg-*-amd64-static/ffprobe /usr/bin/ffprobe

ffmpeg -version
ffprobe -version
