Skip to main content

This tool parses a Table of Contents file and:

  • Optionally, shows HTML in your browser and print it too on the console, for copy&paste or redirection to complete your show notes.

  • TODO: Optionally, adds the TOC generated HTML to an audio file.

  • Optionally, adds timestamps (chapters) from your TOC file to an audio file.

  • Optionally, adds timeoffsets to all timestamps (in the HTML and in the chapters) in order to compensate from initial presentation or teasers, advertisements during the audio, etc.

If the audio file already has chapter/TOC metadata, we will replace it as requested. The rest of the metadata presents in the original file will be preserved.

Install

$ python3 -m pip install toc2audio

Command line

$ toc2audio --version
0.5.0

$ toc2audio -h
usage: toc2audio.py [-h] [--version] [--offset OFFSET] [--show]
                    [--toc] [--chapters]
                    [TOC] [AUDIO ...]

Add Table of Contents and chapters to audio files

positional arguments:
  TOC              Table of Contents file
  AUDIO            Audio file

optional arguments:
  -h, --help       show this help message and exit
  --version        Show version info
  --offset OFFSET  Seconds or [HH:]MM:SS to add to ALL timestamps
  --show           Show the generated HTML in your browser
  --toc            Store Table of Contents in the audio file
  --chapters       Store chapters details in the audio file

Table of Contents format

The Table of Contents must be written in markdown.

toc2audio will parse any markdown file and will, optionally, insert the generated HTML and chapters metadata in your audio file. If you want to use timestamps (chapters), you must use lines in this format:

[HH:MM:SS] Chapter title

HH:MM:SS is hours:minutes:seconds. The “hours” field is optional. You can specify fields with one or two digits.

An example would be:

This audio was recorded blah blah...

* [00:50] Presentation

    Here I describe the topics we will talk about.

* [02:11] Topic 1

    Blah blah blah blah...

* [17:29] Topic 2

    Blah blah blah blah...

Time offset

You can apply a global time offset to all timestamps in the TOC markdown document using the --offset command line parameter.

Supported audio containers

Supported audio containers are:

  • Opus. If you can choose an audio format freely, you should choose Opus. It is the current (2021) state-of-art for general purpose audio (voice and music) and free of patents. It is “the greatest thing since sliced bread”.

  • Vorbis.

  • MP3.

  • M4A (MP4 audio).

    Usually, MP4 audiobooks have a m4b extension to advertise the presence of bookmarks. Nevertheless, the file is bitwise identical to m4a. Some software doesn’t recognize m4b files, so I use a m4a suffix.

    Usually, the audio format will be AAC, HE-AAC or HE-AACv2, but I don’t really care. I manipulate the generic MP4 container, I don’t pay attention to the audio data. I guess I could even add chapters to video data.

Author and License

The author of this package is Jesús Cea Avión.

This code is licensed under Affero GNU Public License v3 (AGPLv3)

Release files for toc2audio 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toc2audio 1.2.0
File Size Uploaded
toc2audio-1.2.0.tar.gz 19.5 kB Details

Release files / toc2audio-1.2.0.tar.gz

Download URL toc2audio-1.2.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7b03cdcd6e7f1f30ec13123b673d71d3c075e97405695b020f6c8c28eeb134d1
BLAKE2b-256 checksum
How to use checksums
fe1eae460198b9e3058569df5d78f916b0b6b1013d2f5f3ef7c2189510b9e973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.13.0

Release history Release notifications | RSS feed

This release

1.2.0 This release

1 release file

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page