frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: I compressed 10k PDFs into a 1.4GB video for LLM memory

https://github.com/Olow304/memvid
47•saleban1031•4d ago
While building a Retrieval-Augmented Generation (RAG) system, I was frustrated by my vector database consuming 8GB RAM just to search my own PDFs. After incurring $150 in cloud costs, I had an unconventional idea: what if I encoded my documents into video frames?

The concept sounded absurd—storing text in video? But modern video codecs have been optimized for compression over decades. So, I converted text into QR codes, then encoded those as video frames, letting H.264/H.265 handle the compression.

The results were surprising. 10,000 PDFs compressed down to a 1.4GB video file. Search latency was around 900ms compared to Pinecone’s 820ms—about 10% slower. However, RAM usage dropped from over 8GB to just 200MB, and it operates entirely offline without API keys or monthly fees.

Technically, each document chunk is encoded into QR codes, which become video frames. Video compression handles redundancy between similar documents effectively. Search works by decoding relevant frame ranges based on a lightweight index.

You get a vector database that’s just a video file you can copy anywhere.

GitHub: https://github.com/Olow304/memvid

Comments

copperx•1d ago
Why does this work so well?
tux3•1d ago
It does not. It's an indictment of the vector database working so poorly than even deliberately trying to make up something ridiculously inefficient (encoding PDFs as QR codes as H.264 video) is somehow comparable.

It's possible to be less efficient, but it takes real creativity. You could print out the QR codes and scan them again, or encode the QR codes in the waveform of an MP3 and take a video of that.

It's really, really bad.

jonplackett•1d ago
I feel like this could be a new fun competition though. Like the Japanese art of un-useless inventions.

https://en.m.wikipedia.org/wiki/Chind%C5%8Dgu

jonplackett•1d ago
How big were the original PDFs? Are they just text or images and other formatting too?
userbinator•1d ago
If they were less than 140k on average, then this isn't "compression" but "lossy expansion".
Scaevolus•1d ago
This is an extremely bad method of storing text data. Video codecs are not particularly efficient at compressing QR codes, given the high contrast between the blocks defeating the traditional DCT psychovisual assumptions of smooth gradients. There is little to no redundancy between QR code encodings of similar text.

You'd probably have a smaller database and better results crunching text into a zip file, or compressed rows in a sqlite database, or any other simple random-access format.

mdp2021•1d ago
I'd say it be bewildering if there were not a more efficient way to store text for the purpose in context, than "QR codes in compressed video frames".

The vector database previously used must have been very inefficient.

duskwuff•1d ago
> The vector database previously used must have been very inefficient.

Especially if it was taking ~800 ms to do a search. At that speed, you'd probably be better off storing the documents as plain text, without the whole inefficient QR/H264 round-trip.

WhyIsItAlwaysHN•1d ago
Is this more efficient than putting all of that in say a 7z archive?

I'd expect video frames to be maximally efficient if you sorted the chunks by image similarity somehow.

Also isn't there a risk of losing data by doing this since for example h.265 is lossy?

chatmasta•1d ago
h.265 is lossy but QR codes are redundant
WhyIsItAlwaysHN•1d ago
Is the probability of lost data zero across eg. millions of documents?

I see there's a 30% redundancy per document, but I'm not sure every frame in a h265 file is guaranteed to have more than 70% of a qr code being readable. And if it's not readable, then that could mean losing an entire chunk of data.

I'd definitely calculate the probability of losing data if storing text with a lossy compression.

captainregex•1d ago
Why not just do it locally? Or were the RAM consumption and the cloud cost comments distinct?
rafram•1d ago
> The results were surprising. 10,000 PDFs compressed down to a 1.4GB video file.

And how big was the total text in those PDFs?

duskwuff•1d ago
> Video compression handles redundancy between similar documents effectively.

Definitely not. None of the "redundancy" between, or within, texts (e.g. repeated phrases) is apparent in a sequence of images of QR codes.

mrkeen•1d ago
Cut the cloud vendors out of the picture and build and query your index on a spare linux box.

I've only played with TF-IDF/BM25 as opposed to vector searches, but there's no way your queries should be taking so long on such a small corpus. Querying 10k documents feels like 2-10ms territory, not 900ms.

xnx•1d ago
April Fools?
kgeist•1d ago
900 ms sounds like a lot for just 10,000 documents? How many chunks are there per document? Maybe Pinecone's 820 ms includes network latency plus they need to serve other users?

In Go, I once implemented a naive brute-force cosine search (linear scan in memory), and for 1 million 350-dimensional vectors, I got results in under 1 second too IIRC.

I ended up just setting up OpenSearch, which gives you hybrid semantic + full-text search out of the box (BM25 + kNN). In my tests, it gave better results than semantic search alone, something like +15% better retrieval.

