IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
M4B to MP3 (chapter separation), Converting M4B to multiple MP3s taking into account the M4B chapters
jaime11
post Sep 23 2009, 00:23
Post #1





Group: Members
Posts: 3
Joined: 22-September 09
Member No.: 73392



Hello
I have been searching on the forum but haven't found anything. Basicly what I'm looking for is a program that will input a M4B file and output several MP3 files (1 MP3 per chapter in the M4B file).
I have been using Free M4B to MP3 Converter, but unfortunately, all it does is extract a single MP3 from the M4B.

Anyone knows any other programs for this job?

Thank you
Go to the top of the page
+Quote Post
DVDdoug
post Sep 23 2009, 00:53
Post #2





Group: Members
Posts: 2597
Joined: 24-August 07
From: Silicon Valley
Member No.: 46454



NOTE - I've never seen an M4B file, so maybe someone else can give you a better answer.

Do you need to do it automatically? I don't know how to do it automatically, but with any audio editor you can cut-out sections and save the separate sections in a variety of formats. (That assumes the audio editor can open the M4B files.) If you don't already have an audio editor, Audacity is FREE!!! (open source).

Or, MP3DirectCut (FREE!!!) can take the one-big MP3 file and chop it into little files (manually).
Go to the top of the page
+Quote Post
MostlyHarmless
post Sep 23 2009, 09:17
Post #3





Group: Members
Posts: 19
Joined: 23-September 09
Member No.: 73405



Would you point me to a link with such file (m4b with chapters), for test purposes? Maybe you can upload some?
Go to the top of the page
+Quote Post
tedgo
post Sep 23 2009, 10:06
Post #4





Group: Members
Posts: 1089
Joined: 16-April 04
From: Bavaria, Germany
Member No.: 13548



Have you tried foobar2000?
It can handle m4a/m4b with chapters and should be able to convert to individual mp3 files.
You'll need lame.exe for converting to mp3, though.

This post has been edited by tedgo: Sep 23 2009, 10:07
Go to the top of the page
+Quote Post
jaime11
post Sep 23 2009, 23:21
Post #5





Group: Members
Posts: 3
Joined: 22-September 09
Member No.: 73392



Hello
Thanks to everyone with their fast replies...

QUOTE (DVDdoug @ Sep 23 2009, 01:53) *
NOTE - I've never seen an M4B file, so maybe someone else can give you a better answer.

Do you need to do it automatically? I don't know how to do it automatically, but with any audio editor you can cut-out sections and save the separate sections in a variety of formats. (That assumes the audio editor can open the M4B files.) If you don't already have an audio editor, Audacity is FREE!!! (open source).

Or, MP3DirectCut (FREE!!!) can take the one-big MP3 file and chop it into little files (manually).


Thanks, I know such programs. Actually, I'm a frequent user of audacity and use another program called gtk mp3splitter that automatically detects silences in mp3 and splits them accordingly. However, I was thinking that since the M4B file when played in the ipod, the ipod recognizes it's chapters (similar to different tracks). Therefore, I guess the M4B file must contain some kind of information related to the chapter separation inside. I was therefore looking for some program that would use this info and split the M4B file accordingly.




QUOTE (MostlyHarmless @ Sep 23 2009, 10:17) *
Would you point me to a link with such file (m4b with chapters), for test purposes? Maybe you can upload some?


The file I currently want to split is nearly 200mb long, I'm looking for a smaller M4B file to upload. Thanks!



QUOTE (tedgo @ Sep 23 2009, 11:06) *
Have you tried foobar2000?
It can handle m4a/m4b with chapters and should be able to convert to individual mp3 files.
You'll need lame.exe for converting to mp3, though.



I have just tried using foobar2000, it opens the M4B file but when converting it I tried using the option "Convert each track to an individual file" and "generate multi-track files". Unfortunately, both just produced one single MP3 file sad.gif


We'll keep investigating, thanks for the help!
Go to the top of the page
+Quote Post
Zarggg
post Sep 24 2009, 16:10
Post #6





