Skip to content

Add chapter metadata #9

@jborza

Description

@jborza

Was looking at the feature wishlist,
this one looked interesting for audibooks:

  • Add chapter metadata for .m4a files using ffmpeg-bin.

I've checked the docs, and it seems that libsndfile doesn't support m4a/m4b format,
see libsndfile/libsndfile#389

However, ffmpeg does, as you mentioned, and using a command line ffmpeg
ffmpeg -i input.wav -i chapters.txt -map 0:a -map_chapters 1 output.m4b

and having chapters.txt as

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/10
START=0
END=7164
title=Chapter 1

[CHAPTER]
TIMEBASE=1/10
START=7165
END=25329
title=Chapter 2

inserts the chapters into the file - I see them in VLC in Playback->Chapter->Chapter 1/2.

Generating this file isn't that hard, and adding it to the conversion would work,
there's a ffmpeg-python wrapper (https://github.com/kkroening/ffmpeg-python),
the user would need to have ffmpeg installed.

I'm not 100% sure how to do it in the wrapper, but for a prototype I could directly call ffmpeg.

I'll make a prototype in my fork and then we can check it out.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions