https://github.com/freemkv/bdemu
4K UHD / Blu-ray / DVD drive emulator with hardware profiles
https://github.com/freemkv/bdemu
4k blu-ray disc-ripping dvd linux open-source optical-drive rust uhd
Last synced: about 2 months ago
JSON representation
4K UHD / Blu-ray / DVD drive emulator with hardware profiles
- Host: GitHub
- URL: https://github.com/freemkv/bdemu
- Owner: freemkv
- License: other
- Created: 2026-04-06T03:39:11.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-06-02T22:23:31.000Z (about 2 months ago)
- Last Synced: 2026-06-02T22:25:32.076Z (about 2 months ago)
- Topics: 4k, blu-ray, disc-ripping, dvd, linux, open-source, optical-drive, rust, uhd
- Language: Rust
- Homepage:
- Size: 298 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
[](LICENSE)
[](https://github.com/freemkv/bdemu/releases/latest)
# bdemu
Blu-ray drive emulator for development and testing. Intercepts Linux SG_IO ioctls via `LD_PRELOAD` to emulate a complete optical drive from captured SCSI response data. No real drive needed.
Part of the [freemkv](https://github.com/freemkv) project. **Linux only.**
## Download
**[Download latest release](https://github.com/freemkv/bdemu/releases/latest)**
Or build from source: `cargo build --release`
## Quick Start
```bash
# Capture a disc (auto-names, auto-ejects)
bdemu capture-disc /dev/sr0 ./testbed/disc
# Emulate a drive and scan the captured disc
bdemu run --profile profiles/bu40n --disc my_movie -- freemkv info disc://
```
## Commands
```
bdemu 0.29.0
Commands:
run --profile [--disc ] -- Emulate drive, run command
capture-disc Smart capture from hardware
validate Check profile completeness
Control (while emulator is running):
status Show emulator state
eject Eject the disc
load Load a disc
list-discs List available discs
Examples:
bdemu capture-disc /dev/sr0 ./testbed/disc Capture, auto-names, ejects
bdemu run -p profiles/bu40n -d sample -- freemkv info disc://
bdemu validate profiles/bu40n/
```
## Smart Capture
`capture-disc` uses libfreemkv to parse the disc's UDF filesystem and capture only the sectors needed for emulation. A typical capture is 15-80 MB instead of 25-90 GB.
After capture, the output directory is automatically renamed to the disc's volume ID (e.g. `disc` becomes `sample_film`). If the name already exists, a number is appended (`sample_film_2`).
The disc tray ejects automatically when capture completes.
## Creating Profiles
### From real hardware
```bash
# Capture drive identity (one-time per drive)
freemkv info disc:// --share
# Capture discs (repeat for each disc)
bdemu capture-disc /dev/sr0 profiles/my-drive/discs/disc
```
## Profile Structure
```
profiles/my-drive/
+-- drive.toml # Drive metadata
+-- inquiry.bin # INQUIRY response (96 bytes)
+-- gc_*.bin # GET_CONFIG features
+-- rpc_state.bin # REPORT KEY RPC state
+-- mode_2a.bin # MODE SENSE page 2A
+-- discs/
+-- my-disc/
+-- toc.bin # READ TOC response
+-- capacity.bin # READ CAPACITY response
+-- disc_info.bin
+-- ds_00.bin # READ DISC STRUCTURE
+-- sectors.bin # BDSM sparse sector map
```
## Environment Variables
| Variable | Description |
|----------|-------------|
| `BDEMU_PROFILE` | Path to drive profile directory |
| `BDEMU_DISC` | Disc subdirectory name |
| `BDEMU_QUIET` | Suppress SCSI command logging |
## License
AGPL-3.0-only