Compare commits

...

1 Commits

Author SHA1 Message Date
Yves G. e4ab70bf39 playable editions (chapters)… but all tracks mixed :-/ 2024-03-09 22:58:37 +01:00
1 changed files with 9 additions and 4 deletions

View File

@ -399,11 +399,13 @@ while read -r tlist; do
STREAMS_TO_REF[$strid]=$ref
done <"$BUILD/.titlelist"
declare -A STREAMS_TO_OFFSET
declare -A STREAMS_TO_OFFSET STREAMS_TO_TRACKID
ref=0
id=1
for strid in "${STREAMS_LIST[@]}"; do
STREAMS_TO_OFFSET[$strid]=$ref
STREAMS_TO_TRACKID[$strid]=$id; id=$((id+1))
file="${STREAMS_TO_FILES[$strid]##*|}"
tnum=$(sed -r 's#.*/t.([0-9]+).ch.[0-9]+.mkv#\1#' <<<"$file")
streamcount=$(jq -r '.tracks | length' <"${file%mkv}json")
@ -419,9 +421,9 @@ for strid in "${STREAMS_LIST[@]}"; do
IFS='|' read -r -a files <<<"${STREAMS_TO_FILES[$strid]#|}"
MKVMRGARGS+=("${files[@]}")
MKVMRGARGS+=(']')
for file in "${files[@]}"; do
ref=$(bc -lq <<<"$ref+$(jq -r '.container.properties | .duration/.timestamp_scale' <"${file%mkv}json")+1")
done
# for file in "${files[@]}"; do
# ref=$(bc -lq <<<"$ref+$(jq -r '.container.properties | .duration/.timestamp_scale' <"${file%mkv}json")")
# done
done
# generate MKV editions XML file
@ -473,6 +475,9 @@ ENDOFXML
<ChapterDisplay>
<ChapterString>$tnum.$chnum${CHNAMES[$tnum.$chnum]}</ChapterString>
</ChapterDisplay>
<ChapterTrack>
<ChapterTrackNumber>${STREAMS_TO_TRACKID[$strid]}</ChapterTrackNumber>
</ChapterTrack>
</ChapterAtom>
ENDOFXML