Skip to content

Instantly share code, notes, and snippets.

@xiaolai
Last active June 25, 2023 23:44
Show Gist options
  • Save xiaolai/b6ac772a256e9f2d3bbd82520f5023ec to your computer and use it in GitHub Desktop.
Save xiaolai/b6ac772a256e9f2d3bbd82520f5023ec to your computer and use it in GitHub Desktop.
A better way to listen audiobook on MacOS

1. Convert Audible to mp3

Use OpenAudible.

2. Transcribe the audiobook

Use whisper-auto-transcribe.

  1. Install Python 3

  2. Clone the repo

    git clone https://github.com/tomchang25/whisper-auto-transcribe.git
    cd whisper-auto-transcribe
    
  3. Install dependency

    pip install git+https://github.com/openai/whisper.git 
    pip install gradio
    
  4. Install ffmpeg

    # on Ubuntu or Debian
    sudo apt update && sudo apt install ffmpeg
    
    # on MacOS using Homebrew (https://brew.sh/)
    brew install ffmpeg
    
    # on Windows using Chocolatey (https://chocolatey.org/)
    choco install ffmpeg
    
    # on Windows using Scoop (https://scoop.sh/)
    scoop install ffmpeg
    
  5. Open application

    python gui.py
    

Or, use the command line:

python ./cli.py "./7 powers.mp3" --output "./tmp/7 Powers.srt" --task transcribe --model large

3. iina, a player based upon MPV

  • Installation:
brew install iina

or, download from iina Official Website.

  • Create mpv configuration file:
mkdir ~/.config/mpv
cat <<EOT >> ~/.config/mpv/mpv.conf
[extension.mp3]
profile-desc="profile for audiobooks"
audio-display=external-first
sub-align-x=left
sub-margin-x=100
sub-pos=85
sub-font='SauceCodePro Nerd Font'
sub-font-size=50
save-position-on-quit=yes
sub-auto=all
cover-art-auto=all
stop-screensaver=always
# autofit=640
ontop=yes
# Adjust subtitle timing is to remove minor gaps or overlaps
# between subtitles (if the difference is smaller than 210 ms, 
# the gap or overlap is removed).
sub-fix-timing=yes
EOT
  • iina → Settings → Advanced:

    • Enable advanced settings

    • Check Use config directory

4. Cover-art Picture

5. Shortcuts

Navigate to next subtitle: Shift + Right

Navigate to previous subtitle: Shift + Left

Toggle Music Mode: Option + Command + m

Enlarge Window: Command + =

Shrink Window: Command + -

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment