Skip to main content

Merleau

"The world is not what I think, but what I live through." — Maurice Merleau-Ponty

A CLI tool for video understanding using Google's Gemini API. Named after Maurice Merleau-Ponty, the phenomenologist philosopher whose work on perception inspires how this tool helps you perceive your videos.

PyPI version Python License: MIT Streamlit App Website

https://github.com/user-attachments/assets/e2c5b476-ddab-49ab-a35c-9ae5e880c25c

Why Merleau?

Google Gemini is the only major AI provider with native video understanding—Claude doesn't support video, and GPT-4o requires frame extraction workarounds. Merleau is the first CLI that actually understands video rather than analyzing frames.

Features

  • Native Gemini video processing - Upload and analyze videos directly
  • YouTube URL support - Analyze videos directly from YouTube (free preview)
  • Customizable prompts - Ask any question about your video
  • Cost estimation - Token usage tracking and cost breakdown
  • Multiple models - Support for different Gemini models
  • Web UI - Streamlit app for browser-based analysis

Use cases

Clone apps

Take a screencast of your app and ask:

  • "What are the main features of this app?"
  • "What are the main UI elements?"
  • "What are the main user flows?"

Extract code from a coding screencast

ponty https://www.youtube.com/watch?v=Be0ceKN81S8 -p "Extract the text in the first claude code session" -e md

playwright-cli-claude-code

Installation

Using uv (recommended):

uv sync

Or install from PyPI:

pip install merleau

Configuration

  1. Get a Gemini API key from Google AI Studio
  2. Set the API key as an environment variable or create a .env file:
    GEMINI_API_KEY=your_api_key_here
    

Usage

# Basic video analysis
ponty video.mp4

# Analyze a YouTube video directly
ponty https://youtu.be/VIDEO_ID
ponty https://www.youtube.com/watch?v=VIDEO_ID

# Custom prompt
ponty video.mp4 -p "Summarize the key points in this video"

# Use a different model
ponty video.mp4 -m gemini-2.0-flash

# Export analysis to markdown
ponty video.mp4 -e md

# Hide cost information
ponty video.mp4 --no-cost

Web UI

Try it online: https://merleau.streamlit.app/

The web app supports both file uploads and YouTube URLs (paste a URL in the YouTube tab to preview and analyze directly).

Or run locally:

pip install merleau[web]
streamlit run streamlit_app.py

Options

Option Description
-p, --prompt Prompt for the analysis (default: "Explain what happens in this video")
-m, --model Gemini model to use (default: gemini-2.5-flash)
-e, --export Export analysis to file (supported formats: md)
--no-cost Hide usage and cost information
-V, --version Show version and exit

Reducing Costs with Compression

Compressing videos before analysis can reduce API costs by ~10-15% without degrading analysis quality. Gemini's token count is affected by video resolution and bitrate.

Quick Compression with ffmpeg

# Basic compression (recommended)
ffmpeg -i input.mp4 -vcodec libx264 -crf 28 -preset medium -vf "scale=1280:-2" output.mp4

# Aggressive compression (smaller file, lower quality)
ffmpeg -i input.mp4 -vcodec libx264 -crf 32 -preset medium -vf "scale=640:-2" output.mp4

# Keep audio (for speech analysis)
ffmpeg -i input.mp4 -vcodec libx264 -crf 28 -preset medium -vf "scale=1280:-2" -acodec aac -b:a 128k output.mp4

Compression Options Explained

Option Description
-crf 28 Quality level (18-28 recommended, higher = smaller file)
-preset medium Encoding speed/quality tradeoff
-vf "scale=1280:-2" Resize to 1280px width, maintain aspect ratio
-an Remove audio (if not needed)
-acodec aac -b:a 128k Compress audio to 128kbps AAC

Cost Comparison Example

Version File Size Prompt Tokens Input Cost
Original (1080p) 52 MB 14,757 $0.00221
Compressed (720p) 2.6 MB 13,157 $0.00197
Savings 95% 10.8% 10.8%

Output

The CLI provides:

  • Video content analysis from Gemini
  • Token usage breakdown (prompt, response, total)
  • Estimated cost based on Gemini pricing

Pricing Reference

Gemini 2.5 Flash (as of 2025):

  • Input: $0.15 per 1M tokens (text/image), $0.075 per 1M tokens (video)
  • Output: $0.60 per 1M tokens, $3.50 for thinking tokens

A 1-hour video costs approximately $0.11-0.32 to analyze.

Download files

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

Source Distribution

merleau-0.5.3.tar.gz (130.1 kB view details)

Uploaded Source

Built Distribution

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

merleau-0.5.3-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file merleau-0.5.3.tar.gz.

File metadata

  • Download URL: merleau-0.5.3.tar.gz
  • Upload date:
  • Size: 130.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for merleau-0.5.3.tar.gz
Algorithm Hash digest
SHA256 ee70b1038be0fdcbd6b596cb7869bf639ab4cea582487ae0989edc1e4fa8528e
MD5 15fe922c0ff26ee77f452a4eead81d59
BLAKE2b-256 7260c809b02628a1dc17ec5a0fdc2516b427c052f9399314e26fb854d7250959

See more details on using hashes here.

Provenance

The following attestation bundles were made for merleau-0.5.3.tar.gz:

Publisher: python-publish.yml on yanndebray/merleau

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file merleau-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: merleau-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for merleau-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 186c2b6e5bc130c06de558bffb02c2ec8e353acd01951e646134fce308030837
MD5 2be8a6237f67410fdafe5bcfe256e343
BLAKE2b-256 6b51a54cbb8e7068290475c45807977158017233aca30e0962cb4a7e726ce9c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for merleau-0.5.3-py3-none-any.whl:

Publisher: python-publish.yml on yanndebray/merleau

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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