#!/bin/bash # # Script to convert MP4 video to GIF with generation of custom color palette. # #=== Do not touch code below # Inner variables input_file="" input_fps="20" input_height="512" output_file="output.gif" # Great and simple idea got here: https://stackoverflow.com/a/53463162/867349 function cecho() { RED="\033[0;31m" GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color printf "${!1}${2} ${NC}\n" } function wecho() { # warning, yellow cecho "YELLOW" "[WARN] ${1}" } function eecho() { # error, red cecho "RED" "[ERROR] ${1}" } function iecho() { # info, green cecho "GREEN" "[INFO] ${1}" } if ! [ -x "$(command -v ffmpeg)" ]; then eecho 'Error: ffmpeg is not installed.' >&2 wecho 'Install it by next command "sudo apt install ffmpeg" and run script again.' wcho 'Exiting.' exit 1 fi function usage() { cat <