Engineering11 min read

Memvid: v2 Rewrite, Install, Benchmarks, Limits

Memvid was rewritten in Rust as a single-file .mv2 memory layer; the 2025 QR-in-MP4 version is deprecated. Status, install, limits, when a vector DB wins.

Tega Adeyemi
Tega Adeyemi
Turn an MP4 into Your Fastest Vector Store: Meet Memvid (2025)

Memvid is an open-source, single-file memory layer for AI agents: one .mv2 file holds your documents, a BM25 full-text index, an HNSW vector index and a write-ahead log, with no server to run. The 2025 version this article introduced (text chunks as QR codes inside an MP4, searched with FAISS) has been rewritten from Python to Rust and the QR design is deprecated. This page gives the September 2026 status, the current install, what the old benchmarks do and do not tell you, and when a real vector database is the better call.

Updated September 2026: new status section (v2 rewrite, versions, install), a memvid vs vector database section, and an FAQ. The June 2025 walkthrough and its code are kept below and labelled as the v1 version; the 2025 benchmark table applies to v1 only.

Picking the right retrieval substrate (vector DB vs Memvid vs hybrid) is one slice of a larger context-engineering decision tree that we work through in Cohorte's Context Architecture course (E5).

What memvid is in 2026 (status, version, install)

Short version: the project is alive, it is not the project we wrote about, and the old name still points at it.

Install and a minimal v2 session, from the current docs:

pip install memvid-sdk
import os
from memvid_sdk import create, use

path = "knowledge.mv2"
mem = use("basic", path) if os.path.exists(path) else create(path)

mem.put(title="Team", label="info", metadata={}, text="Alice works on retrieval.")
results = mem.find("who works on retrieval", k=5, mode="hybrid")
mem.seal()   # commit to disk

The vendor README quotes its own benchmark figures (LoCoMo recall, sub-millisecond P50 latency, throughput multiples). We have not reproduced them and we do not repeat them as facts here; measure on your corpus.

Everything from section 1 to section 10 below is the original June 2025 walkthrough of memvid v1, kept as written. Its code targets pip install memvid 0.1.3 and still runs against that package, but that package is no longer developed.

1. Why We Even Bother

Enter Memvid. Instead of B-tree tables or ANN graphs living in Postgres extensions, it squeezes your chunks into video frames encoded as QR images. The MP4 is your database; a sidecar JSON is the index; FAISS does the similarity dance. Result: 10× storage savings and sub-second retrieval for 1-million-chunk corpora.

2. How the Magic Happens (A Peek Under the Lens)

Text  -> chunk → embed → QR code image
Frames → stitched into MP4 (H.264 / H.265 / …)
Index → FAISS vectors + metadata JSON
Search → embed(query) → cosine in FAISS → frame seek → decode QR → return text
Stage Tech behind the scenes
Embeddings Sentence-Transformers by default – pluggable.
QR encoding qrcode lib encodes binary payloads.
Video muxing OpenCV + ffmpeg under the hood.
ANN Search FAISS flat or IVF indexes.
Chat layer Hooks into OpenAI, Claude, or local LLMs for RAG.

Each frame is basically a data tile; fast seek + decompression beats walking SSTables. Because MP4s stream nicely, you can stick them in S3/Cloudflare R2 and only read the frames you need.

3. Key Features & Advantages

Capability Why it Matters
Video-as-DB One file to rule them all—ship or version it like any media asset.
Sub-second semantic search FAISS + local SSD = instant RAG context.
10× smaller than classic vectordb footprints Video codecs were born for compression; we just piggy-back.
Offline-first No network? No problem.
PDF ingestion add_pdf() drops a 500-page book straight in. [github.com]
Simple API Three lines to encode, five to chat. [github.com]

4. Quick-Start Cookbook (2025, memvid v1)

Open a shell—no GPU required.

4.1 Install

What changed since this was written: the package below is the deprecated v1. For the current library, install memvid-sdk and use create() / put() / find() / ask() as shown in the 2026 section above; MemvidEncoder, MemvidChat and the .mp4 + JSON pair do not exist in v2.

pip install memvid-sdk   # 2026: memvid v2, single .mv2 file
python -m venv venv && source venv/bin/activate   # Windows: venv\Scripts\activate
pip install memvid PyPDF2                         # PyPDF2 only if you need PDFs

4.2 Encode a Few Chunks

from memvid import MemvidEncoder

chunks = [
    "TCP was invented in 1974.",
    "Rust guarantees memory safety without GC.",
    "The Pythagorean theorem is surprisingly versatile."
]

encoder = MemvidEncoder()
encoder.add_chunks(chunks)
encoder.build_video("facts.mp4", "facts_idx.json")  # ~3 lines, promised delivered

4.3 Ask Questions

from memvid import MemvidChat

chat = MemvidChat("facts.mp4", "facts_idx.json")
print(chat.chat("Who came up with TCP?"))

(Expect a snappy answer: Vint Cerf & Bob Kahn.)

4.4 Whole-Book Chat (PDF)

from memvid import MemvidEncoder, chat_with_memory
encoder = MemvidEncoder()
encoder.add_pdf("deep_learning_book.pdf")
encoder.build_video("dl_mem.mp4", "dl_idx.json")
chat_with_memory("dl_mem.mp4", "dl_idx.json")   # opens CLI chat

5. Deep Dive: Performance & Benchmarks (2025, v1 numbers)

These figures were measured on the v1 QR-in-MP4 design in June 2025. They say nothing about v2, whose storage engine and indexes are different. Treat them as history, not as a benchmark of the current library.

