TortugaPower / BookPlayer

Player for your DRM-free audiobooks
GNU General Public License v3.0
1.64k stars 197 forks source link

„Big“ audiobook files have no sound after 10 Hours #497

Open semasire opened 4 years ago

semasire commented 4 years ago

A couple of audiobooks with about/over 37 hrs duration, have no sound after 09:58:58. The files work, I checked them with both pc and other audiobooks players. Can you fix this please?

GianniCarlo commented 4 years ago

Hi @semasire ! could you share with us the file so we can debug? or the other option would be if you could pass the file through ffprobe (comes with ffmpeg) and copy/paste the info it has on the file

semasire commented 4 years ago

File 1:

configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mp3, from '/users/smsr/desktop/DieSäulenderErde.mp3': Metadata: encoder : Lavf56.11.100 Duration: 48:48:47.36, start: 0.025057, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc56.10

File 2: configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack libavutil 56. 51.100 / 56. 51.100 libavcodec 58. 91.100 / 58. 91.100 libavformat 58. 45.100 / 58. 45.100 libavdevice 58. 10.100 / 58. 10.100 libavfilter 7. 85.100 / 7. 85.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 7.100 / 5. 7.100 libswresample 3. 7.100 / 3. 7.100 libpostproc 55. 7.100 / 55. 7.100 Input #0, mp3, from '/users/smsr/desktop/SturzderTitanenDieJahrhundert-Saga1_ep9__CET7UfyPdaa68xtnp5-8HKNSVr779o6wvRWs6dVrkYXXZifRY2c5Hgrmn5LzA.mp3': Metadata: encoder : Lavf56.11.100 Duration: 37:02:09.61, start: 0.025057, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc56.10

ahoereth commented 2 years ago

I also ran into something similar just note. Length 43 hours, no audio after 16:40h. Also re importing the file, which did not help

pichfl commented 2 years ago

Historically there was a limit ~10 or ~13h in m4b files, maybe something in iOS still walks into this?

ahoereth commented 2 years ago

So I am able to play the full mp3 using the files app.. trying a different mp3 audiobook app (“mp3 audiobook player”) everything works fine as well.

GianniCarlo commented 2 years ago

We use AVPlayer and AVPlayerItem for playback, which are native APIs for audio playback. Whenever I run into files that are behaving oddly, I run them by ffmpeg, using the copy command which remuxes the file, and strips whatever was odd with it, basically fixing it.

Right now adding third party libraries to replace the native player, or going with a lower level API to possibly handle these cases is not within our short to midterm goals, We're working on something for users that aren't comfortable using command-line tools, so ffmpeg will be easier to use in tandem with BookPlayer

ahoereth commented 2 years ago

Do you have an example command for me? Happy to run it

GianniCarlo commented 2 years ago

@ahoereth sure! ffmpeg -i damagedfile.m4b -c copy newfile.m4b, let me know when you reimport if you still experience the issue

ahoereth commented 2 years ago

Sadly, did not help. Problem is exactly the same at the same timepoint.

Before

ffprobe ....mp3
ffprobe version 4.4.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mp3, from '':
  Metadata:
    encoder         : Lavf58.48.100
  Duration: 43:43:54.07, start: 0.025056, bitrate: 82 kb/s

After

❯ ffprobe ....mp3
ffprobe version 4.4.1 Copyright (c) 2007-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4.1_3 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox
  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
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mp3, from '':
  Metadata:
    encoder         : Lavf58.76.100
  Duration: 43:43:54.07, start: 0.025056, bitrate: 82 kb/s
ahoereth commented 2 years ago

Mhh after I ran the following it now works:

ffmpeg -I ....mp3 -c:a libfdk_aac -c:v copy ....m4b
Geordon commented 2 years ago

ffmpeg -i ....mp3 -c:a libfdk_aac -c:v copy ....m4b

Mhh after I ran the following it now works:

ffmpeg -I ....mp3 -c:a libfdk_aac -c:v copy ....m4b

@ahoereth Could you by chance help me decode that command line for Apple? This is what I get when I try to run that command with ffmpeg downloaded directly from their website:

~/Downloads/ffmpeg -I ....mp3 -c:a libfdk_aac -c:v copy ....m4b ffmpeg version 5.0-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 11.0.0 (clang-1100.0.33.17) configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Unrecognized option 'I'. Error splitting the argument list: Option not found

I get similar results when running from a copy installed via Homebrew:

`ffmpeg -I ....mp3 -c:a libfdk_aac -c:v copy ....m4b

ffmpeg version 5.0 Copyright (c) 2000-2022 the FFmpeg developers built with Apple clang version 13.0.0 (clang-1300.0.29.3) configuration: --prefix=/usr/local/Cellar/ffmpeg/5.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Unrecognized option 'I'. Error splitting the argument list: Option not found`

GianniCarlo commented 2 years ago

There's a typo in the original instruction, it's not capital -I but lowercase -i

GianniCarlo commented 2 years ago

cc @Geordon

Geordon commented 2 years ago

cc @Geordon

Ah, thanks. That disposes of the unrecognized option error, but now I get "....mp3: No such file or directory" so I changed the command to :

ffmpeg -i *.mp3 -c:a libfdk_aac -c:v copy $1.m4b

I get the metadata and chapter info displayed but now I'm getting "Unknown encoder 'libfdk_aac'" Research points to the fdk_aac library not being included in the default FFMPEG distro due to licensing incompatibilites. Changing that command line to

ffmpeg -i *.mp3 -c:a aac -c:v copy $1.m4b

looks like it's giving the desired final output from an MP3 to correctly chapterized M4B. Thanks for your help, @GianniCarlo !

GianniCarlo commented 2 years ago

the aac is good to know 🙌 , I had to reinstall ffmpeg with the libfdk_aac option 😅. I'll add a section about ffmpeg in the wiki with useful commands