Group: Members
Posts: 556
Joined: 18-January 04
From: bethlehem.pa.us
Member No.: 11318



Is there any particular reason you need to transcode from AAC to MP3, rather than just splitting the file into multiple AAC (.m4a) files?
Go to the top of the page
+Quote Post
jaime11
post Sep 24 2009, 16:56
Post #7





Group: Members
Posts: 3
Joined: 22-September 09
Member No.: 73392



QUOTE (Zarggg @ Sep 24 2009, 17:10) *
Is there any particular reason you need to transcode from AAC to MP3, rather than just splitting the file into multiple AAC (.m4a) files?


Hello Zarggg,
No, there is no particular reason. Splitting to AAC is ok as long as it keeps the same structure of chapters as in the ipod and it is done automatically. I can always convert it back to MP3. Any ideas?


Thanks.
Go to the top of the page
+Quote Post
uberwolf
post Oct 29 2009, 01:03
Post #8





Group: Members
Posts: 8
Joined: 5-November 05
Member No.: 25567



QUOTE (jaime11 @ Sep 24 2009, 15:56) *
QUOTE (Zarggg @ Sep 24 2009, 17:10) *
Is there any particular reason you need to transcode from AAC to MP3, rather than just splitting the file into multiple AAC (.m4a) files?


Hello Zarggg,
No, there is no particular reason. Splitting to AAC is ok as long as it keeps the same structure of chapters as in the ipod and it is done automatically. I can always convert it back to MP3. Any ideas?


Thanks.


Did you have any luck with this. I also want to do this and my reason - my Cowon Q5W will not play .m4b files so I have to convert to mp3, ogg, flac ect. The files I want to convert are approx 8hrs long and made up of several chapters.
Go to the top of the page
+Quote Post
Zarggg
post Nov 2 2009, 20:26
Post #9





Group: Members
Posts: 556
Joined: 18-January 04
From: bethlehem.pa.us
Member No.: 11318



If you don't have (lossless) sources, and you're willing to run the risk of artifacts, just transcode at a similar bitrate/comparable quality setting. There's really not much other choice if your media player cannot read the formats you're using.
Go to the top of the page
+Quote Post
uberwolf
post Nov 3 2009, 19:21
Post #10





Group: Members
Posts: 8
Joined: 5-November 05
Member No.: 25567



My idea was to first convert the complete M4b files(10 x 8Hrs) into mp3 files which I did with dBpoweramp with good results. Now I want to chop up these large mp3 files into their revelant chapters. Using Qtime player on the .m4b files I was able to determine the exact time frame and size of each chapter(00:00:00 - 00:28:56, 00:28:58 - 01:06:08 and so on). I did try Cool Edit Pro to cut the files up into the revelant chapters but this re-converts the lame mp3's into mp3 pro files, not what I want. I will try the mp3 direct cut app DVDdoug linked to and see how that works but I suspect that also re-encodes the file, maybe not. My fear is that I will spend a week doing this and only then find out there was a much faster, easier and automatic method to achieve the same result. rolleyes.gif There are over 200 chapters in all.

This post has been edited by greynol: Nov 3 2009, 20:23
Reason for edit: Removed unnecessary botched quote of the previous post.
Go to the top of the page
+Quote Post
Zarggg
post Nov 4 2009, 16:56
Post #11





Group: Members
Posts: 556
Joined: 18-January 04
From: bethlehem.pa.us
Member No.: 11318



Have you tried using Audacity? I've had pretty good luck with that program when I needed to chop up audio files in the past.
Go to the top of the page
+Quote Post
HydrogenNoobie
post Sep 20 2010, 05:22
Post #12





Group: Members
Posts: 7
Joined: 20-September 10
Member No.: 83999



Jamie11,
Did you ever find a solution? I am looking for the same thing, and several months later, I am not having too much success. Did you find solution for "a program that will input a M4B file and output several MP3 files (1 MP3 per chapter in the M4B file)"?
Thanks
Go to the top of the page
+Quote Post
valekhz
post Dec 4 2010, 01:22
Post #13





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



