Woolf999, запускать много mplayer? Без вопросов, сейчас скину тебе свой актуальный скрипт для оптимизации картинок.
#!/bin/bash
#Функции обработки
opt_optipng ()
{
input="$1"
echo -e "\e[01;34mОбрабатывается\e[00m \e[01;31m(optipng):\e[00m \e[01;32m$input\e[00m"
optipng0.7.4 -o3 "$input" >/dev/null 2>&1
}
opt_advpng ()
{
input="$1"
echo -e "\e[01;34mОбрабатывается\e[00m \e[01;31m(advpng):\e[00m \e[01;32m$input\e[00m"
advpng -z -4 "$input">/dev/null 2>&1
}
opt_advdef ()
{
input="$1"
echo -e "\e[01;34mОбрабатывается\e[00m \e[01;31m(advdef):\e[00m \e[01;32m$input\e[00m"
advdef -z -4 "$input">/dev/null 2>&1
}
opt_jpegtran ()
{
input="$1"
echo -e "\e[01;34mОбрабатывается\e[00m \e[01;31m(jpegtran):\e[00m \e[01;32m$input\e[00m"
jpegtran -optimize -progressive -copy none -outfile "$input" "$input" 2>&1
#jpegtran -arithmetic -copy none -outfile "$input" "$input" 2>&1
}
opt_gifsicle ()
{
input="$1"
echo -e "\e[01;34mОбрабатывается\e[00m \e[01;31m(gifsicle):\e[00m \e[01;32m$input\e[00m"
gifsicle --batch --optimize=3 "$input" >/dev/null 2>&1
}
#Очистка экрана и поиск файлов для обработки
clear
SIZEPNG=$(find . -type f \( -iname '*.png' -o -iname '*.PNG' \) -printf '%s\n' | tee >(numpng=$(wc -l)) | awk '{SUM+=$1} END {print SUM}');
SIZEGIF=$(find . -type f \( -iname '*.gif' -o -iname '*.GIF' \) -printf '%s\n' | tee >(numgif=$(wc -l)) | awk '{SUM+=$1} END {print SUM}');
SIZEJPG=$(find . -type f \( -iname '*.JPG' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.JPEG' \) -printf '%s\n' | tee >(numjpg=$(wc -l)) | awk '{SUM+=$1} END {print SUM}')
SIZE=$[SIZEPNG+SIZEGIF+SIZEJPG]
#Рабочая часть скрипта
export -f opt_optipng
find -type f | cut -c 3- | grep -ie '.png$' | sort | parallel opt_optipng '{}'
export -f opt_advpng
find -type f | cut -c 3- | grep -ie '.png$' | sort | parallel opt_advpng '{}'
export -f opt_advdef
find -type f | cut -c 3- | grep -ie '.png$' | sort | parallel opt_advdef '{}'
export -f opt_jpegtran
find -type f | cut -c 3- | grep -e '.JPG$' -e '.jpg$' -e '.jpeg$' -e '.JPEG$' | sort | parallel opt_jpegtran '{}'
export -f opt_gifsicle
find -type f | cut -c 3- | grep -ie '.gif$' | parallel opt_gifsicle '{}'
#Оформление информации для вывода
echo -e "\e[01;33mГотово!\e[00m"
SIZEPNG2=$(find . -type f \( -iname '*.png' -o -iname '*.PNG' \) -printf '%s\n' | awk '{SUM+=$1} END {print SUM}');
SIZEGIF2=$(find . -type f \( -iname '*.gif' -o -iname '*.GIF' \) -printf '%s\n' | awk '{SUM+=$1} END {print SUM}');
SIZEJPG2=$(find . -type f \( -iname '*.JPG' -o -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.JPEG' \) -printf '%s\n' | awk '{SUM+=$1} END {print SUM}')
SIZE2=$[SIZEPNG2+SIZEGIF2+SIZEJPG2]
if [ $SIZEPNG ]; then
PERCENTPNG=$[100-SIZEPNG2*100/SIZEPNG]
fi
if [ $SIZEGIF ]; then
PERCENTGIF=$[100-SIZEGIF2*100/SIZEGIF]
fi
if [ $SIZEJPG ]; then
PERCENTJPG=$[100-SIZEJPG2*100/SIZEJPG]
fi
if [ $SIZE ]; then
PERCENT=$[100-SIZE2*100/SIZE]
echo -e "Исходный размер всех обрабатываемых файлов был \e[01;31m$SIZE\e[00m байт а после обработки составил \e[01;31m$SIZE2\e[00m байт. Среднее сжатие на \e[01;31m$PERCENT%\e[00m
Из них:"
fi
if [ $SIZEPNG ]; then
echo -e "PNG: было: \e[01;31m$SIZEPNG\e[00m байт, стало \e[01;31m$SIZEPNG2\e[00m байт, сжалось на \e[01;31m$PERCENTPNG%\e[00m"
fi
if [ $SIZEGIF ]; then
echo -e "GIF: было: \e[01;31m$SIZEGIF\e[00m байт, стало \e[01;31m$SIZEGIF2\e[00m байт, сжалось на \e[01;31m$PERCENTGIF%\e[00m"
fi
if [ $SIZEJPG ]; then
echo -e "JPG: было: \e[01;31m$SIZEJPG\e[00m байт, стало \e[01;31m$SIZEJPG2\e[00m байт, сжалось на \e[01;31m$PERCENTJPG%\e[00m"
fi
Как-то так тебе надо твой скрипт оформить ну и gnu parallel должен быть установлен.