#!/bin/sh
for f in *mp4;do
time=$(ffprobe $(echo $f|sed s/С//g|sed s/ерія//g|sed s/с//g| cut -c 14-15|sed s/'\.'//g|sed s/' '//g)_seriya.mkv 2>&1|grep DU|cut -c 30-|sort|tail -n 1)
time=$((${time:0:2}*60+${time:3:2}))${time:5}
ffmpeg -i "$f" -c copy -t $time $(echo $f|sed s/С//g|sed s/ерія//g|sed s/с//g| cut -c 14-15|sed s/'\.'//g|sed s/' '//g)-cut.aac
done

