Blog博客›Compressing Video to 5 KB with a Diffusion Generator用视频扩散模型把视频压到 5 KB
Dec 3, 2026

Compressing Video to 5 KB with a Diffusion Generator用视频扩散模型把视频压到 5 KBCompressing Video to 5 KB with a Diffusion Generator

By Wenhao Chai作者 Wenhao Chai
This 18 s video compares four 1344×768 Blender clips encoded as 2.9 to 4.8 MB H.264 files against 5.1 KB reconstructions that are 563× to 930× smaller.这段 18 s 的视频对比了四段来自 Blender 开放电影的 1344×768 镜头,H.264 原片大小在 2.9 到 4.8 MB 之间,而重建码流只有 5.1 KB,体积缩小了 563× 到 930×。
DDCM compression of video and images The experiment page holds all rate-distortion curves at 672×384 and 1344×768, the noise-schedule shift sweep, the rate-band recipe table, and the image supplement. 实验主页收录了 672×384 和 1344×768 两档分辨率的完整码率–失真曲线、噪声日程 shift 扫描、分码率档方案表以及图像压缩附录。

Diffusion builds a picture out of noise扩散模型:先拆楼,再建楼

A diffusion model learns to undo one simple corruption. Add a little Gaussian noise to a picture, then a little more, until nothing of the picture is left. Su Jianlin's notes compare this to tearing a building down into bricks. A network is trained to look at any noisy version xt and guess the clean picture, a guess written x̂0. Generation runs the other way: it starts from pure noise xT and removes a little noise at each step until the building stands again.

扩散模型学的是怎样撤销一种很简单的破坏。给一张图加一点高斯噪声,再加一点,一直加到图里什么都不剩。苏剑林的《生成扩散模型漫谈(一):DDPM = 拆楼 + 建楼》把这个过程叫作“拆楼”:把高楼拆成砖瓦水泥。然后训练一个网络,让它看任意一个带噪的 xt,猜出原来干净的图,这个猜测记作 x̂0。生成就是反过来“建楼”:从纯噪声 xT 出发,每一步去掉一点噪声,直到楼重新盖起来。

A stochastic sampler such as DDPM does more than remove noise. At every step it also adds a small amount of fresh Gaussian noise, xt−1 = μ(xt) + σt εt, where μ(xt) is the step the network proposes and εt is a new random draw. The network never changes, so the noise drawn along the way decides which sample comes out. In Figure 1, three walks start from the same xT, receive different noise and end on different points of the spiral.

DDPM 这类随机采样器每一步不只是去噪,还会再加一点新抽的高斯噪声:xt−1 = μ(xt) + σt εt。μ(xt) 是网络给出的这一步的去向,εt 是这一步新抽的噪声。网络本身是固定的,所以一路上抽到的噪声决定了最后生成哪一个样本。图 1 里,三条路径从同一个 xT 出发,抽到的噪声不同,最后落在螺旋上不同的点。

DDCM turns the noise into a codeDDCM:噪声就是编码

Denoising Diffusion Codebook Models (DDCM) make one change to this sampler. Before any sampling, draw K Gaussian vectors for each step and keep them fixed. At each step the noise is one of these K vectors instead of a fresh draw. Samples stay almost as good: for a pixel-space ImageNet model and for Stable Diffusion 2.1, K = 64 reaches about the same FID as fresh Gaussian noise. Generation becomes a map from a list of integers, one index per step, to a sample.

Denoising Diffusion Codebook Models (DDCM) 只改了采样器的一处。采样之前,先为每一步抽好 K 个高斯向量,之后固定不变;采样时,每一步的噪声不再新抽,而是从这 K 个向量里挑一个。生成质量几乎不受影响:在像素空间的 ImageNet 模型和 Stable Diffusion 2.1 上,K = 64 时的 FID 已经和用连续高斯噪声时相当。这样一来,生成就变成了从一串整数(每步一个索引)到一个样本的映射。

To encode a given picture x0, the encoder runs the same sampler and, at each step, picks the vector with the largest inner product with the residual x0 − x̂0(xt), the part of the picture that the network's current guess still misses. The list of picked indices is the code, log2 K bits per step. The decoder runs the same sampler with the same codebook and the same indices and gets the same output, bit for bit. Nothing is trained. Figure 2 shows both halves, and Su Jianlin's notes derive the selection rule from the DDPM posterior.

反过来,要编码一张给定的图 x0,编码器照常跑采样,只是每一步挑和残差 x0 − x̂0(xt) 内积最大的那个向量。残差就是网络当前的猜测离原图还差的那一部分。挑出来的索引串就是编码,每步 log2 K 个 bit。解码端用同一本 codebook、按同一串索引再跑一遍采样,就能逐比特得到同样的输出。整个过程不需要任何训练。图 2 画出了编码和解码两半;这条选择规则怎样从 DDPM 的后验推出来,可以看苏剑林的《生成扩散模型漫谈(二十九):用DDPM来离散编码》。

Turbo-DDCM sends many noises per stepTurbo-DDCM:每步挑一组噪声

One index per step sends bits slowly. With K = 16,384 a step carries 14 bits, so a 5,116-byte code would take about 2,900 network calls. Turbo-DDCM picks M codebook vectors per step, each with a + or − sign, and uses their normalised sum as the step's noise. The sum points closer to the residual than any single vector, so each step moves further toward x0 and the walk needs far fewer steps, as Figure 3 shows.

每步只传一个索引,传 bit 太慢了。K = 16,384 时一步只有 14 bit,要攒够 5,116 字节,得跑大约 2,900 次网络。Turbo-DDCM 每一步挑 M 个 codebook 向量,各配一个正号或负号,把它们加起来再归一化,作为这一步的噪声。这个和比任何单个向量都更贴近残差,所以每一步都朝 x0 走得更远,需要的步数也少得多(图 3)。

The encoder sends the chosen set and its signs as one index of ⌈log2 C(K, M)⌉ + M bits per step: the rank of the set among all C(K, M) sets of M vectors, then one bit per sign. With K = 16,384 and M = 256 a step carries 2,154 bits. Our codes use 20 network calls and send bits on the first 19, since the last call adds no noise, so the code of the video above is 19 × 2,154 = 40,926 bits, or 5,116 bytes. The count holds only these index bits. The codebook and the starting noise come from a seed that both ends share, so they cost nothing.

编码器把选中的这组向量和它们的符号合成一个索引,每步 ⌈log2 C(K, M)⌉ + M bit:前一项是这组向量在所有 C(K, M) 种选法里的编号,后一项是 M 个符号,每个 1 bit。K = 16,384、M = 256 时,一步是 2,154 bit。我们的编码一共调用 20 次网络,只有前 19 步写 bit,因为最后一步不加噪声。所以开头那段视频的码流是 19 × 2,154 = 40,926 bit,也就是 5,116 字节。这里只算这些索引 bit。codebook 和起始噪声都由两端共享的随机种子生成,不占码流。

We use Turbo-DDCM unchanged on a video generator, MiniMax H3, so one code describes a whole clip. We add one thing, the clip's caption. Video libraries already store a description of each clip for search, so the caption reaches both ends as free side information and does not count toward the bitrate.

我们把 Turbo-DDCM 原样搬到视频生成模型 MiniMax H3 上,一串索引对应一整段视频。我们只加了一样东西:视频的描述。视频库本来就会给每段视频存一段描述,用来做搜索,所以这段 caption 作为免费的边信息同时提供给两端,不计入码率。

Setup实验设置

We run Turbo-DDCM on MiniMax H3, an open text-to-video generator. Our benchmark tests four Blender open-movie clips: Tears of Steel, Sintel, Sprite Fright, and Big Buck Bunny. We evaluate them at 672×384 over 73 frames and at 1344×768 over 175 frames at 24 fps. The video above uses further action shots from Sintel, Tears of Steel, and Cosmos Laundromat, encoded with 20 steps and 256 picks per step. A vision-language model writes each description, and MiniMax's prompt rewriter formats it for H3. We compare against x264, x265, and SVT-AV1 down to their lowest bitrates using default presets without downscaling. Quality is measured with Peak Signal-to-Noise Ratio (PSNR) and AlexNet Learned Perceptual Image Patch Similarity (LPIPS). Full settings and the rate-band recipe sit on the experiment page.

我们在开源文生视频模型 MiniMax H3 上跑 Turbo-DDCM。评测选了四段 Blender 开放电影片段:《Tears of Steel》、《Sintel》、《Sprite Fright》和《Big Buck Bunny》。每段测两档画幅:672×384 共 73 帧,以及 1344×768 共 175 帧,帧率都是 24 fps。开场视频用的是另外几段动作镜头,来自《Sintel》、《Tears of Steel》和《Cosmos Laundromat》,用 20 步、每步 256 条噪声编码。描述由视觉语言模型生成,再经 MiniMax 的 prompt rewriter 改写成 H3 的输入。基线是 x264、x265 和 SVT-AV1,一路压到各自最低码率,全部使用默认 preset 且不做降分辨率。指标看两项:像素保真度用 Peak Signal-to-Noise Ratio (PSNR),感知距离用基于 AlexNet 的 Learned Perceptual Image Patch Similarity (LPIPS)。完整配置和分码率档方案表都在实验主页。

Same perceptual quality with 88 to 99% fewer bits同等感知质量,少用 88% 到 99% 的 bit

Turbo-DDCM matches the lowest-rate perceptual quality of x264, x265, and SVT-AV1 using 88 to 99% fewer bits. At 1344×768, none of the three conventional codecs goes below 42.0 kbps. Turbo-DDCM starts at 1.7 kbps and reaches every baseline's lowest-rate LPIPS between 1.7 and 15.1 kbps, as Figure 4 shows. The same gap holds on the 672×384 benchmark, where conventional codecs stop at 30.6 kbps while Turbo-DDCM matches their lowest-rate LPIPS between 0.8 and 6.3 kbps. Pixel fidelity beats the older codecs too: across both sizes, Turbo-DDCM reaches the lowest-rate PSNR of x264 and x265 with 22 to 90% fewer bits. Where bits land on the denoising schedule shifts the frontier further, mapped in the noise-schedule shift sweep.

想达到 x264、x265 和 SVT-AV1 在最低码率点的感知质量,Turbo-DDCM 可以少用 88% 到 99% 的 bit。在 1344×768 上,三个传统编码器都压不到 42.0 kbps 以下;而 Turbo-DDCM 从 1.7 kbps 起就能编码,只需 1.7 到 15.1 kbps 就能追平三个基线最低码率点的 LPIPS(图 4)。在 672×384 评测上也是同样的格局:传统编码器停在 30.6 kbps,Turbo-DDCM 用 0.8 到 6.3 kbps 就能达到同样的 LPIPS。面对 x264 和 x265,像素指标同样占优,两档分辨率合起来看,Turbo-DDCM 达到它们最低码率点的 PSNR 少用 22% 到 90% 的 bit。这些 bit 落在去噪日程的哪一段也会影响前沿位置,实验主页的噪声日程 shift 扫描给出了完整规律。

Decoding takes minutes on an H100在一张 H100 上解码要花好几分钟

Decoding requires T forward passes through MiniMax H3, and encoding adds codebook scoring on top. On one H100 GPU, decoding takes 10 to 20 s for a 3.04 s clip at 672×384, or 3.3 to 6.5× slower than real time. At 1344×768, a 7.29 s clip takes 5.3 to 8.0 min to decode, or 44 to 66× slower than real time.

