rmcrackan / Libation

Libation: Liberate your Library
GNU General Public License v3.0
2.5k stars 135 forks source link

downloaded .m4b files don't play on iPod mini as-is #947

Open 0x53A opened 1 month ago

0x53A commented 1 month ago

Describe the bug This is likely to be an issue with the iPod, not with Libation, nevertheless, maybe it is possible to workaround the issue here, as it's unlikely for the iPod to receive any new features or bugfixes.

To Reproduce Steps to reproduce the behavior:

Platform

Win 11 x64 iPod Mini Gen 2 with latest firmware Libation 11.1.0.1 Classic

Workaround

The file successfully plays by either

a) transcode in iTunes:

select the file, then in the menu: File -> Convert -> Create AAC Version". This creates an m4a file that's significantly bigger (from 48 MB to 198 MB for 1 hour 45 minutes). Rename m4a to m4b (so the iPod correctly classifies it as an audiobook, not music), sync, it works.

The disadvantage is that I lose the chapter information, probably because it's actually an m4a file, not a true m4b file.

or

b) transcode in ffmpeg

ffmpeg -i input.m4b -vn -y -b:a 64k -aac_pns 0 output.m4b, this creates a file that's around the same size (48 MB -> 50 MB), still contains the chapter information and plays on the iPod. It doesn't contain the cover art (-vn), and iPods don't support PNS (-aac_pns 0), without this flag you get a crackling noise.

Request

It would be great if I could skip the intermediary transcode step and directly import the files from Libation.

If the reason that the files don't play on the iPod isn't a bug per se, but because of a newer, better, more efficient codec, then maybe a compatibility switch in the settings?

CLHatch commented 1 month ago

I have no idea if this would fix your issue at all, but it's worth a shot, since the resulting .m4b file would be slightly different with this option set. Try having Libation move the "moov atom" to the start of the file, maybe? Here's where that option is in the settings.

image

0x53A commented 1 month ago

Thank you for the suggestion! unfortunately that didn't help.

I noticed that running ffmpeg on the file shows one warning: [mov,mp4,m4a,3gp,3g2,mj2 @ 000002164b254c00] stream 0, timescale not set. No idea if that is relevant.

My other idea would be that the crash is related to the cover art, the file has a total of three streams, one of the streams is a video stream (I believe cover art is implemented by a video stream with a single frame)

Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 62 kb/s (default)
      Metadata:
        creation_time   : 2019-05-24T13:30:39.000000Z
        handler_name    : ?Apple Sound Media Handler
        vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Data: bin_data (text / 0x74786574) (default)
      Metadata:
        creation_time   : 2019-05-24T13:30:39.000000Z
        handler_name    : ?Apple Text Media Handler
  Stream #0:2[0x0]: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 2400x2400 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
0x53A commented 1 month ago

Well, i can confirm that it's not the cover art. I disabled writing cover art by hacking the code, checked that there's now only two streams instead of three with ffmpeg, and it still doesn't play.

CLHatch commented 1 month ago

Well, i can confirm that it's not the cover art. I disabled writing cover art by hacking the code, checked that there's now only two streams instead of three with ffmpeg, and it still doesn't play.

I'm not that familiar with iOS devices, but perhaps another player? It appears they have VLC for iOS, could try that. Or if you have a PC at home to use as a server, you have the option of setting up Audiobookshelf on that to use as your own audiobook server, and stream to it from that. Although the iOS app for that is currently in "testflight", so can be a bit of a pain to install from what I understand (I use ABS and the Android app myself).

0x53A commented 1 month ago

It's this one, no apps :D

image

CLHatch commented 1 month ago

It's this one, no apps :D

image

Oh, wow! :-D Blast from the past. :-D

CLHatch commented 1 month ago

Might be better off with .mp3 conversion for an old device like that, perhaps? Have the option of reducing quality that way to save space also.

CLHatch commented 1 month ago

Oh, also, perhaps it's an issue with the bitrate of the files, maybe the old that device has an upper limit. So if you have that "Audio quality" at the top set to "High", could try changing it to "Normal".

0x53A commented 1 month ago

Sure, there's workarounds, but if possible I'd prefer to only have a single version of the audiobook, in good quality and with chapter support. In principle, the iPod supports m4b, there's just something with the files produced by Libation that doesn't work.

Regarding bitrate, the file transcoded by ffmpeg with the same bitrate works, my sample file only has a low bitrate anyway.

Original produced by Libation

 Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 62 kb/s (default)

Transcoded by ffmpeg (ffmpeg -i input.m4b -vn -y -b:a 64k -aac_pns 0 output.m4b)

Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 65 kb/s (default)
zkte commented 3 weeks ago

you can try splitting the m4b using https://github.com/nu774/m4acut that worked for me for Sansa Clip as it doesn't have enough RAM to load the whole index.

CLHatch commented 3 weeks ago

you can try splitting the m4b using https://github.com/nu774/m4acut that worked for me for Sansa Clip as it doesn't have enough RAM to load the whole index.

If that works, then another option that would probably work for most books is to keep them as .m4b files but split by chapters. Most books I would think that would reduce the size of the files enough.