patrickenfuego / Chapterize-Audiobooks

Split a single, monolithic mp3 audiobook file into chapters using Machine Learning and ffmpeg.
Apache License 2.0
86 stars 14 forks source link

ERROR: Failed to generate timecode file with vosk: module 'srt' has no attribute 'Subtitle' #21

Open margiezilla opened 3 months ago

margiezilla commented 3 months ago

Hi @patrickenfuego, I'm trying to use your package to chapterize an audiobook, and I've successfully installed (with pip) rich, vosk, and requests and even reinstalled them (after purging pip cache), but I am running into this error. Because I wanted to try and troubleshoot the issue I removed the -loglevel quiet flag from chapterize_ab.py#760 as was suggested in this issue https://github.com/patrickenfuego/Chapterize-Audiobooks/issues/17 so that the output would be verbose.

This is the error below. Any help would be appreciated. Thank you! M

pip3 install vosk
Collecting vosk
  Downloading vosk-0.3.45-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.metadata (1.8 kB)
Requirement already satisfied: cffi>=1.0 in /home/homc/miniforge3/lib/python3.10/site-packages (from vosk) (1.16.0)
Requirement already satisfied: requests in /home/homc/miniforge3/lib/python3.10/site-packages (from vosk) (2.31.0)
Requirement already satisfied: tqdm in /home/homc/miniforge3/lib/python3.10/site-packages (from vosk) (4.66.2)
Requirement already satisfied: srt in /home/homc/miniforge3/lib/python3.10/site-packages (from vosk) (3.5.3)
Requirement already satisfied: websockets in /home/homc/miniforge3/lib/python3.10/site-packages (from vosk) (12.0)
Requirement already satisfied: pycparser in /home/homc/miniforge3/lib/python3.10/site-packages (from cffi>=1.0->vosk) (2.22)
Requirement already satisfied: charset-normalizer<4,>=2 in /home/homc/miniforge3/lib/python3.10/site-packages (from requests->vosk) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in /home/homc/miniforge3/lib/python3.10/site-packages (from requests->vosk) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in /home/homc/miniforge3/lib/python3.10/site-packages (from requests->vosk) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in /home/homc/miniforge3/lib/python3.10/site-packages (from requests->vosk) (2024.2.2)
Downloading vosk-0.3.45-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (7.2 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.2/7.2 MB 3.4 MB/s eta 0:00:00
Installing collected packages: vosk
Successfully installed vosk-0.3.45

python3 ./chapterize_ab.py /mnt/c/Users/Orca/Downloads/redacted.mp3 -ca /mnt/c/Users/Orca/Downloads/redacted.jpg
─────────────────────────── Starting script 
Preparing chapterfying magic ⚡...
──────────────────────── Extracting metadata 
SUCCESS! Metadata extraction complete
Merging extracted and user metadata...
─────────────────────────── ID3 Metadata 
│ {'title': 'redacted', 'artist': 'redacted', 'album': 'redacted', 'cover_art': PosixPath('/mnt/c/Users/Orca/Downloads/redacted_cover.jpg'), 'genre': 'Audiobook'}        │
──────────────────────── Discovering Cover Art 

SUCCESS! Cover art is...covered!
──────────────────────── Generating Timecodes 
✅ Local ML model found. Language: 'en-us'

▐  ⠠     ▌ Sit tight, this might take a while...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 @ 0x7fffe79f0340] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/mnt/c/Users/Orca/Downloads/redacted.mp3':
  Metadata:
    title           : redacted
    artist          : redacted
    album           : redacted
  Duration: 10:45:46.42, start: 0.000000, bitrate: 64 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, s16le, to 'pipe:':
  Metadata:
    title           : redacted
    artist          : redacted
    album           : redacted
    encoder         : Lavf58.76.100
  Stream #0:0: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
    Metadata:
      encoder         : Lavc58.134.100 pcm_s16le
▐⠂       ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -2 -2
[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -2 -2
▐⠠       ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -6 enddists: -2 -2
▐ ⠠      ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -5 -5
[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -1 -1
▐      ⠈ ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -2 -2
[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -5 -5
[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -2 -2
▐    ⠂   ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -5 -5
[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -1 -1
[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -6 -6
[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -1 -1
[mp3float @ 0x7fffe79f5640] overread, skip -7 enddists: -2 -2
▐      ⠂ ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -1 -1
[mp3float @ 0x7fffe79f5640] overread, skip -6 enddists: -5 -5
▐⠈       ▌ Sit tight, this might take a while...[mp3float @ 0x7fffe79f5640] overread, skip -6 enddists: -1 -1
[mp3float @ 0x7fffe79f5640] overread, skip -5 enddists: -4 -4
▐    ⠂   ▌ Sit tight, this might take a while...size= 1210825kB time=10:45:46.40 bitrate= 256.0kbits/s speed=19.3x
video:0kB audio:1210825kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
ERROR: Failed to generate timecode file with vosk: module 'srt' has no attribute 'Subtitle'