Let's imagine we have a lot of mp3 files ( forexample one of the pluralsite courses converted to mp3 ).
URL=https://www.pluralsight.com/courses/run-effective-meetings
PASS=pass
USER=user
OUTPUT="%(playlist_index)s. %(title)s-%(id)s.%(ext)s"
youtube-dl --username $USER --password $PASS -o $OUTPUT --extract-audio --audio-format mp3 $URL
Once you have a list of files we can start converting it first by combining all mp3 into one, and then converting it to m4a/m4b format.
ls | grep "mp3" | awk '{printf "file |%s|\n", $0}' | sed -e "s/|/\'/g" > list.txt \
&& ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp3 \
&& ffmpeg -i output.mp3 output.m4a \
&& mv output.m4a output.m4b
https://gist.github.com/butuzov/fa7d456ebc3ec0493c0a10b73800bf42#gistcomment-2830778