Powerful and flexible CLI and Node.js library for converting videos/audio and AI transcription, working on Linux, Mac, and Windows.
- β Cross-platform: Works on Linux, macOS, and Windows
- π¦ CLI & Library: Use as command-line tool or Node.js library
- π Multi-Step Workflow: Combine multiple operations in a single flow
- ποΈ AI Transcription: Support for Groq (fast) and OpenAI Whisper
- πΎ State Management: Saves progress of each workflow step
- π Persistent Configuration: API keys saved locally and securely
- π Visual Progress: Track each step of the process
- Node.js
>= 16 - FFmpeg installed and available in PATH
# With Chocolatey
choco install ffmpeg
# With Scoop
scoop install ffmpegbrew install ffmpeg# Ubuntu/Debian
sudo apt update && sudo apt install ffmpeg
# Fedora
sudo dnf install ffmpeg
# Arch Linux
sudo pacman -S ffmpegVerify installation:
ffmpeg -versionnpm installnpm install mediacriptMediaScript can be used programmatically in your Node.js applications:
import { processVideo, transcribeAudioFile } from 'mediacript'
// Process a complete video
const result = await processVideo('video.mp4')
console.log('Transcription:', result.transcription.text)
// Or just transcribe an audio file
const transcription = await transcribeAudioFile('audio.mp3')
console.log(transcription.text)π Complete Library Documentation - Learn about all available functions, workflows, and examples.
π Examples Directory - Practical examples including:
- Basic transcription
- Complete workflows
- Batch processing
- Express.js API
- TypeScript usage
npm startThe CLI will:
- β Check if FFmpeg is installed
- π Request API keys on first run (optional)
- π List media files in the current directory
- π― Allow you to choose the desired workflow
- Convert video + Extract audio + Transcribe: Complete pipeline
- Extract audio from video + Transcribe: To transcribe videos
- Only convert video: Optimize video (H.264/AAC)
- Only extract audio from video: Extract audio as MP3
- Convert audio + Transcribe: Convert and transcribe
- Only transcribe audio: Direct transcription
- Only convert audio: Convert to MP3
The first time you run it, you'll be asked if you want to configure your API keys:
β οΈ No API key found.
? Do you want to configure your API keys now? (Y/n)
π Configure your API keys (optional - press Enter to skip)
? Groq API Key (recommended - faster): sk-proj-...
? OpenAI API Key: sk-...
- Linux/Mac:
~/.config/ffmpeg-simple-converter/config.json - Windows:
%APPDATA%/ffmpeg-simple-converter/config.json
- Visit: https://console.groq.com
- Create a free account
- Generate an API key in "API Keys"
- Visit: https://platform.openai.com
- Create an account
- Add credits
- Generate an API key in "API Keys"
The system automatically tries in the following order:
- Groq (if configured) - faster and cheaper
- OpenAI (fallback) - if Groq fails or is not configured
$ npm start
π¬ FFmpeg Simple Converter - Multi-Step Workflow
β FFmpeg is installed (version: 6.0)
π Found 3 media file(s)
? Select file:
π¬ lecture_video.mp4
β― π΅ podcast.mp3
π¬ presentation.mkv
? Select what you want to do:
β― π¬ Convert video + Extract audio + Transcribe
π¬ Extract audio from video + Transcribe
π΅ Convert audio + Transcribe
ποΈ Only transcribe audio
π Starting workflow: Convert video + Extract audio + Transcribe
π Input file: lecture_video.mp4
[1/3] Convert video...
π¬ Converting video to optimized format...
β Video converted: lecture_video_converted.mp4
[2/3] Extract audio...
π΅ Extracting audio from video...
β Audio extracted: lecture_video_converted_audio.mp3
[3/3] Transcribe audio...
ποΈ Transcribing: lecture_video_converted_audio.mp3
π‘ Trying Groq Whisper (fast)...
β Transcription completed with Groq
β Transcription saved: lecture_video_converted_audio.txt
π Workflow Progress:
ββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. Convert video (12.3s)
β 2. Extract audio (3.1s)
β 3. Transcribe audio (8.7s)
ββββββββββββββββββββββββββββββββββββββββββββββββββ
π¦ Generated files:
β’ Video: lecture_video_converted.mp4
β’ Audio: lecture_video_converted_audio.mp3
β’ Transcription: lecture_video_converted_audio.txtsrc/
βββ config/ # Configuration and API keys management
βββ transcript/ # Transcription modules (Groq and OpenAI)
βββ types/ # TypeScript definitions
βββ utils/ # Utilities (ffmpeg, files, etc)
βββ workflow/ # Workflow management system
βββ index.ts # Main CLI
npm start # Run the interactive CLI
npm run build # Compile TypeScript to JavaScript
npm run dev # Development mode with watch
npm run convert # Run the old converter (convert.js).ogg, .wav, .mp3, .m4a, .aac, .flac
.mp4, .mov, .mkv, .webm, .avi
Each workflow saves its state to .workflow-state.json in the output directory:
{
"steps": [
{
"id": "step-0",
"name": "Convert video",
"status": "completed",
"startTime": 1675436400000,
"endTime": 1675436412300
}
],
"intermediateFiles": {
"convertedVideo": "video_converted.mp4",
"extractedAudio": "video_audio.mp3",
"transcriptionText": "video_audio.txt"
}
}Contributions are welcome! Feel free to open issues and pull requests.
MIT
- FFmpeg for the amazing tool
- OpenAI and Groq for transcription services