Skip to content

searlsco/autochapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

autochapter - Automatically add chapters to your podcast

Certified Shovelware

I host a podcast called Breaking Change. Like many podcasts, speech is recorded in mono audio with segments divided by stereo jingles (audio "stingers"). I always wanted to add support for chapters, but for the fact I am very lazy.

Enter autochapter. It analyzes your podcast M4A/MP3 file, identifying each time the audio switches from mono to stereo. It then remuxes your audio file to rewrite the chapter table with whatever names you give each segment.

Install

brew install searlsco/tap/autochapter

Usage

How you invoke autochapter depends on how you decide to name the chapters for each of your podcast's segments.

Setting chapter names via command line flags

You can set each chapter name by repeating the --segment or -s flag like this:

autochapter \
  -s Intro \
  -s Follow-up \
  -s "Aaron's Pun" \
  -s News \
  -s Recommendations \
  -s Mailbag \
  -s Outro \
  v44.mp3

Which will save v44-chapters.mp3

Setting chapter names from a file

If, like me, your podcast always features the same segments, you can point autochapter to a text file with the --segment-file option:

Intro
Follow-up
Aaron's Pun
News
Recommendations
Mailbag
Outro

You can then run:

autochapter --segment-file breaking-change.txt v44.mp3

If you don't provide segments, they'll be named Chapter 01, Chapter 02, and so on.

YouTube chapter text

After each run, autochapter will output the chapters in the format YouTube expects. If you paste them into your video's description, the chapters will appear in the YouTube player.

Chapters:

0:00 Intro
24:11 Follow-up
53:45 Aaron's Pun
56:14 News
1:49:03 Recommendations
2:03:52 Mailbag
2:33:11 Outro

Options

Usage: autochapter [-s SEGMENT]... [--segment-file PATH] [-o OUTPUT] INPUT

Create podcast chapters from stereo stingers.

Options:
  -s, --segment NAME        Segment title (repeat per segment, e.g. `-s Intro`)
      --segment-file PATH  File with one segment name per line
  -o, --output  PATH        Output file (default: input basename with -chapters.ext)
  -h, --help                Show this help

You lied! These timestamps are all wrong!

Be sure that you're not exporting variable bitrate (VBR) MP3s. Apple's AVFoundation stack doesn't play them right, causing timestamp drift. Export in constant bitrate (CBR) or as AAC (M4A) instead.

How it works

Under the hood, autochapter does this:

  1. Encodes the file as PCM to facilitate analysis with ffmpeg, downsampling the audio to 12 kHz to speed things up
  2. Analyzes the left/right energy difference with an inline Python script to detect stereo audio (the heuristic we use to identify the stingers)
  3. Builds an intermediate FFmetadata file with the timestamps of the start of each detected stinger
  4. Remuxes the original audio so only the chapter table changes

A full two-hour show usually finishes in a couple of minutes on modern hardware.

About

Automatically add chapters to your podcast

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages