reem: script to split files based on a track/chapter list
This commit is contained in:
parent
8e84fdb917
commit
d5e9326e2f
1 changed files with 27 additions and 0 deletions
27
reem.sh
Executable file
27
reem.sh
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/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
|
Loading…
Reference in a new issue