If anyone is still interested I wrote a little python script to do this. You can find the git repository here: https://github.com/valekhz/m4b-converter. If you don't use git you can just download the python file here: https://github.com/valekhz/m4b-converter/raw/master/m4b.py.

You'll need python (only tested with 2.7 so far) and ffmpeg. Place the m4b.py somewhere and drag your *.m4b file onto m4b.py, or use the command line. There's a README in the git repository for more info on how to use it. I haven't been able to test that many .m4b files yet but those I've tried have worked great. I've tested it on Windows 7 and Ubuntu.

Basically it works by parsing the output of ffmpeg -i file.m4b to get the chapter data, encodes the audio and splits it based on the data from ffmpeg. Sorry if the code is a bit messy, haven't been coding in python for a while. smile.gif
Go to the top of the page
+Quote Post
nbarzgar
post Dec 4 2010, 08:06
Post #14





Group: Members
Posts: 20
Joined: 16-August 05
Member No.: 23938



QUOTE (valekhz @ Dec 4 2010, 02:22) *
If anyone is still interested I wrote a little python script to do this. You can find the git repository here: https://github.com/valekhz/m4b-converter. If you don't use git you can just download the python file here: https://github.com/valekhz/m4b-converter/raw/master/m4b.py.

You'll need python (only tested with 2.7 so far) and ffmpeg. Place the m4b.py somewhere and drag your *.m4b file onto m4b.py, or use the command line. There's a README in the git repository for more info on how to use it. I haven't been able to test that many .m4b files yet but those I've tried have worked great. I've tested it on Windows 7 and Ubuntu.

Basically it works by parsing the output of ffmpeg -i file.m4b to get the chapter data, encodes the audio and splits it based on the data from ffmpeg. Sorry if the code is a bit messy, haven't been coding in python for a while. smile.gif


Thank you, I also have been looking for this for weeks!
Now my problem: I get the message "no chapter information found", although iTunes shows them and ffmpeg parses a 'subtitle' stream... What can I do?
File-Info:
m4b_Info.txt


By the way, for other newbies in Python - like me - here a few (Windows-)hints:
1. DL Python 2.7 and install to directory of your choice.
2. The 'PATH' means the directory, where the Python-executable is stored (in my case it was the 'Python 2.7' dir created on HDD during install).
3. Download 'ffmpeg.exe' from here (for example, other sites exist) and put it in the same dir, as the Python-executable, i.e. the 'PATH'.
4. Put m4b.py into any directory, which has enough space for the .mp3-output files (of course, as valekhz points out you may change the output-dir by editing the .py file, but I wouldn't dare, never having come close to coding such things...)
5. Drag&drop m4b file onto the .py-file, wait (depending on CPU-power), find the new file(s) in a new subdirectory, called the same as the m4b...

Thanks again, valekhz!
Should you be able to help me on my above stated issue, I' be extremely grateful!!

This post has been edited by nbarzgar: Dec 4 2010, 08:36
Go to the top of the page
+Quote Post
valekhz
post Dec 4 2010, 13:25
Post #15





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



Thank you for writing the guide, nbarzgar.

QUOTE (nbarzgar @ Dec 4 2010, 08:06) *
Thank you, I also have been looking for this for weeks!
Now my problem: I get the message "no chapter information found", although iTunes shows them and ffmpeg parses a 'subtitle' stream... What can I do?
File-Info:
m4b_Info.txt

If you could post the output of ffmpeg.exe -i myfile.m4b I may be able to help. This particular error message shows up when the script couldn't find/parse chapter data from the output. The current implementation of getting the chapter data is very ugly and if anyone knows of a library that can read the chapters directly I could improve the script.

QUOTE (nbarzgar @ Dec 4 2010, 08:06) *
4. Put m4b.py into any directory, which has enough space for the .mp3-output files (of course, as valekhz points out you may change the output-dir by editing the .py file, but I wouldn't dare, never having come close to coding such things...)

There's a command line option to change the output directory: python m4b.py --output-dir C:\Some\Other\Folder myfile.m4b. You can find the other command line options by running: python m4b.py -h.
Go to the top of the page
+Quote Post
nbarzgar
post Dec 5 2010, 06:02
Post #16





Group: Members
Posts: 20
Joined: 16-August 05
Member No.: 23938



QUOTE (valekhz @ Dec 4 2010, 14:25) *
Thank you for writing the guide, nbarzgar.

welcome... smile.gif

QUOTE (nbarzgar @ Dec 4 2010, 08:06) *
If you could post the output of ffmpeg.exe -i myfile.m4b I may be able to help. This particular error message shows up when the script couldn't find/parse chapter data from the output. The current implementation of getting the chapter data is very ugly and if anyone knows of a library that can read the chapters directly I could improve the script.


I put the output here.

Thanks for trying to help and being so fast about it! biggrin.gif
Go to the top of the page
+Quote Post
valekhz
post Dec 5 2010, 16:11
Post #17





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



QUOTE (nbarzgar @ Dec 5 2010, 06:02) *
I put the output here.

Thanks for trying to help and being so fast about it! biggrin.gif

It's possible that Apple have their own implementation of mp4 chapters which ffmpeg can't read. There are a few options available:
  1. Play the .m4b file in VLC and see if the chapters appear in the menu (Playback -> Chapter)
  2. MP4Box should be able to read the chapters
  3. mp4chaps should also be able to read them

You'll be able to test #1 easily and this is the solution I'd prefer. #2 and #3 will not be possible right now since I don't have access to one of those .m4b files. You could try #2 and #3 if you feel like it and feel comfortable enough with the command line. If we're lucky VLC can read it, otherwise there's not much I can do right now.
Go to the top of the page
+Quote Post
nbarzgar
post Dec 5 2010, 20:30
Post #18





Group: Members
Posts: 20
Joined: 16-August 05
Member No.: 23938



VLC shows the chapters!!
So now what would I do? I know that VLC allows converting, but how would I go about it in this case? Or did you mean yet another solution?
Go to the top of the page
+Quote Post
valekhz
post Dec 6 2010, 00:45
Post #19





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



QUOTE (nbarzgar @ Dec 5 2010, 20:30) *
VLC shows the chapters!!
So now what would I do? I know that VLC allows converting, but how would I go about it in this case? Or did you mean yet another solution?

Awesome. I will remove the old chapter code and use VLC's API to get them instead. This will be a lot more reliable than parsing command output. There should be a new version out tomorrow.
Go to the top of the page
+Quote Post
nbarzgar
post Dec 8 2010, 06:59
Post #20





Group: Members
Posts: 20
Joined: 16-August 05
Member No.: 23938



QUOTE (valekhz @ Dec 6 2010, 01:45) *
Awesome. I will remove the old chapter code and use VLC's API to get them instead. This will be a lot more reliable than parsing command output. There should be a new version out tomorrow.


This is wonderful news! Thanks for all the help.
Go to the top of the page
+Quote Post
valekhz
post Dec 10 2010, 22:42
Post #21





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



I finally got the time to finish the script. Unfortunately it's not possible to retrieve chapter times through VLC's API so I had to find another solution. libmp4v2 should be able to read both chapter formats but I haven't been able to test both. If it doesn't work it'll have to wait until I have access to one of those m4b files.

Installation is pretty simple:
  1. Download the new script and extract all files to a folder of your choice.
  2. Place ffmpeg.exe either in the same dir as m4b.py or in your PATH.
  3. Download libmp4v2.dll and place it in the same dir as m4b.py. I couldn't find any pre-compiled dlls so I compiled one myself. You can get it here. If you feel more comfortable compiling yourself check the README for instructions.
I compiled the dll with Visual Studio 2010 so you may need the Microsoft Visual C++ 2010 Redistributable Package if you get dll errors when running the script. You can download it from Microsoft's website. Sorry about all these extra dependencies.

If anyone rather want to use the old script (without support for both chapter types) it's still available here.

This post has been edited by valekhz: Dec 10 2010, 22:43
Go to the top of the page
+Quote Post
nbarzgar
post Dec 11 2010, 11:58
Post #22





Group: Members
Posts: 20
Joined: 16-August 05
Member No.: 23938



QUOTE (valekhz @ Dec 10 2010, 23:42) *
I finally got the time to finish the script.


Just downloaded, followed the steps - and ended up after about 45 min (83 chapters, 15 hrs runtime) with the correctly splitted files!!! (In the course of the process I already had got the message "83 chapter(s) found"...)
This is great work, thank you so much!!

biggrin.gif
Go to the top of the page
+Quote Post
HydrogenNoobie
post Dec 11 2010, 23:47
Post #23





Group: Members
Posts: 7
Joined: 20-September 10
Member No.: 83999



valekhz,

Thank you so much for writing this script! You are doing great work! I have been looking for a way to do this for some time, and I'm thrilled to see that someone with the right skills has taken an interest. I didn't visit the site for a couple weeks - and it looks like I missed alot!

While it is *almost* working for my m4b files, unfortunately, it is not quite there just yet.

For background...When I run the original script (from Dec 4), it must be close to being able to parse the chapters, because as it works, I can see the chapter names scrolling by, but it only creates a single mp3 file. I suspect the problem might be related to the characters in the chapter names, because as it works, I can see that some of the characters (both western, but non-English characters, like ", ǐ, ǚ, , , " as well as Asian, like "你好") look corrupted.

When I ran the new script from Dec 10 (I think I'm following the instructions right), I simply get an error message "This application has failed to start because MSVCP100.dll was not found. Reinstalling the application may fix this problem." The first few letters do suggest that the dll you compiled may be creating a need for other components of Microsoft Visual Studio, so I downloaded and installed it. Now, it does run, and does create multiple mp3's from one m4b. However, it creates far fewer mp3s than there are chapters. I also notice that some of the mp3 file names are not the same as the m4b chapter names...again, I suspect it is related to non-English characters. Do you think there is any way to get chapter names / file names using other character sets? I will send you a couple of my m4B files as a samples via email in the hope that you are willing to give it a try smile.gif

Again - I am so happy that you have both the knowledge to deal with this topic and the interest to do so. Thank you so much!
Go to the top of the page
+Quote Post
valekhz
post Dec 12 2010, 19:02
Post #24





Group: Members
Posts: 10
Joined: 4-December 10
Member No.: 86227



Unfortunately there's no Unicode support right now that's why you get those issues. Unicode support is essential so I'll see what I can do. A few samples of those m4b files would be very helpful so check your inbox.

QUOTE (HydrogenNoobie @ Dec 11 2010, 23:47) *
When I ran the new script from Dec 10 (I think I'm following the instructions right), I simply get an error message "This application has failed to start because MSVCP100.dll was not found. Reinstalling the application may fix this problem." The first few letters do suggest that the dll you compiled may be creating a need for other components of Microsoft Visual Studio, so I downloaded and installed it.

That's correct. If anyone else is having the same issue you may need to download the Microsoft Visual C++ 2010 Redistributable Package from Microsoft's website. This is also included in the installation instructions above.
Go to the top of the page
+Quote Post
daleybox
post Dec 13 2010, 03:36
Post #25





Group: Members
Posts: 2
Joined: 13-December 10
Member No.: 86470



I ran into a couple of problems:

1) It was saying that the library and/or DLL was not a valid windows dll. The problem was I was using the supplied DLL, which is a 32-bit and I was using 64-bit python. Those don't mix, so I installed and used the 32-bit version of python and it worked great. So, if anyone has that problem, hopefully this will help them.

2) The other "problem" I have is not really a problem, but more of a request I guess. The script works well, however, when it extracts the chapters and names to mp3, I have no idea of what order they should have be in. Could there be an internal counter or something so that you would get something like "Chapter 1 - " prepended to the chapter title? Otherwise, the only way I see to figure out the order is to listen to each one and hope it starts with the chapter number...
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st September 2014 - 23:03