jeffcatz•22h ago
I’m not sure why this is getting so much hate. This could be groundbreaking.
Ayushmishra23•20h ago
can you provide that mp4

Quarkdown: A modern Markdown-based typesetting system

https://github.com/iamgio/quarkdown
94•asicsp•1h ago•43 comments

AI makes the humanities more important, but also weirder

https://resobscura.substack.com/p/ai-makes-the-humanities-more-important
122•findhorn•6h ago•64 comments

Poison Pill: Is the killer behind 1982 Tylenol poisonings still on the loose?

https://www.trulyadventure.us/poison-pill
38•TMWNN•3h ago•39 comments

My AI skeptic friends are all nuts

https://fly.io/blog/youre-all-nuts/
1447•tabletcorry•12h ago•1830 comments

Stop Over-Thinking AI Subscriptions – Peter Steinberger

https://steipete.me/posts/2025/stop-overthinking-ai-subscriptions
16•hboon•2h ago•1 comments

The Metamorphosis of Prime Intellect (1994)

https://localroger.com/prime-intellect/mopiall.html
54•lawrenceyan•5h ago•28 comments

Why GUIs are built at least 2.5 times

https://patricia.no/2025/05/30/why_lean_software_dev_is_wrong.html
59•mpweiher•3d ago•35 comments

Cloudlflare builds OAuth with Claude and publishes all the prompts

https://github.com/cloudflare/workers-oauth-provider/
557•gregorywegory•19h ago•362 comments

Ask HN: Who is hiring? (June 2025)

308•whoishiring•18h ago•308 comments

A Complete Guide to Meta Prompting

https://www.prompthub.us/blog/a-complete-guide-to-meta-prompting
31•saikatsg•3d ago•5 comments

How to Store Data on Paper?

https://www.monperrus.net/martin/store-data-paper
89•mofosyne•3d ago•28 comments

Demodesk (YC W19) Is Hiring Rails Engineers

https://demodesk.com/careers
1•alxppp•2h ago

Show HN: Kan.bn – An open-source alterative to Trello

https://github.com/kanbn/kan
413•henryball•1d ago•186 comments

Show HN: A toy version of Wireshark (student project)

https://github.com/lixiasky/vanta
224•lixiasky•18h ago•67 comments

How to post when no one is reading

https://www.jeetmehta.com/posts/thrive-in-obscurity
565•j4mehta•1d ago•236 comments

Conformance checking at MongoDB: Testing that our code matches our TLA+ specs

https://www.mongodb.com/blog/post/engineering/conformance-checking-at-mongodb-testing-our-code-matches-our-tla-specs
75•todsacerdoti•12h ago•28 comments

Show HN: I build one absurd web project every month

https://absurd.website
217•absurdwebsite•14h ago•49 comments

A High-Level View of TLA+

https://lamport.azurewebsites.net/tla/high-level-view.html
9•blobcode•3d ago•0 comments

Ask HN: Cloud vs. Edge Computing–Why Choose a Local NAS?

9•thunderstruck•55m ago•9 comments

Teaching Program Verification in Dafny at Amazon (2023)

https://dafny.org/blog/2023/12/15/teaching-program-verification-in-dafny-at-amazon/
38•Jtsummers•11h ago•10 comments

Show HN: Onlook – Open-source, visual-first Cursor for designers

https://github.com/onlook-dev/onlook
370•hoakiet98•4d ago•78 comments

Magic Ink: Information Software and the Graphical Interface

https://worrydream.com/MagicInk/
23•blobcode•3d ago•3 comments

Rsync's defaults are not always enough

https://rachelbythebay.com/w/2025/05/31/sync/
6•rcarmo•3h ago•6 comments

Fun with Futex

https://blog.fredrb.com/2025/06/02/futex-fun/
5•ingve•3h ago•0 comments

Sid Meier's Pirates – In-depth (2017)

https://shot97retro.blogspot.com/2017/12/sid-meiers-pirates-in-depth-written.html
56•benbreen•3d ago•23 comments

MonsterUI: Python library for building front end UIs quickly in FastHTML apps

https://www.answer.ai/posts/2025-01-15-monsterui.html
62•indigodaddy•13h ago•22 comments

Largest punk archive to find new home at MTSU's Center for Popular Music

https://mtsunews.com/worlds-largest-punk-archive-moves-to-center-for-popular-music/
40•gnabgib•11h ago•4 comments

ThorVG: Super Lightweight Vector Graphics Engine

https://www.thorvg.org/about
122•elcritch•23h ago•38 comments

Japanese scientists develop artificial blood compatible with all blood types

https://www.tokyoweekender.com/entertainment/tech-trends/japanese-scientists-develop-artificial-blood/
204•Geekette•12h ago•42 comments

Younger generations less likely to have dementia, study suggests

https://www.theguardian.com/society/2025/jun/02/younger-generations-less-likely-dementia-study
108•robaato•18h ago•104 comments