Skip to content

taher-el-mehdi/story-to-video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ₯ Story to Video

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:

πŸš€ 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.

How to Use

1. Launch the Tool

python main.py

You will be prompted to enter:

  • PDF path of the book
  • Page range
  • Story name (folder)

Example prompt:

python main.py

# Book: book.pdf
# Start page number: 5
# Stop page number: 15
# Story: my_story

2. Script List

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

πŸ›  Folder Structure

.
β”œβ”€β”€ 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

πŸ“¦ Requirements

Install dependencies:

pip install pedalboard soundfile numpy moviepy

About

πŸŽ₯ command-line Python tool that allows you to convert a PDF story into a video.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages