initial commit

This commit is contained in:
Sebastian Hugentobler 2023-06-22 09:43:42 +02:00
commit 78f71a0fb1
Signed by: shu
GPG key ID: BB32CF3CA052C2F0
4 changed files with 64 additions and 0 deletions

25
aax-to-chapter Executable file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -e
input="$1"
EXT2="m4a"
if [ -z "$AAX_ACTIVATION_BYTES" ]; then
echo "set AAX_ACTIVATION_BYTES env var"
exit 1
fi
json=$(ffprobe -activation_bytes "$AAX_ACTIVATION_BYTES" -i "$input" -loglevel error -print_format json -show_format -show_chapters)
title=$(echo $json | jq -r ".format.tags.title")
count=$(echo $json | jq ".chapters | length")
target=$(echo $json | jq -r ".format.tags | .date + \" \" + .artist + \" - \" + .title")
mkdir "$target"
for i in $(seq -w 1 $count); do
j=$((10#$i))
n=$(($j - 1))
start=$(echo $json | jq -r ".chapters[$n].start_time")
end=$(echo $json | jq -r ".chapters[$n].end_time")
name=$(echo $json | jq -r ".chapters[$n].tags.title")
ffmpeg -activation_bytes "$AAX_ACTIVATION_BYTES" -i $input -ss $start -to $end -metadata title="$title $name" -vn -c:a copy "$target/$i $name.$EXT2"
done