geigi/cozy

Apple M4B files not opening

tiagomscampos opened this issue · 8 comments

Bug/Feature description

I recently started using Cozy and had no issues playing audiobooks with M4B format. I downloaded some audiobooks purchased through Apple Books (also in M4B) but Cozy will not play them. I am not sure why but when I do the "Scan Library" option it tells me that "Some files could not be imported" due to potential reasons such as:

  • The audio format is not supported (it's M4B so it should)
  • The path or filename contains non utf-8 characters (I made sure to use only normal characters and still didn't work)
  • The file(s) are no valid audio files (I can play them with Apple Books)
  • The file(s) are corrupt (again, I can play these files with Apple Books)

I can't seem to find any similar issues online. Any idea why could this be? Is there something I am missing? Thank you.

Steps to reproduce

System Information

  • Operating System: Ubuntu 22.04 LTS
  • Installation source:
  • Version of cozy: 1.2.1

I suspect the files are DRM protected, but that's just a hunch. In case I'm able to successfully build Cozy 1.3 or 1.2.1 on macOS I will test this.


I won’t be able to test, as I cannot even get the GTK toolchain to build right now…

I have encountered M4B files that suffer the same problem. I can confirm that these files are not DRM-protected. They play fine in Amberol and Decibels.

Here is the output of ffprobe on one of the files, in case it's helpful:

ffprobe version n6.1.1 Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5dbb7c082dc0] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Reinventing Organizations - Part 1.m4b':
  Metadata:
    major_brand     : M4A 
    minor_version   : 1
    compatible_brands: M4A mp42isom
    creation_time   : 2016-06-27T08:30:28.000000Z
    title           : Reinventing Organizations
    track           : 1/1
    album           : Reinventing Organizations
    genre           : Audiobooks
    date            : 2014
    copyright       : Frederic Laloux
    artist          : Frederic Laloux
    album_artist    : Seamus Kennedy
    encoder         : Audiobook Builder 1.5.5 (www.splasm.com), QuickTime 7.7.3
    description     : The way we manage organizations seems increasingly out of date. "Reinventing Organizations" describes how a new management paradigm is currently emerging, and discusses in practical detail how organizations large and small can operate in fundamentally new
    synopsis        : The way we manage organizations seems increasingly out of date. "Reinventing Organizations" describes how a new management paradigm is currently emerging, and discusses in practical detail how organizations large and small can operate in fundamentally new
    media_type      : 2
  Duration: 02:06:13.30, start: 0.000000, bitrate: 66 kb/s
  Chapters:
    Chapter #0:0: start 0.000000, end 1385.298333
      Metadata:
        title           : 001 - Introduction
    Chapter #0:1: start 1385.298333, end 1806.573333
      Metadata:
        title           : 002 - 1.1 Changing Paradigms
    Chapter #0:2: start 1806.573333, end 2262.696667
      Metadata:
        title           : 003 - 1.1 Infrared through Red paradigms
    Chapter #0:3: start 2262.696667, end 2551.480000
      Metadata:
        title           : 004 - 1.1 Conformist-Amber paradigm
    Chapter #0:4: start 2551.480000, end 3177.711667
      Metadata:
        title           : 005 - 1.1 Amber Organizations
    Chapter #0:5: start 3177.711667, end 3521.508333
      Metadata:
        title           : 006 - 1.1 Achievement-Orange paradigm
    Chapter #0:6: start 3521.508333, end 4036.353333
      Metadata:
        title           : 007 - 1.1 Orange Organizations
    Chapter #0:7: start 4036.353333, end 4288.353333
      Metadata:
        title           : 008 - 1.1 Organizations as Machines
    Chapter #0:8: start 4288.353333, end 4579.408333
      Metadata:
        title           : 009 - 1.1 Pluralistic-Green paradigm
    Chapter #0:9: start 4579.408333, end 5114.081667
      Metadata:
        title           : 010 - 1.1 Green Organizations
    Chapter #0:10: start 5114.081667, end 5238.291667
      Metadata:
        title           : 011 - 1.1 From Red to Green
    Chapter #0:11: start 5238.291667, end 6107.620000
      Metadata:
        title           : 012 - 1.2 About Stages of Development
    Chapter #0:12: start 6107.620000, end 6604.625000
      Metadata:
        title           : 013 - 1.3 Evolutionary-Teal
    Chapter #0:13: start 6604.625000, end 7025.038333
      Metadata:
        title           : 014 - 1.3 Building on Strengths
    Chapter #0:14: start 7025.038333, end 7294.515000
      Metadata:
        title           : 015 - 1.3 Striving for Wholeness
    Chapter #0:15: start 7294.515000, end 7573.301667
      Metadata:
        title           : 016 - 1.3 What this could mean for Teal Organizations
  Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2016-06-27T08:30:28.000000Z
      handler_name    : Apple Sound Media Handler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj420p(pc, bt470bg/unknown/unknown), 511x511 [SAR 72:72 DAR 1:1], 0 kb/s, 0.0001 fps, 0.0001 tbr, 600 tbn (default) (attached pic) (timed thumbnails)
    Metadata:
      creation_time   : 2016-06-27T08:30:36.000000Z
      handler_name    : ?Apple Video Media Handler
      vendor_id       : appl
      encoder         : Photo - JPEG
  Stream #0:2[0x3](eng): Data: bin_data (text / 0x74786574)
    Metadata:
      creation_time   : 2016-06-27T08:30:36.000000Z
      handler_name    : ?Apple Text Media Handler
  Stream #0:3[0x0]: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1022x1022 [SAR 144:144 DAR 1:1], 90k tbr, 90k tbn (attached pic)
Unsupported codec with id 98314 for input stream 2

I've got cozy on two machines, using the same synced folder. On one machine I have this problem with m4b files (not DRM'ed), and on the other cozy works just fine.

One is snap (it has the problem) the other is from flathub. So perhaps it's prerequisite files installed on the system?

The snap package seems to be outdated, and also missing some plugins for playing m4b files. I would advise using the Flatpak version, as that is the officially supported distribution surce of Cozy

Yeah, once I moved to flatpak, I went from ~20 m4b files I couldn't read to 1.

The unique things about this file seems to be profile=HE-AAC, so if anyone is having trouble, after using the flatpak version, it could be because the file is HE-AAC. Below if the diff between a file that can be read (red) and one that can't (green).

image

It looks like ffmpeg is often compiled without he-acc support, so that could be why.

Thanks for the details! They're really useful.
After a quick research, it looks like HE-AAC decoding is not supported by libav and thus by GStreamer. I don't think we can do anything here :((