Looking for script to convert mp3 to m4b

Come up with a useful post-processing script? Share it here!
Post Reply
LakersFan
Newbie
Newbie
Posts: 6
Joined: August 12th, 2013, 11:54 pm

Looking for script to convert mp3 to m4b

Post by LakersFan » February 2nd, 2019, 8:08 pm

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.

User avatar
safihre
Administrator
Administrator
Posts: 3042
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: Looking for script to convert mp3 to m4b

Post by safihre » February 3rd, 2019, 5:38 am

Do you have a program that could do that conversion?
Then we could help writing the script.

LakersFan
Newbie
Newbie
Posts: 6
Joined: August 12th, 2013, 11:54 pm

Re: Looking for script to convert mp3 to m4b

Post by LakersFan » February 3rd, 2019, 1:09 pm

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.

User avatar
safihre
Administrator
Administrator
Posts: 3042
Joined: April 30th, 2015, 7:35 am
Location: Switzerland
Contact:

Re: Looking for script to convert mp3 to m4b

Post by safihre » February 4th, 2019, 7:01 am

You could just change it to a script file (.sh) and then replace the % by $.

LakersFan
Newbie
Newbie
Posts: 6
Joined: August 12th, 2013, 11:54 pm

Re: Looking for script to convert mp3 to m4b

Post by LakersFan » February 5th, 2019, 12:41 am

well heck if it's that easy, i'll give it a shot. I'll be back with any issues. :)

Post Reply