add support for the opus codec

it seems like ffmpeg still has some issues with the native opus
container format (*.opus), so let's use the OGG container format for
now.
This commit is contained in:
Blade Gunner 2018-03-03 17:57:25 +01:00
parent 0c2c439d55
commit d7752b4779

View File

@ -34,6 +34,13 @@ fi
# shift # shift
#fi #fi
if [[ "$1" = '--opus' ]]
then
codec=libopus
extension=ogg
shift
fi
if [[ "$1" == '--single' ]] if [[ "$1" == '--single' ]]
then then
mode=single mode=single
@ -108,7 +115,16 @@ do
read -r -u9 _ _ chapter read -r -u9 _ _ chapter
chapter_title="${title} - $(printf %0${#chaptercount}d $chapternum) ${chapter}" chapter_title="${title} - $(printf %0${#chaptercount}d $chapternum) ${chapter}"
chapter_file="${output_directory}/${chapter_title}.${extension}" chapter_file="${output_directory}/${chapter_title}.${extension}"
</dev/null ffmpeg -loglevel error -stats -i "${full_file_path}" -i "${cover_path}" -ss "${start%?}" -to "${end}" -c copy -map 0:0 -map 1:0 -id3v2_version 3 \
# the ID3 tags must only be specified for *.mp3 files,
# the other container formats come with their own
# tagging mechanisms.
id3_version_param=""
if test "${extension}" = "mp3"; then
id3_version_param="-id3v2_version 3"
fi
</dev/null ffmpeg -loglevel error -stats -i "${full_file_path}" -i "${cover_path}" -ss "${start%?}" -to "${end}" -map 0:0 -map 1:0 -acodec copy ${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}" \
"${chapter_file}" "${chapter_file}"
chapternum=$((chapternum + 1 )) chapternum=$((chapternum + 1 ))