Improved trimaudio
This commit is contained in:
parent
03df912655
commit
1395f5c3bb
1 changed files with 14 additions and 3 deletions
17
trimaudio.sh
17
trimaudio.sh
|
@ -6,10 +6,21 @@ secfad=5
|
|||
temp1=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).m4a
|
||||
temp2=/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1).m4a
|
||||
|
||||
#step 1 rimuove il silenzio
|
||||
ffmpeg -i "$1" -to $(($secmax + 15)) -af "silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse,silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse" -y $temp1
|
||||
|
||||
ffmpeg -i $temp1 -to $secmax -af "afade=t=out:st=$(($secmax - $secfad)):d=$secfad" -y $temp2
|
||||
|
||||
mv $temp2 "$2"
|
||||
rm $temp1
|
||||
# step 2 tronca e sfuma
|
||||
len=$(ffprobe -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -v quiet $temp1)
|
||||
len=${len%.*}
|
||||
|
||||
if [ $len -gt $secmax ];
|
||||
then
|
||||
ffmpeg -i $temp1 -to $secmax -af "afade=t=out:st=$(($secmax - $secfad)):d=$secfad" -y $temp2
|
||||
mv $temp2 "$2"
|
||||
rm $temp1
|
||||
else
|
||||
mv $temp1 "$2"
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue