28 lines
836 B
Bash
28 lines
836 B
Bash
|
#!/bin/sh
|
||
|
lines=$(cat $1 | wc -l)
|
||
|
l=0
|
||
|
|
||
|
mkdir $1_out
|
||
|
|
||
|
while [ $l -lt $lines ]; do
|
||
|
current=$(cat $1 | sed -n "$(($l+1))p")
|
||
|
next=$(cat $1 | sed -n "$(($l+2))p")
|
||
|
l=$(($l+1))
|
||
|
current_ts=$(echo $current | awk '{print $1}')
|
||
|
if [ $(echo ${current_ts} | wc -c) -lt 6 ]; then
|
||
|
current_ts="00:${current_ts}"
|
||
|
fi
|
||
|
next_ts=$(echo $next | awk '{print $1}')
|
||
|
if [ ! -z "$next_ts" ] && [ $(echo ${next_ts} | wc -c) -lt 6 ]; then
|
||
|
next_ts="00:${next_ts}"
|
||
|
fi
|
||
|
track=$(echo $current |awk '{for (i=2; i<NF; i++) printf $i " "; print $NF}')
|
||
|
echo "$track [${current_ts} - ${next_ts}]"
|
||
|
toarg=""
|
||
|
if [ ! -z "${next_ts}" ]; then
|
||
|
toarg="-to ${next_ts}"
|
||
|
fi
|
||
|
# you can use -c:a copy for less accurate cuts n avoid reencoding
|
||
|
ffmpeg -n -ss $current_ts $toarg -i *"$1"*.mp4 -c:v null -c:a aac -b:a 128k $1_out/"${track}.aac"
|
||
|
done
|