Dataset size Build time (CPU, 8-cores) MP4 size Query latency (top-5)
100 K chunks ≈ 2 min 180 MB 50 ms
1 M chunks ≈ 22 min 1.6 GB 320 ms

Measured on a 2021 MacBook Pro; YMMV. The seek-decode wall clock stays under a second even at seven-figure scales because frame hops are O(1) and vector math runs in memory. Compare that with warm-cache pgvector (2–3 s) or a cold Supabase vector table (don’t ask).bestofai.com

6. When (Not) to Use Memvid

Great for

Think twice if

7. Production Recipes

Pattern How to Pull It Off
Serverless RAG Store .mp4 + .json in S3 ▸ Lambda pulls, runs FAISS search, returns snippets. Cold starts stay tiny because FAISS index is memory-mapped from the JSON.
CI/CD for knowledge Treat MP4s as artifacts. Re-encode on docs merge, push to object storage, invalidate CDN.
Streaming search Put the MP4 behind Cloudflare Stream; partial GET range requests fetch only needed frames—bandwidth smiles.
Multi-tenant SaaS Namespace per customer = distinct video + index. No noisy-neighbor queries.

8. Extending the Stack

from sentence_transformers import SentenceTransformer
custom_model = SentenceTransformer("intfloat/multilingual-e5-small")

encoder = MemvidEncoder(embedding_model=custom_model)
# proceed as usual...

Need bigger bite? Spin n_workers=8 for parallel chunking, or switch to video_codec='h265' + crf=28 for 15–20 % extra savings.

9. Limitations & Open Questions

  1. Write Amplification – Small updates mean re-encoding; incremental frame patching is on the roadmap.
  2. Security – Anyone with the MP4 can QR-decode frames. Encrypt at rest or wrap in container-level access control.
  3. Concurrency – Multiple readers are fine; concurrent writers are… well, don’t.
  4. Index Size – JSON grows linearly; consider binary packing or SQLite sidecars for 10-million-chunk dreams.

10. Roadmap Highlights (as of June 2025)

Overtaken by events: instead of patching the QR design, the maintainers replaced it with the Rust rewrite described at the top of this page.

memvid vs a vector database: when each wins

The question behind the query "memvid vector database" is really "can I skip Qdrant, pgvector or Pinecone?" Sometimes. Here is how we draw the line, without numbers we cannot stand behind.

Memvid wins when

A vector database wins when

A useful test: if you would be nervous shipping the same data in a SQLite file, you should be nervous shipping it in a .mv2. Memvid v2 is an embedded engine with retrieval indexes built in, and that framing (SQLite for retrieval, not a distributed database) keeps expectations honest. Whatever the substrate, the chunking, metadata and ranking decisions upstream of it matter more than the storage format.

FAQ

Is memvid still maintained?

Yes, but not the version this article was written about. Memvid was rewritten from Python to Rust; the first v2 release (v2.0.131) landed on January 5, 2026. As of September 2026 the latest GitHub release is v2.0.140 (May 27, 2026), the Python package memvid-sdk is at 2.0.160 (May 27, 2026), and the last push to main was July 14, 2026. The v1 QR-in-MP4 package (memvid 0.1.3 on PyPI, June 2025) is deprecated by the maintainers.

Is memvid a real vector database?

Not in the server sense. Memvid v2 is an embedded, single-file library: one .mv2 file holds the documents, an HNSW vector index, a BM25 full-text index and a write-ahead log. There is no server process, no replication and no multi-writer story. Think SQLite for retrieval, not Qdrant or Pinecone.

How does memvid store embeddings?

In v2, embeddings and their HNSW index live inside the .mv2 file next to the text and the lexical index. In v1 (2025), text chunks were encoded as QR codes in the frames of an MP4 and embeddings lived in a FAISS index with a sidecar JSON file; that design has been removed entirely.

Does memvid need a GPU?

No. Without an OPENAI_API_KEY the Python SDK embeds locally with a bge-small model (384 dimensions) on CPU; with the key set it calls text-embedding-3-small (1536 dimensions). The ask() method needs an LLM API key because it sends retrieved context to a model.

When should I use Qdrant or pgvector instead of memvid?

When several services write concurrently, when you need replication, backups and access control at the database layer, when filtering and payload queries matter at scale, or when the corpus outgrows a single file on a single machine. pgvector is the natural pick when the data already lives in Postgres; Qdrant when retrieval is its own service with its own scaling needs.

Where is the memvid GitHub repo?

github.com/memvid/memvid, Apache-2.0, about 16,400 stars in September 2026. The old Olow304/memvid URL from the 2025 launch redirects there. Python: pip install memvid-sdk. Node: npm install @memvid/sdk. Rust: cargo add memvid-core.

11. Final Thoughts (2025)

Memvid turns the humble MP4 into a sneaky-fast, crazy-portable knowledge capsule. For devs who’d rather ship a file than babysit a cluster—and for AI VPs eyeing infra cost charts with existential dread—it’s an intriguing alternative. Give it a spin; worst case, you’ll have the geekiest “home movies” on the block.

Further Reading & Resources

Happy encoding! 🎥

Tega AdeyemiJune 6, 2025

The script works. Production is a different sport.

The AI OS letter covers the part tutorials skip: verification, trust, what breaks with real users. One idea, every Saturday, from CM, Cohorte's founder, who has shipped 60+ AI systems.

Free weekly. No spam. Unsubscribe in one click.

Subscribed ✓

The next letter arrives Saturday. Go finish the build.