解码一段视频要完整跑 T 次 MiniMax H3 的前向推理,编码端还要在同样步数上额外做 codebook 打分。在一张 H100 上,解码一段 3.04 s 的 672×384 片段需要 10 到 20 s,比实时慢 3.3 到 6.5×。换到 1344×768 后,一段 7.29 s 的片段解码要 5.3 到 8.0 min,比实时慢 44 到 66×。

Takeaways核心结论

Turbo-DDCM on MiniMax H3, with the caption as free side information, reaches the LPIPS of x264, x265 and SVT-AV1 at their lowest rates with 88 to 99% fewer bits and the PSNR of x264 and x265 with 22 to 90% fewer, on four Blender clips at 672×384 and at 1344×768; but SVT-AV1 at its lowest rate keeps more PSNR on two of the four clips at 672×384 and on all four at 1344×768, and one H100 needs 10 to 20 s to decode a 3.04 s clip and 5 to 8 min for a 7.29 s one.

以描述作为免费的边信息,MiniMax H3 上的 Turbo-DDCM 在 672×384 和 1344×768 的四段 Blender 片段上,达到 x264、x265 和 SVT-AV1 最低码率点的 LPIPS 少用 88% 到 99% 的 bit,达到 x264 和 x265 的 PSNR 少用 22% 到 90% 的 bit;但 SVT-AV1 在它的最低码率上,PSNR 在 672×384 的四段中有两段更高,在 1344×768 的四段上都更高;一块 H100 解码一段 3.04 s 的片段要 10 到 20 s,解码一段 7.29 s 的片段要 5 到 8 min。

A diffusion codec does not replace SVT-AV1 or x265. Once a link supports SVT-AV1's bitrate or requires pixel-exact output, conventional codecs preserve finer fidelity and decode in real time on consumer hardware. Turbo-DDCM fits a narrow regime: severely constrained bandwidth, captions already stored for search, offline GPU decoding, and scenes where plausibility beats pixel identity. Inside that regime, the rate-band recipe sets step count, picks per step, and schedule shift for each bitrate target.

因此,扩散编解码器并不是 SVT-AV1 或 x265 的平替。只要链路够得上 SVT-AV1 的码率,或者业务要求逐像素准确还原,传统编码器的保真度更高,而且在普通终端上就能实时解码。Turbo-DDCM 适合的是一块很窄的场景:带宽极度受限、视频本来就存有用于搜索的 caption、接受离线 GPU 解码,而且只要还原出合理的场景,不需要逐像素一致。落在这个区间里时,可以按实验主页的分码率档方案表,根据目标码率选定步数、每步噪声数和噪声日程 shift。

Acknowledgements致谢

The clips come from the Blender open movies Tears of Steel, Sintel, Sprite Fright, Big Buck Bunny, Spring and Cosmos Laundromat, © Blender Foundation and Blender Studio, under Creative Commons Attribution licenses.

视频片段来自 Blender 开放电影《Tears of Steel》、《Sintel》、《Sprite Fright》、《Big Buck Bunny》、《Spring》和《Cosmos Laundromat》,© Blender Foundation 与 Blender Studio,按 Creative Commons 署名许可使用。

This work used Princeton Research Computing resources on the Della cluster, supported by the Princeton Institute for Computational Science and Engineering and Research Computing at Princeton University.

本研究使用了普林斯顿大学研究计算中心的 Della 集群算力,由普林斯顿计算科学与工程研究所及研究计算中心提供支持。

Citation引用

@misc{chai2026ddcmvideo,
  title        = {Compressing Video to 5 {KB} with a Diffusion Generator},
  author       = {Chai, Wenhao},
  year         = {2026},
  howpublished = {Blog post},
  url          = {https://wenhaochai.com/blogs/ddcm-video.html}
}
All posts全部文章 Back to top回到顶部