Multi-platform Learned Video Codec (MLVC)

Neural video codec with real-time performance and hardware robustness across diverse consumer devices.
MLVC achieves >70% MOS-based BD-rate improvement over hardware HEVC while averaging around 100 FPS for both encoding and decoding on commodity NPUs from Apple, Intel, and Qualcomm (540p).
This repository provides:
- Pre-trained checkpoints for inference
- Training code: Full pipeline for image and video model training (also works with DCVC-RT)
- Conversion tools: Export to CoreML (Apple), ONNX for OpenVINO (Intel) and QNN (Qualcomm)
- C++ entropy coder: Production-ready, optimized for real-time deployment
- Benchmarking tools: BD-rate computation, RD curves, quality metrics, and anchors
For deployment, see libmlvc, our open-source C++ codec library for MLVC encoding and decoding on NPUs.
Installation
Setup
- Install uv: https://docs.astral.sh/uv/getting-started/installation/
- Requires Python >=3.12, <3.14
- Clone repository:
git clone https://github.com/microsoft/mlvc.git
cd mlvc
- Install dependencies
uv sync
- To produce actual bitstreams, you need to install the entropy coder (requires C++ compiler)
uv pip install packages/msrtc_rans
- Install pre-commit hooks (for development)
uv run pre-commit install
Minimal Example

See demo.ipynb for a walkthrough.
Models
| Model |
Objective |
Parameters |
Weights |
SHA-256 |
| MLVC |
psnr |
18.3M |
mlvc-psnr-v1.ckpt |
834adaab680837c4106a9bb62e5778b3f13729b4fe6f751797e0747214f5cca1 |
| MLVC |
perceptual |
18.3M |
mlvc-perceptual-v1.ckpt |
0ba781769a12ae40548d3f6f92e56594510b926bf72ddb92717c7ebccde4723e |
| MLVC-S |
psnr |
5.4M |
mlvc-s-psnr-v1.ckpt |
1b86b757ddb115342293efb57719d6216c6ee2e459ae796ec41723b5c05ca896 |
| MLVC-S |
perceptual |
5.4M |
mlvc-s-perceptual-v1.ckpt |
cfe12eed07b00cdb98c0cd07136797f3b49e8d52f7b6bd3b81cf0a5312a4aa7c |
Note: The checkpoints listed above were trained on OpenVid. The technical report used models trained on Vimeo.
Training
Run commands from the video/ directory.
Directory layout
Training dataset paths are resolved relative to --data_mount.
Model checkpoints, auxiliary model files, anchors, and relative --save_dir paths are resolved relative to --checkpoints_mount.
Relative benchmark config paths such as ./test_cfg/... are resolved from the working directory, so run the commands below from video/.
~/mlvc/
โโโ data/ # --data_mount ~/mlvc
โ โโโ OpenVidHD/
โ โโโ VCD/
โโโ job-outputs/ # --checkpoints_mount ~/mlvc/job-outputs
โโโ pretrained/
โโโ benchmark_test/
โ โโโ anchor/
โโโ checkpoints/
Prepare training data
You should move all downloaded datasets to ~/mlvc/data.
OpenVidHD
Download OpenVidHD data from here - see details and further steps in BUILD_TRAIN_DATASET.md.
Prepare validation and test data
HEVC
Follow instructions here.
VCD
The original VCD dataset is available from the VCD repository.
Prepared versions used by this project are available at: 360p, 540p and 720p.
Extract the required resolutions under:
~/mlvc/data/VCD/yuv/
โโโ 640x360_30fps/
โโโ 960x540_30fps/
โโโ 1280x720_30fps/
Anchors
Anchor files contain results from a reference codec and are used to calculate BD-rate.
We provide intel_hw_hevc anchors for VCD 360p, 540p, and 720p, and DCVC-RT anchors for 96-frame HEVC sequences and 48-frame VCD-s1 360p sequences.
Keep the downloaded filenames and place the anchors under:
~/mlvc/job-outputs/benchmark_test/anchor/
โโโ hevc/
โโโ vcd/
โโโ 640x360_30fps/
โโโ 960x540_30fps/
โโโ 1280x720_30fps/
Prepare auxiliary models
Auxiliary models are workflow-specific. You do not need to download all of them.
DCVC-RT I-frame model
Download the cvpr2025_image.pth.tar checkpoint provided by the DCVC project, rename it to DMCI-6.0.pth.tar, and place it in ~/mlvc/job-outputs/pretrained/.
LPIPS
LPIPS is required only for perceptual training or LPIPS evaluation.
Download the LPIPS VGG16 weights file vgg.pth from the PerceptualSimilarity project, rename it to lpips_vgg16.pth, and place it in ~/mlvc/job-outputs/pretrained/.
DeQA-Score
We provide experimental support for the DeQA-Score no-reference metric which uses LLaMa2-7B.
Download the weights from their HuggingFace page and place them in ~/mlvc/job-outputs/pretrained/DeQA-Score-Mix3.
SimpleVQA
SimpleVQA is an optional no-reference video-quality metric for benchmark and training-validation
videos. Place the official UGC_BVQA_model.pth
and SLOWFAST_8x8_R50.pyth
in ~/mlvc/job-outputs/pretrained/SimpleVQA. See SimpleVQA for usage.
Face segmentation
FarL and RetinaFace are needed only to generate face segmentation masks or to calculate face-region metrics without precomputed masks.
Download the face detector mobilenet0.25_Final.pth and face parser face_parsing.farl.lapa.main_ema_136500_jit191.pt and move them to ~/mlvc/job-outputs/pretrained/checkpoints.
Train I-Frame Model
uv run train_image.py \
--config configs/train_image-dcvcrt.yaml \
--data_mount ~/mlvc \
--checkpoints_mount ~/mlvc/job-outputs \
--save_dir checkpoints/dmci
Train P-Frame Model
uv run train_video.py \
--config configs/train_video-mlvc.yaml \
--data_mount ~/mlvc \
--checkpoints_mount ~/mlvc/job-outputs \
--save_dir checkpoints/mlvc
Perceptual fine-tuning configuration is shown in train_video-mlvc-perceptual.yaml, MLVC-S model configuration is shown in train_video-mlvc_s.yaml.
Evaluation
Run Evaluation
To evaluate the pre-trained MLVC PSNR model, download mlvc-psnr-v1.ckpt to ~/mlvc/job-outputs/pretrained/, then run:
uv run train_video.py \
--config configs/test_video-mlvc.yaml \
--validate \
--data_mount ~/mlvc \
--checkpoints_mount ~/mlvc/job-outputs
Supported Metrics
- Distortion: PSNR (Y/U/V/RGB), MS-SSIM, LPIPS, VIF, DeQA
- Rate: Bits per pixel (bpp), estimated and actual bitstream
- Efficiency: BD-rate against anchors (we provide H.265 anchor)
Compute metrics for encoded videos
uv run compute_benchmark_metrics.py --config configs/compute_benchmark_metrics.yaml
Compute optical flow, DeQA and texture complexity for training/validation frame sequences
uv run calculate_frame_sequence_metrics.py --config configs/dataset/calculate_frame_sequence_metrics.yaml
Model conversion
Run commands from the video/ directory.
Prerequisites
Download and extract the 540p VCD data, which is used during export validation and testing.
To convert a pre-trained model, download its checkpoint from the Models table to ~/mlvc/job-outputs/pretrained/, keeping its filename.
Copy model_configs_example.yaml to video/conversion/_full_model/model_configs.yaml. The template defines standard MLVC and MLVC-S entries with PSNR checkpoints selected by default. Update an entry's weights_path and weights_version to use its perceptual checkpoint.
Model conversion uses the directory layout above by default. If needed, override the job outputs and VCD data directories with VIDEO_JOB_OUTPUTS_DIR and VIDEO_TEST_DATA_DIR, or with --job-outputs-dir and --test-data-dir.
Model export
As an example, export the standard MLVC PSNR model (mlvc-psnr-v1.ckpt) at the default 960x544 input size, using the default model format and target device for your platform:
uv run convert.py export --model-version dmc61sbr_reglu
More examples:
# Example 1: Export for different model formats and target devices
uv run convert.py export --model-version dmc61sbr_reglu --model-type coreml --target-device apple
uv run convert.py export --model-version dmc61sbr_reglu --model-type onnx --target-device intel
uv run convert.py export --model-version dmc61sbr_reglu --model-type onnx --target-device qualcomm
uv run convert.py export --model-version dmc61sbr_reglu --model-type onnx --target-device generic
# Example 2: Export at fixed input sizes (both dimensions must be multiples of 16)
uv run convert.py export --model-version dmc61sbr_reglu --model-width 640 --model-height 368
uv run convert.py export --model-version dmc61sbr_reglu --model-width 320 --model-height 192
# Example 3: Override the configured checkpoint and its version label
uv run convert.py export --model-version dmc61sbr_reglu \
--weights-path /absolute/path/to/mlvc-perceptual-v1.ckpt \
--weights-version perceptual_v1
# Example 4: Enable model benchmark after conversion
uv run convert.py export --model-version dmc61sbr_reglu --benchmark
# Other options
uv run convert.py export --help
Model testing (examples for Apple devices)
The following examples validate, profile, benchmark, and evaluate the default 960x544 CoreML export. Adjust --model-path