Skip to content

Instantly share code, notes, and snippets.

@maxwelleite
Last active August 21, 2017 01:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maxwelleite/9789565 to your computer and use it in GitHub Desktop.
Save maxwelleite/9789565 to your computer and use it in GitHub Desktop.
Simple bash script to install the latest static version of FFmpeg (from http://ffmpeg.gusari.org/static/)
#!/bin/bash
# Author: Maxwel Leite
# Website: http://needforbits.wordpress.com/
# Description: Simple bash script to install the latest static version of FFmpeg (from http://ffmpeg.gusari.org/static/)
# Dependencies: wget
# Tested: Ubuntu Saucy
if [[ $EUID -ne 0 ]]; then
echo -e "You must be a root user!\nTry: sudo ./ffmpeg-update.sh" 2>&1
exit 1
fi
if ! which wget >/dev/null; then
echo "Error: wget is required to download the file"
echo "Run the following command to install it:"
echo "sudo apt-get install wget"
exit 1
fi
if [ `arch` == 'x86_64' ]; then
arch="64bit"
else
arch="32bit"
fi
mkdir -p "/tmp/ffmpeg-updater"
cd "/tmp/ffmpeg-updater"
echo -n ":: Downloading ffmpeg... "
wget -c -O ffmpeg.latest.tar.gz "http://ffmpeg.gusari.org/static/$arch/ffmpeg.static.$arch.latest.tar.gz"
if [ $? -ne 0 ]; then
echo "Error: Download error! Try again!"
exit 1
fi
echo "Done!"
echo -n ":: Unpacking ffmpeg... "
tar -xf ffmpeg.latest.tar.gz &> /dev/null
if [ $? -ne 0 ]; then
echo "Error unpacking! Try again!"
exit 1
fi
echo "Done!"
if [ ! -d ffmpeg ]; then
echo ":: Installing ffmpeg... "
# remove current version of ffmpeg (if really exists)
rm -rf /usr/bin/ffmpeg &> /dev/null
rm -rf /usr/bin/ffprobe &> /dev/null
# set the right permissions
chmod 755 ffprobe ffmpeg
chown root.root ffmpeg ffprobe
# install in enviroment
mv ffmpeg /usr/bin/
mv ffprobe /usr/bin/
echo "Done!"
echo -n ":: Cleanup... "
cd -
rm -rf /tmp/ffmpeg-updater
echo "Done!"
else
echo "Error: ffmpeg not found!"
exit 1
fi
echo -e "\nffmpeg is now fully installed!\nTo test, try: ffmpeg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment