If you already have word timestamps, FFmpeg can mute selected moments without shortening the audiobook. The key is to turn matches into a clean set of time ranges and encode the full recording once.

1. Turn words into ranges

For each detected word, take its start and end time and add a small amount of padding. Merge ranges that overlap; otherwise two close words can create a tiny unmuted gap. Clamp the first start to zero. Review the ranges before processing the full book.

For example, a word at 12.40–12.75 seconds with 0.05 seconds of padding becomes 12.35–12.80. A neighboring range beginning at 12.78 should be merged with it.

2. Try a short manual edit

For one range, an FFmpeg volume filter is easy to understand:

ffmpeg -i book.m4b -af "volume=enable='between(t,12.35,12.80)':volume=0" -c:a aac -map_metadata 0 -map_chapters 0 sample_edited.m4b

This is a teaching example for a single mute. On a real book with many matches, build and inspect the filter expression programmatically. A basic command may also need explicit stream mapping for artwork and subtitles.

3. Use timed commands for many edits

Skip Stuff writes a temporary filter script using asendcmd to set a named volume filter to zero at each range start and back to one at each end. A tiny illustrative script looks like this:

asendcmd=c='12.350000 volume@cleanread volume 0;12.800000 volume@cleanread volume 1',volume@cleanread=1

The production command uses -filter_script:a:0 to read that script. This keeps one continuous filter and encode pass, even for many muted words.

4. Check the output

Compare the input and output durations with ffprobe, inspect chapter count, and listen immediately before, during, and after several mutes. The whole recording is re-encoded because changing audio samples cannot be done with -c:a copy. Muting in place preserves the timeline; it does not guarantee sample-for-sample identical duration after a lossy encoder adds its normal padding.