initial commit
This commit is contained in:
commit
78f71a0fb1
4 changed files with 64 additions and 0 deletions
25
aax-to-chapter
Executable file
25
aax-to-chapter
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue