aedocw / epub2tts-edge

epub2tts-edge uses Microsoft Edge cloud-based TTS to create a full featured audiobook m4b from an epub or text file
GNU General Public License v3.0
77 stars 13 forks source link

ffmpeg issues on linux #11

Closed aedocw closed 5 months ago

aedocw commented 5 months ago

Latest release working fine for me on osx, but hitting codec issues on linux, got these errors during final ffmpeg steps:

Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> flac (native))
Press [q] to stop, [?] for help
[mp4 @ 0x562cd8e52ac0] flac in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Error initializing output stream 0:0 -- 
Conversion failed!

and

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a3f0663c80] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55a3f0663c80] moov atom not found
slavery2-en-US-ChristopherNeural.m4a: Invalid data found when processing input
danielw97 commented 5 months ago

I'm not sure what's going on with this, although just to say that I encountered the same intermittently on linux. I know this isn't super helpful, although at least in my case it seems to have cleared up. I believe it was due to the fact I was on a system with limited free ram at the time and it doesn't leave enough overhead to process the files. Hth a bit.'

danielw97 commented 5 months ago

Hi again, I'm now getting an error on linux after about paragraph 180 or so. I've tested this both on wsl (ubuntu 22.04) as well as a virtual machine running debian 12. Here's the traceback I'm getting:

Traceback (most recent call last):
File "/home/daniel/epub2tts-edge/.venv/bin/epub2tts-edge", line 33, in
sys.exit(load_entry_point('epub2tts-edge==1.1.2', 'console_scripts', 'epub2tts-edge')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/daniel/epub2tts-edge/.venv/lib/python3.11/site-packages/epub2tts_edge/epub2tts_edge.py", line 308, in main files = read_book(book_contents, args.speaker)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/daniel/epub2tts-edge/.venv/lib/python3.11/site-packages/epub2tts_edge/epub2tts_edge.py", line 154, in read_book
append_silence(filenames[-1], 1200)
File "/home/daniel/epub2tts-edge/.venv/lib/python3.11/site-packages/epub2tts_edge/epub2tts_edge.py", line 129, in append_silence
audio = AudioSegment.from_file(tempfile)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/daniel/epub2tts-edge/.venv/lib/python3.11/site-packages/pydub/audio_segment.py", line 773, in from_file
raise CouldntDecodeError(
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[mp3 @ 0x5573b3c6b280] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 0x5573b3c6b280] Failed to read frame size: Could not seek to 1026.
paras2.mp3: Invalid argument

Ffmpeg version is ffmpeg version 4.4.2-0ubuntu0.22.04.1 I'm happy to try a later version if needed, as we're now up to ffmpeg version 7 I believe.

aedocw commented 5 months ago

Committing a fix, think it's sorted now.