Page 1 of 1

Looking for script to convert mp3 to m4b

Posted: February 2nd, 2019, 8:08 pm
by LakersFan
I really wanted to try and figure this out myself, but I'm so new to this, it's really hard for me to know where to begin. I have an unraid server and am looking to create a simple(?) bash script to take a downloaded .mp3 and convert it to .m4b (iTunes audiobook).

Ultimate goals would be:
1. rename downloaded file to input.mp3
2. convert input.mp3 to output .m4b using ffmpeg
3. rename output file to "book - then today's date" ie. "BOOK-February-2-2019.m4b"

That's it. Seems like it would be simple, right? :)

Any help will be very much appreciated.

Re: Looking for script to convert mp3 to m4b

Posted: February 3rd, 2019, 5:38 am
by safihre
Do you have a program that could do that conversion?
Then we could help writing the script.

Re: Looking for script to convert mp3 to m4b

Posted: February 3rd, 2019, 1:09 pm
by LakersFan
Yes, ffmpeg does the conversion. I've used it in Windows and this seems to work for me:

Code: Select all

ffmpeg.exe -i %%1 -vn -c:a aac -b:a 120k -f mp4 %%1.m4b
But since Unraid is Linux based, batch files won't work.

Re: Looking for script to convert mp3 to m4b

Posted: February 4th, 2019, 7:01 am
by safihre
You could just change it to a script file (.sh) and then replace the % by $.

Re: Looking for script to convert mp3 to m4b

Posted: February 5th, 2019, 12:41 am
by LakersFan
well heck if it's that easy, i'll give it a shot. I'll be back with any issues. :)