Skip to content

Instantly share code, notes, and snippets.

@chepetime
Last active April 24, 2019 15:57
Show Gist options
  • Select an option

  • Save chepetime/4ee53688f6e60dcef6b8d5f96b2a4908 to your computer and use it in GitHub Desktop.

Select an option

Save chepetime/4ee53688f6e60dcef6b8d5f96b2a4908 to your computer and use it in GitHub Desktop.
Transform PDF to mp3

Transform PDF to mp3

Install dependencies

brew install Caskroom/cask/xquartz xpdf
brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac

Transform the pdf to mp3 audio

Make the .pdf a .txt file.

pdftotext book.pdf book.txt

Transform it to voice with mac

say -f book.txt -o book.aiff
say -v Paulina -f book.txt -o book.aiff # If spanish needed

Finally, encode it to .mp3

ffmpeg -i book.aiff -f mp3 -acodec libmp3lame -ab 320000 -ar 44100 book.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment