Patshaala generates short educational video lessons in Indian languages. Enter a topic, pick a language, and the app builds a scene-based lesson with translated voiceover and synced visuals.
- Generates a structured lesson script from a topic using an LLM.
- Translates narration and on-screen text with Sarvam Translate (Mayura).
- Synthesizes dialogue audio with Sarvam TTS (Bulbul v3).
- Computes clip durations from WAV audio and syncs them to scene timing.
- Plays the lesson instantly in-browser with Remotion Player.
- Next.js (App Router) + React + TypeScript
- Remotion +
@remotion/player - Sarvam APIs (Translate + TTS)
- OpenRouter via Vercel AI SDK for script generation
- Tailwind CSS
POST /api/generatereceives{ topic, language }.- LLM generates scene JSON (
title->summary) with dialogue. - Text is translated to the selected language.
- Each dialogue line is converted to speech.
- WAV duration is converted to frames (
fps = 30). - Client renders
LessonVideowith synchronized audio + visuals.
titlebulletsdefinitionstepscomparisontimelineexamplequizhighlightsummary
hi-IN, bn-IN, ta-IN, te-IN, gu-IN, kn-IN, ml-IN, mr-IN,
pa-IN, od-IN, en-IN
- Node.js 20+ (LTS recommended)
- npm
- API keys for Sarvam and OpenRouter
npm installCreate .env.local in the project root:
SARVAM_API_KEY=your_sarvam_key
OPENROUTER_API_KEY=your_openrouter_key
TTS_CONCURRENCY=6Notes:
TTS_CONCURRENCYis optional and defaults to6..env.localis gitignored.
npm run devOpen http://localhost:3000.
npm run build
npm run startRequest body:
{
"topic": "Photosynthesis for class 8",
"language": "hi-IN"
}Response shape:
{
"scenes": [
{
"type": "title",
"data": {},
"dialogueClips": [
{
"role": "teacher",
"speakerVoice": "gokul",
"translatedText": "...",
"audioUrl": "data:audio/wav;base64,...",
"durationInFrames": 120
}
],
"durationInFrames": 240
}
],
"totalDurationInFrames": 1800,
"fps": 30,
"language": "hi-IN"
}src/
app/
api/generate/route.ts # Main generation endpoint
page.tsx # UI + Remotion Player
lib/
llm/ # LLM prompt + script generation
pipeline/ # Topic -> translated scenes + audio clips
sarvam/ # Translate and TTS API clients
remotion/
LessonVideo.tsx # Root composition
SceneRenderer.tsx # Scene component switch
scenes/ # Individual scene UIs
components/ # Shared remotion components
- The app currently plays generated videos in-browser (no MP4 export flow).
- Generation latency depends on LLM + translation + TTS API response times.
- API limits and billing are controlled by your Sarvam/OpenRouter accounts.