Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on >24hr audiobooks & Reader Jumps Around #37

Open
kkrausse opened this issue Oct 25, 2024 · 6 comments
Open

Fails on >24hr audiobooks & Reader Jumps Around #37

kkrausse opened this issue Oct 25, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@kkrausse
Copy link

kkrausse commented Oct 25, 2024

Seems like the failure at >24hr books is because final wav file gets too big.

Another (somewhat) related issue is that ebook reader randomly pauses and like jump backwards to random places.

Have you considered using m4b-tool instead of combining wav files & making the metadata yourself?

or maybe something with my files messes with the formatting.

edit: willing to work on this myself, but want to know if anyone has ideas first

@DrewThomasson
Copy link
Owner

hm, Ill look into this

but in the meantime I suppose you could try removing the activation of the create_m4b_from_chapters() function?

Then you should just be left with a bunch of chapter wav files located in the Chapter_wav_files dir?

Unless of course your issue comes before the creation of the final giant audiobook file

@DrewThomasson DrewThomasson added the bug Something isn't working label Oct 26, 2024
@ROBERT-MCDOWELL
Copy link
Collaborator

the best is standardize the audio file with a max time, for ex 2 hours, and a consistent naming convention
i.e: chapter-1.1, chapter-1.2 etc...
to split with ffmpeg something like
ffmpeg -i long_audio.wav -f segment -segment_time 7200 chapter%03d.m4b

@kkrausse
Copy link
Author

👍🏻 yeah for now I went the route of just commenting out create_m4b_from_chapters() and use m4b-tool to convert those which works great.

@ROBERT-MCDOWELL
Copy link
Collaborator

@kkrausse v2.0 is out now, but I'm still working on it. If you have already some code for a PR don't hesitate to share it.

@majormer
Copy link

majormer commented Jan 2, 2025

I might have hit something like this.

image

28.4 GB of WAV files were generated for my audiobook. I need to get them combined. I'll look at using m4b-tool to merge them, I suppose, since the conversion took 2 days, but let me know if you need more info:

`Processing 100.00%: : 41039/41039
End of Chapter 41
Combined audio saved to W:\Personal\Repos\ebook2audiobook\tmp\ebook-8fdd5c5b-213b-4214-9e01-0b1c9c69c1c2\chapters_0587d54db0b22fe48ce814b608a119ac\chapter_41.wav
Combining chapter 41 to audio, sentence 39986 to 41038
Processing 100.00%: : 41039/41039
Traceback (most recent call last):
File "W:\Personal\Repos\ebook2audiobook\lib\functions.py", line 709, in assemble_audio
combined_audio.export(assembled_audio, format=audioproc_format)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\site-packages\pydub\audio_segment.py", line 895, in export
wave_data.writeframesraw(pcm_for_wav)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 565, in writeframesraw
self._ensure_header_written(len(data))
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 606, in _ensure_header_written
self._write_header(datasize)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 618, in _write_header
self._file.write(struct.pack('<L4s4sLHHLLHH4s',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'L' format requires 0 <= number <= 4294967295
Caught DependencyError: 'L' format requires 0 <= number <= 4294967295
Traceback (most recent call last):
File "W:\Personal\Repos\ebook2audiobook\lib\functions.py", line 709, in assemble_audio
combined_audio.export(assembled_audio, format=audioproc_format)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\site-packages\pydub\audio_segment.py", line 895, in export
wave_data.writeframesraw(pcm_for_wav)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 565, in writeframesraw
self._ensure_header_written(len(data))
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 606, in _ensure_header_written
self._write_header(datasize)
File "W:\Personal\Repos\ebook2audiobook\python_env\Lib\wave.py", line 618, in _write_header
self._file.write(struct.pack('<L4s4sLHHLLHH4s',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'L' format requires 0 <= number <= 4294967295

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "W:\Personal\Repos\ebook2audiobook\lib\functions.py", line 837, in combine_audio_chapters
if assemble_audio():
^^^^^^^^^^^^^^^^
File "W:\Personal\Repos\ebook2audiobook\lib\functions.py", line 713, in assemble_audio
raise DependencyError(e)
lib.functions.DependencyError: 'L' format requires 0 <= number <= 4294967295
Caught DependencyError: 'L' format requires 0 <= number <= 4294967295
convert_ebook() Exception: 'L' format requires 0 <= number <= 4294967295`

@ROBERT-MCDOWELL
Copy link
Collaborator

it's a wav 32bit limited size. we need to add a function assembling the chunks once it reaches the limit which is 4GB.

@ROBERT-MCDOWELL ROBERT-MCDOWELL self-assigned this Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants