[Bug]: metadata embedded in m4b files is not recognizable outside Audiobookshelf. #364

Closed
opened 2026-04-24 23:06:20 +02:00 by adam · 8 comments
Owner

Originally created by @kalpaucjusz on GitHub (May 19, 2022).

Describe the issue

I know that embedding metadata is currently experimental but as for now metadata embedded in m4b files is not recognizable by Mp3Tag, VLC, Potplayer and Smart Audiobook Player. Metadata shows up in Mediainfo, except for cover, and looks fine, so I don't really know why it doesn't work.

Steps to reproduce the issue

  1. Embed Metadata

Audiobookshelf version

2.0.14

How are you running audiobookshelf?

Docker

Originally created by @kalpaucjusz on GitHub (May 19, 2022). ### Describe the issue I know that embedding metadata is currently experimental but as for now metadata embedded in m4b files is not recognizable by Mp3Tag, VLC, Potplayer and Smart Audiobook Player. Metadata shows up in Mediainfo, except for cover, and looks fine, so I don't really know why it doesn't work. ### Steps to reproduce the issue 1. Embed Metadata ### Audiobookshelf version 2.0.14 ### How are you running audiobookshelf? Docker
adam added the bug label 2026-04-24 23:06:20 +02:00
adam closed this issue 2026-04-24 23:06:21 +02:00
Author
Owner

@advplyr commented on GitHub (May 19, 2022):

m4b doesn't have the same id3 tags as mp3. m4b is the same as mp4 so it can be found by looking up the mp4 id3 tags.

Abs will embed the meta tags as custom meta tags if they aren't supported. For example, mp4 doesn't support the publisher meta tag, so abs will embed the publisher meta tag as a custom meta tag called "publisher". Mp3Tag may not be reading these custom tags I'm not sure haven't used it.

@advplyr commented on GitHub (May 19, 2022): m4b doesn't have the same id3 tags as mp3. m4b is the same as mp4 so it can be found by looking up the mp4 id3 tags. Abs will embed the meta tags as custom meta tags if they aren't supported. For example, mp4 doesn't support the publisher meta tag, so abs will embed the publisher meta tag as a custom meta tag called "publisher". Mp3Tag may not be reading these custom tags I'm not sure haven't used it.
Author
Owner

@kalpaucjusz commented on GitHub (May 19, 2022):

Is Abs currently save metadata as ID3 in MP4 files instead of standard XMP?

@kalpaucjusz commented on GitHub (May 19, 2022): Is Abs currently save metadata as ID3 in MP4 files instead of standard XMP?
Author
Owner

@advplyr commented on GitHub (May 24, 2022):

Is XMP standard for mp4 files? It doesn't look like ffmpeg can write XMP metadata.

@advplyr commented on GitHub (May 24, 2022): Is XMP standard for mp4 files? It doesn't look like ffmpeg can write XMP metadata.
Author
Owner

@kalpaucjusz commented on GitHub (May 24, 2022):

My bad. It isn't. MP4 have its own metadata format and XMP is optional. But I don't think that's the problem. I manually added metadata tags using ffmpeg, except for cover, it didn't want to add png nor jpg and I have no time to figure it out, and most of them works fine.

m4bout.zip

Here you have an example of file (fragment of public domain audiobook) made by Audiobookshelf and using ffmpeg command line. Metadata from ffmpeg version shows up in Mp3Tag, VLC, and Smart Audiobook Player, metadata from Audiobookshelf doesn't.

@kalpaucjusz commented on GitHub (May 24, 2022): My bad. It isn't. MP4 have its own metadata format and XMP is optional. But I don't think that's the problem. I manually added metadata tags using ffmpeg, except for cover, it didn't want to add png nor jpg and I have no time to figure it out, and most of them works fine. [m4bout.zip](https://github.com/advplyr/audiobookshelf/files/8761521/m4bout.zip) Here you have an example of file (fragment of public domain [audiobook](https://librivox.org/antigone-by-sophocles/)) made by Audiobookshelf and using ffmpeg command line. Metadata from ffmpeg version shows up in Mp3Tag, VLC, and Smart Audiobook Player, metadata from Audiobookshelf doesn't.
Author
Owner

@jmt-gh commented on GitHub (Jun 5, 2022):

@kalpaucjusz can you share the ffmpeg command that you used to generate the working one?

@jmt-gh commented on GitHub (Jun 5, 2022): @kalpaucjusz can you share the ffmpeg command that you used to generate the working one?
Author
Owner

@kalpaucjusz commented on GitHub (Jun 5, 2022):

Oh, I forgot to past it, but it was still in command history history.

.\bin\ffmpeg.exe -i .\test.m4b -metadata title="Antigone" -metadata artist="Sophocles" -metadata album_artist="Sophocles" -metadata date="2000" -metadata description="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." -metadata genre="test genre" -metadata language="english" -metadata series="test series" -metadata track="1" -c copy out.m4b

But you can also use -map-metadata to insert file with tags.

And if you extract metadata from Audiobookshlef made file using

ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
and then add it back without changing anything

ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
It's working with VLC and everything, but some tags are lost and major_brand and compatible_brands are changed. It automatically changes from this

;FFMETADATA1
major_brand=isom
minor_version=512
compatible_brands=isomiso2mp41
title=Antigone
artist=Sophocles
album_artist=Sophocles
date=2000
description=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
genre=test genre
performer=test narrator
encoded_by=audiobookshelf:2.0.15
language=english
series=test seriers
track=1
encoder=Lavf59.24.100
[CHAPTER]
TIMEBASE=1/1000
START=0
END=599999
title= 2 - Part 2 

to this when you extract metadata from output m4b file

;FFMETADATA1
major_brand=M4A 
minor_version=512
compatible_brands=M4A isomiso2
title=Antigone
artist=Sophocles
album_artist=Sophocles
date=2000
track=1
genre=test genre
description=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
encoder=Lavf59.24.100
[CHAPTER]
TIMEBASE=1/1000
START=0
END=599999
title= 2 - Part 2

And just in case, my ffmpeg version:

 .\bin\ffmpeg.exe -version
ffmpeg version N-106965-g6076dbcb55-20220523 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (crosstool-NG 1.24.0.533_681aaef)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220523
libavutil      57. 25.100 / 57. 25.100
libavcodec     59. 28.100 / 59. 28.100
libavformat    59. 24.100 / 59. 24.100
libavdevice    59.  6.100 / 59.  6.100
libavfilter     8. 38.100 /  8. 38.100
libswscale      6.  6.100 /  6.  6.100
libswresample   4.  6.100 /  4.  6.100
libpostproc    56.  5.100 / 56.  5.100

Edit: formating

@kalpaucjusz commented on GitHub (Jun 5, 2022): Oh, I forgot to past it, but it was still in command history history. ` .\bin\ffmpeg.exe -i .\test.m4b -metadata title="Antigone" -metadata artist="Sophocles" -metadata album_artist="Sophocles" -metadata date="2000" -metadata description="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." -metadata genre="test genre" -metadata language="english" -metadata series="test series" -metadata track="1" -c copy out.m4b` But you can also use -map-metadata to insert file with tags. And if you extract metadata from Audiobookshlef made file using `ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE ` and then add it back without changing anything `ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT ` It's working with VLC and everything, but some tags are lost and major_brand and compatible_brands are changed. It automatically changes from this ``` ;FFMETADATA1 major_brand=isom minor_version=512 compatible_brands=isomiso2mp41 title=Antigone artist=Sophocles album_artist=Sophocles date=2000 description=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. genre=test genre performer=test narrator encoded_by=audiobookshelf:2.0.15 language=english series=test seriers track=1 encoder=Lavf59.24.100 [CHAPTER] TIMEBASE=1/1000 START=0 END=599999 title= 2 - Part 2 ``` to this when you extract metadata from output m4b file ``` ;FFMETADATA1 major_brand=M4A minor_version=512 compatible_brands=M4A isomiso2 title=Antigone artist=Sophocles album_artist=Sophocles date=2000 track=1 genre=test genre description=Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. encoder=Lavf59.24.100 [CHAPTER] TIMEBASE=1/1000 START=0 END=599999 title= 2 - Part 2 ``` And just in case, my ffmpeg version: ``` .\bin\ffmpeg.exe -version ffmpeg version N-106965-g6076dbcb55-20220523 Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (crosstool-NG 1.24.0.533_681aaef) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20220523 libavutil 57. 25.100 / 57. 25.100 libavcodec 59. 28.100 / 59. 28.100 libavformat 59. 24.100 / 59. 24.100 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 38.100 / 8. 38.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100 ``` Edit: formating
Author
Owner

@DarkShortie commented on GitHub (Jun 27, 2022):

Unfortunately the mp4 metadata is a huge mess and ffmpeg is only able to write some Quicktime tags. The best solutions I cam e across so far to write are https://github.com/quodlibet/mutagen using a Python script or more enduser friendly and with audiobook focus https://github.com/sandreas/tone

With this you can also set tags like series, nrt (narrator), pub (publisher) and other custom stuff used by Audible or different players.

@DarkShortie commented on GitHub (Jun 27, 2022): Unfortunately the mp4 metadata is a huge mess and ffmpeg is only able to write some Quicktime tags. The best solutions I cam e across so far to write are https://github.com/quodlibet/mutagen using a Python script or more enduser friendly and with audiobook focus https://github.com/sandreas/tone With this you can also set tags like series, nrt (narrator), pub (publisher) and other custom stuff used by Audible or different players.
Author
Owner

@advplyr commented on GitHub (Oct 2, 2022):

This should be fixed with the introduction of tone in v2.2.0

We still need to update the scanner to read all of these tags correctly but they should be getting written correctly now at least.

@advplyr commented on GitHub (Oct 2, 2022): This should be fixed with the introduction of tone in [v2.2.0](https://github.com/advplyr/audiobookshelf/releases/tag/v2.2.0) We still need to update the scanner to read all of these tags correctly but they should be getting written correctly now at least.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#364