1#!/usr/bin/env bash
2#
3# The HD definition will be 'hd480'
4#
5hd_definition=hd480
6mkdir ${hd_definition}
7
8for filename in *.mp4; do
9 input=${filename}
10 name=${filename%.*}
11 suffixe=${filename##*.}
12 output="hd480/"${name}_${hd_definition}.${suffixe}
13 echo "Input: ${input}"
14 echo "File Name: ${name}"
15 echo "File Extension: ${suffixe}"
16 echo "output: ${output}"
17
18 ffmpeg -i ${input} -c:v libx264 -s ${hd_definition} -crf 22 -c:a aac -b:a 160k -vf "scale=iw*sar:ih,setsar=1" ${output}
19
20done