GS2Video is a Python tool that converts Google Slides presentations into videos. It uses Google Slides API to fetch the presentation content, generates audio using Kokoro TTS, and creates a video with transitions between slides.
- Convert Google Slides presentations to videos
- Generate audio using Kokoro TTS
- Add custom background color and duration for slide transitions
- Keep or remove intermediate files (mp3 and png files)
- Force overwrite existing output video files
Like what I do, Please consider supporting me.
-
Clone the repository:
git clone https://github.com/yourusername/gs2video.git cd gs2video
-
Create a virtual environment and activate it:
python3 -m venv env source env/bin/activate
-
Install the required dependencies:
pip install -r .devcontainer/requirements.txt
-
Set up Google API credentials:
- Create a project in the Google Cloud Console.
- Enable the Google Slides API for your project.
- Create OAuth 2.0 credentials and download the JSON file.
- Save the JSON file as
gs2slide-credential.json
in the project directory.
The CLI allows you to convert Google Slides presentations to videos with various options.
python -m gs2video.cli -p <presentation_id> -o output.mp4 --fps 24 --language en --keep --force --duration 1 --bg_color 0,0,0
-p
,--presentation_id
: The ID of the Google Slides presentation (required).-f
,--fps
: Frames per second (FPS) for the output video (default: 24).-l
,--language
: Language for the text-to-speech (default: 'en').--keep
: Keep intermediate files (mp3 and png files).--force
: Force generate the output video even if it already exists.--duration
: Duration of each slide in seconds (default: 0.5).--bg_color
: Background color during transitions (RGB values as comma-separated integers, default: (0, 0, 0)).-o
,--output
: Output video file (default: "Output_file.mp4").
python -m gs2video.cli -p 1A2B3C4D5E6F7G8H9I0J -o my_presentation.mp4 --fps 30 --language en --keep --force --duration 2 --bg_color 255,255,255
gs2video/
├── gs2video/
│ ├── __init__.py
│ ├── cli.py
│ ├── core.py
│ └── utils.py
├── .gitignore
├── README.md
└── requirements.txt
gs2video/core.py
: Contains theGS2Video
class that handles the conversion of Google Slides presentations to videos.gs2video/cli.py
: Provides the command line interface for the tool.gs2video/utils.py
: Contains utility functions, including thecredential
function for Google API authentication.
The GS2Video
class is responsible for:
- Initializing with credentials, output file, language, FPS, and other options.
- Fetching the presentation content using Google Slides API.
- Generating audio for each slide using Kokoro TTS.
- Creating video clips for each slide and concatenating them with transitions.
- Saving the final video to the specified output file.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.