Way faster chapter splitting

Just a little change in the ffmpeg call, but this massively increases the speed of chapter splitting. (In my first test approximately by a factor of 10.)
This commit is contained in:
Nicko98 2021-02-02 22:56:09 +01:00 committed by GitHub
parent 9e3a2a3787
commit dc5309ebc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,7 @@ container=mp3 # Just in case we need to change the container. Use
VALIDATE=0 # Validate the input aax file(s) only. No Transcoding of files will occur VALIDATE=0 # Validate the input aax file(s) only. No Transcoding of files will occur
DEBUG=0 # Default off, If set extremely verbose output. DEBUG=0 # Default off, If set extremely verbose output.
noclobber=0 # Default off, clobber only if flag is enabled noclobber=0 # Default off, clobber only if flag is enabled
continue=0 # Default off, If set Transcoding is skipped and chapter splitting starts at chapter continueAt. continue=0 # Default off, If set Transcoding is skiped and chapter splitting starts at chapter continueAt.
continueAt=1 # Optional chapter to continue splitting the chapters. continueAt=1 # Optional chapter to continue splitting the chapters.
# ----- # -----
@ -54,7 +54,7 @@ while true; do
-d | --debug ) DEBUG=1; shift ;; -d | --debug ) DEBUG=1; shift ;;
# Validate ONLY the aax file(s) No transcoding occurs # Validate ONLY the aax file(s) No transcoding occurs
-V | --validate ) VALIDATE=1; shift ;; -V | --validate ) VALIDATE=1; shift ;;
# continue splitting chapters at chapter continueAt # continue spliting chapters at chapter continueAt
--continue ) continueAt="$2"; continue=1; shift 2 ;; --continue ) continueAt="$2"; continue=1; shift 2 ;;
# Command synopsis. # Command synopsis.
-h | --help ) printf "$usage" $0 ; exit ;; -h | --help ) printf "$usage" $0 ; exit ;;
@ -169,10 +169,9 @@ if [[ "x$(type -P ffmpeg)" == "x" ]]; then
echo "ERROR ffmpeg was not found on your env PATH variable" echo "ERROR ffmpeg was not found on your env PATH variable"
echo "Without it, this script will break." echo "Without it, this script will break."
echo "INSTALL:" echo "INSTALL:"
echo "MacOS: brew install ffmpeg" echo "MacOS: brew install ffmpeg"
echo "Ubuntu: sudo apt-get update; sudo apt-get install ffmpeg libav-tools x264 x265 bc" echo "Ubuntu: sudo apt-get update; sudo apt-get install ffmpeg libav-tools x264 x265 bc"
echo "Ubuntu (20.04): sudo apt-get update; sudo apt-get install ffmpeg x264 x265 bc" echo "RHEL: yum install ffmpeg"
echo "RHEL: yum install ffmpeg"
exit 1 exit 1
fi fi
@ -446,7 +445,7 @@ do
# Extract chapter by time stamps start and finish of chapter. # Extract chapter by time stamps start and finish of chapter.
# This extracts based on time stamps start and end. # This extracts based on time stamps start and end.
log "Splitting chapter ${chapternum}/${chaptercount} start:${chapter_start%?}(s) end:${chapter_end}(s)" log "Splitting chapter ${chapternum}/${chaptercount} start:${chapter_start%?}(s) end:${chapter_end}(s)"
</dev/null ffmpeg -loglevel quiet -nostats -i "${output_file}" -i "${cover_file}" -ss "${chapter_start%?}" -to "${chapter_end}" -map 0:0 -map 1:0 -acodec "${codec}" ${id3_version_param} \ </dev/null ffmpeg -loglevel quiet -nostats -ss "${chapter_start%?}" -to "${chapter_end}" -i "${output_file}" -i "${cover_file}" -map 0:0 -map 1:0 -acodec "${codec}" ${id3_version_param} \
-metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -metadata track="${chapternum}" -metadata title="${chapter_title}" \ -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" -metadata track="${chapternum}" -metadata title="${chapter_title}" \
-metadata:s:a title="${chapter_title}" -metadata:s:a track="${chapternum}" -map_chapters -1 \ -metadata:s:a title="${chapter_title}" -metadata:s:a track="${chapternum}" -map_chapters -1 \
-f ${container} "${chapter_file}" -f ${container} "${chapter_file}"