This is a command-line Python tool that allows you to convert a PDF story into a video. The tool is modular and broken into six steps:
- π Extract pages from a PDF.
- π§Ή Clean the extracted text (remove whitespace, newlines, tabs).
- βοΈ Split story into logical segments based on tokens.
- π Generate audio from text using TTS.
- π΅ Merge generated audios into one track.
- π₯ Merge audio with an image to create an MP4 video.
python main.pyYou will be prompted to enter:
- PDF path of the book
- Page range
- Story name (folder)
python main.py
# Book: book.pdf
# Start page number: 5
# Stop page number: 15
# Story: my_story| Step | Script Name | Description |
|---|---|---|
| 1 | read_pdf.py |
Reads specific pages from a PDF and saves them as a text file in a story folder |
| 2 | clean_story.py |
Cleans the story (removes whitespace, tabs, etc.) |
| 3 | split_story_by_tokens.py |
Splits the story text by logical chunks (tokens) |
| 4 | generate_audios.py |
Generates audio clips for each text chunk |
| 5 | merge_audio_folder.py |
Merges audio clips into one audio file |
| 6 | merge_audio_with_image.py |
Merges final audio with an image into an MP4 video |
.
βββ main.py
βββ src/
β βββ scripts/
β βββ read_pdf.py
β βββ clean_story.py
β βββ split_story_by_tokens.py
β βββ generate_audios.py
β βββ merge_audio_folder.py
β βββ merge_audio_with_image.py
Install dependencies:
pip install pedalboard soundfile numpy moviepy