#!/bin/bash

#set -x

echo "file = $@"
input=`echo $@`
output=`echo $@ | sed 's/.webm/.mp4/'`
echo "input = $input"
echo "output = $output"

echo $LANG | grep "ru_RU" ; code=$?
if [ $code -eq 0 ]
then message="Конвертируем в $output"
else message="Converting to $output"
fi

ffmpeg -i "$input" -vcodec libx264  -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -y -r 24 -an "$output" | zenity\
    --progress\
    --title="WEBM to MP4"\
    --text="$message"\
    --pulsate\
    --auto-close\
    --auto-kill &
