Skip to main content

Download, transcribe, and convert videos from YouTube, Loom, Vimeo, and more

Project description

mediakit

Download, transcribe, and convert videos from YouTube, Loom, Vimeo, and more — as a Python library.

from mediakit import download_video, get_transcription, convert

path  = download_video("https://www.loom.com/share/abc123")
text  = get_transcription(path)            # requires OPENAI_API_KEY
mp3   = convert(path, output_format="mp3", reencode=True)

Features

Module What it does
download_video() Download from YouTube, Vimeo, Loom, Wistia, and any yt-dlp supported site
get_transcription() / VideoTranscriber Transcribe audio/video via OpenAI Whisper, auto-chunks files > 25 MB
VideoScriptSummarizer Summarize a transcript with GPT-4
convert() Convert any video/audio format using ffmpeg (mp4→mp3, mkv→mp4, etc.)

Requirements

  • Python ≥ 3.9
  • ffmpeg (for conversion and audio extraction) — install instructions below
  • OpenAI API key (for transcription only)

Installation

From PyPI (once published)

pip install mediakit

Local / development install

git clone https://github.com/yourusername/mediakit
cd mediakit
pip install -e .

With FastAPI server support

pip install "mediakit[server]"

Setup

Copy .env.example to .env and add your OpenAI key:

cp .env.example .env
# edit .env and set OPENAI_API_KEY=sk-...

Usage

Download a video

from mediakit import download_video

# Basic download → saves to ./downloads/
path = download_video("https://youtu.be/dQw4w9WgXcQ")

# Custom output directory and quality
path = download_video("https://youtu.be/dQw4w9WgXcQ", output_dir="my_videos", ytdlp_format="720p")

Supported format presets: default, best, worst, 360p, 480p, 720p, 1080p, 1440p, 4k


Transcribe a video or audio file

from mediakit import get_transcription, VideoTranscriber

# One-liner
text = get_transcription("video.mp4")

# Full control
transcriber = VideoTranscriber()
text = transcriber.transcribe_video("video.mp4")  # handles large files automatically

Files larger than 25 MB are automatically split into chunks before sending to Whisper.


Summarize a transcript

from mediakit import VideoScriptSummarizer

summarizer = VideoScriptSummarizer()
summary = summarizer.generate_summary(transcript_text)

Convert video/audio formats

from mediakit import convert

# mkv → mp4 (stream-copy, fast, no re-encode)
convert("recording.mkv", output_format="mp4")

# mp4 → mp3 (re-encode audio)
convert("video.mp4", output_format="mp3", reencode=True)

# Explicit output path
convert("video.mp4", output_path="/tmp/audio.wav", reencode=True)

# Overwrite if exists
convert("video.mp4", output_format="mp3", reencode=True, overwrite=True)

Supported formats: anything ffmpeg handles — mp4, mp3, mkv, wav, m4a, ogg, flac, opus, webm, etc.


Bulk download from Excel

python -m video_downloader.excel_bulk urls.xlsx

The Excel file needs a column named url (or URL / link). A filename column is optional.


ffmpeg

ffmpeg is required for conversion and audio extraction.

# Ubuntu / Debian
sudo apt install ffmpeg

# macOS
brew install ffmpeg

# Windows
# Download from https://ffmpeg.org/download.html and add to PATH

Architecture

┌─────────────────────────────────────────────────────┐
│                    mediakit                          │
│  ┌──────────────┐  ┌────────────────┐  ┌──────────┐ │
│  │  downloader  │  │  transcription │  │converter │ │
│  │  (yt-dlp +   │  │  (Whisper API  │  │ (ffmpeg  │ │
│  │   requests)  │  │   + GPT-4)     │  │subprocess│ │
│  └──────────────┘  └────────────────┘  └──────────┘ │
└─────────────────────────────────────────────────────┘
         │                   │                  │
   YouTube/Vimeo         OpenAI API         local ffmpeg
   Loom/Wistia           Whisper + GPT      (system dep)

Publishing to PyPI

Here's the full flow to publish your own version:

1. Register at https://pypi.org
2. Enable 2FA on your account
3. Generate an API token (Account Settings → API tokens)

4. Build the package:
   pip install build twine
   python -m build          # creates dist/*.whl and dist/*.tar.gz

5. Test on TestPyPI first (optional but recommended):
   twine upload --repository testpypi dist/*
   pip install --index-url https://test.pypi.org/simple/ mediakit

6. Publish to production PyPI:
   twine upload dist/*
   # enter: __token__ as username, your API token as password

7. Anyone can now install it:
   pip install mediakit

Tip: Store your token in ~/.pypirc or as env var TWINE_PASSWORD so you don't paste it every time.


Running Tests

pip install pytest
pytest tests/

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vid_mediakit-0.1.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vid_mediakit-0.1.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file vid_mediakit-0.1.0.tar.gz.

File metadata

  • Download URL: vid_mediakit-0.1.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for vid_mediakit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 df8b39c354889c9664323e54e201fc763d44e82c60586db910f9c8baaf49ecba
MD5 e7df7a730cd01f63a28a0ed61a3ce592
BLAKE2b-256 bf3b2863660a97a819766abc10da9a65b4f9e352e8ca67b3cd80b6b91a38906b

See more details on using hashes here.

File details

Details for the file vid_mediakit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: vid_mediakit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for vid_mediakit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8df3be5ecce75d7b022dfe11c7148bad8344c689f8f2e673757bca92174143b7
MD5 70d8a5eae131383485c1f13b9de209a6
BLAKE2b-256 0b70486146bcec10dbd61684cfc3319b95031af112134c6dd8da2955187cf2da

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page