vhost-device/staging/vhost-device-video
dependabot[bot] 5e74f370be build(deps): bump the non-rust-vmm group across 2 directories with 14 updates
Bumps the non-rust-vmm group with 10 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.40` | `4.5.42` |
| [rand](https://github.com/rust-random/rand) | `0.9.1` | `0.9.2` |
| [rstest](https://github.com/la10736/rstest) | `0.25.0` | `0.26.1` |
| [clap_mangen](https://github.com/clap-rs/clap) | `0.2.27` | `0.2.29` |
| [toml](https://github.com/toml-rs/toml) | `0.8.23` | `0.9.4` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.27` | `1.2.30` |
| [litrs](https://github.com/LukasKalbertodt/litrs) | `0.4.1` | `0.4.2` |
| redox_syscall | `0.5.13` | `0.5.17` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.140` | `1.0.142` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.11` | `0.7.12` |

Bumps the non-rust-vmm group with 5 updates in the /staging directory:

| Package | From | To |
| --- | --- | --- |
| [clap](https://github.com/clap-rs/clap) | `4.5.40` | `4.5.42` |
| [rand](https://github.com/rust-random/rand) | `0.9.1` | `0.9.2` |
| [rstest](https://github.com/la10736/rstest) | `0.25.0` | `0.26.1` |
| [rustix](https://github.com/bytecodealliance/rustix) | `1.0.7` | `1.0.8` |
| [winnow](https://github.com/winnow-rs/winnow) | `0.7.11` | `0.7.12` |



Updates `clap` from 4.5.40 to 4.5.42
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.40...clap_complete-v4.5.42)

Updates `rand` from 0.9.1 to 0.9.2
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_core-0.9.1...rand_core-0.9.2)

Updates `rstest` from 0.25.0 to 0.26.1
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.25.0...v0.26.1)

Updates `clap_mangen` from 0.2.27 to 0.2.29
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_mangen-v0.2.27...clap_mangen-v0.2.29)

Updates `toml` from 0.8.23 to 0.9.4
- [Commits](https://github.com/toml-rs/toml/compare/toml-v0.8.23...toml-v0.9.4)

Updates `cc` from 1.2.27 to 1.2.30
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.27...cc-v1.2.30)

Updates `clap_builder` from 4.5.40 to 4.5.42
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.40...v4.5.42)

Updates `clap_derive` from 4.5.40 to 4.5.41
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.40...v4.5.41)

Updates `litrs` from 0.4.1 to 0.4.2
- [Release notes](https://github.com/LukasKalbertodt/litrs/releases)
- [Changelog](https://github.com/LukasKalbertodt/litrs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/LukasKalbertodt/litrs/compare/v0.4.1...v0.4.2)

Updates `redox_syscall` from 0.5.13 to 0.5.17

Updates `rstest_macros` from 0.25.0 to 0.26.1
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.25.0...v0.26.1)

Updates `serde_json` from 1.0.140 to 1.0.142
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.140...v1.0.142)

Updates `winnow` from 0.7.11 to 0.7.12
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.7.11...v0.7.12)

Updates `clap` from 4.5.40 to 4.5.42
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.40...clap_complete-v4.5.42)

Updates `rand` from 0.9.1 to 0.9.2
- [Release notes](https://github.com/rust-random/rand/releases)
- [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/rand/compare/rand_core-0.9.1...rand_core-0.9.2)

Updates `rstest` from 0.25.0 to 0.26.1
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.25.0...v0.26.1)

Updates `clap_builder` from 4.5.40 to 4.5.42
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.40...v4.5.42)

Updates `clap_derive` from 4.5.40 to 4.5.41
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.40...v4.5.41)

Updates `rstest_macros` from 0.25.0 to 0.26.1
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.25.0...v0.26.1)

Updates `rustix` from 1.0.7 to 1.0.8
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md)
- [Commits](https://github.com/bytecodealliance/rustix/compare/v1.0.7...v1.0.8)

Updates `winnow` from 0.7.11 to 0.7.12
- [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/winnow-rs/winnow/compare/v0.7.11...v0.7.12)

---
updated-dependencies:
- dependency-name: clap
  dependency-version: 4.5.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rand
  dependency-version: 0.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rstest
  dependency-version: 0.26.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: clap_mangen
  dependency-version: 0.2.29
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: toml
  dependency-version: 0.9.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: cc
  dependency-version: 1.2.30
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: clap_builder
  dependency-version: 4.5.42
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: clap_derive
  dependency-version: 4.5.41
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: litrs
  dependency-version: 0.4.2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: redox_syscall
  dependency-version: 0.5.17
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rstest_macros
  dependency-version: 0.26.1
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: serde_json
  dependency-version: 1.0.142
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: winnow
  dependency-version: 0.7.12
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: clap
  dependency-version: 4.5.42
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rand
  dependency-version: 0.9.2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rstest
  dependency-version: 0.26.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: clap_builder
  dependency-version: 4.5.42
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: clap_derive
  dependency-version: 4.5.41
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: rstest_macros
  dependency-version: 0.26.1
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: non-rust-vmm
- dependency-name: rustix
  dependency-version: 1.0.8
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
- dependency-name: winnow
  dependency-version: 0.7.12
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: non-rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-01 13:19:56 +02:00
..
src Fix more clippy lints 2025-07-18 13:02:46 +02:00
Cargo.toml build(deps): bump the non-rust-vmm group across 2 directories with 14 updates 2025-08-01 13:19:56 +02:00
CHANGELOG.md chore: standardize changelogs 2024-07-24 19:37:19 +05:30
LICENSE-APACHE video: initial skeleton 2023-10-24 11:17:33 +02:00
LICENSE-BSD-3-Clause video: initial skeleton 2023-10-24 11:17:33 +02:00
README.md video: fill readme 2023-10-24 11:17:33 +02:00
rustfmt.toml video: bump rustfmt.toml edition to 2021 2025-07-18 10:05:07 +02:00

vhost-user-video

Synopsis

vhost-user-video --socket-path <SOCKET_PATH> --backend <BACKEND>

Description

A virtio-video device using the vhost-user protocol.

Arguments

    <BACKEND>
        Video backend to be used [possible values: null, v4l2-decoder]

Options

    -s, --socket-path <SOCKET_PATH>
        Unix socket to which a hypervisor connects to and sets up the control path with the device

    -d, --v4l2-device <V4L2_DEVICE>
        Path to the video device file [default: /dev/video0]

    -b, --backend <BACKEND>
        Video backend to be used [possible values: null, v4l2-decoder]

    -h, --help
        Print help

    -V, --version
        Print version

Limitations

Currently this crate only supports v4l2 stateful decoder devices, and the intention is it will be used with Arm SoCs that implement stateful decode/encode devices such as Qcom Venus, RPi, MediaTek etc.

Support for VAAPI or decoding via libavcodec or similar libraries is not implemented, but this could be added in the future through different video backends.

Features

This crate is a work-in-progress. Also, the specification for this device is still a work-in-progress, so it requires and out-of-tree kernel on the guest. Currently, the vmm translates from virtio-video v3 protocol and writes to a v4l2 mem2mem stateful decoder device. The v3 of the specification was chosen as there is a virtio-video Linux frontend driver implementation available for testing.

The primary goal so far is to enable development of virtio-video frontend driver using purely open source software. Using vicodec v4l2 stateful decoder on the host for testing allows a pure virtual environment for development and testing.

Working example

In this section we provide with some example commands to run the daemon and decode a video using vicodec.

Guest Linux kernel modules:

CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_TEST_SUPPORT=y
CONFIG_V4L_TEST_DRIVERS=y
CONFIG_VIRTIO_VIDEO=y
CONFIG_GDB_SCRIPTS=y
CONFIG_DRM_VIRTIO_GPU=y

Host kernel modules:

CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_TEST_SUPPORT=y
CONFIG_V4L_TEST_DRIVERS=y
CONFIG_VIDEO_VICODEC=y

The daemon should be started first (video3 typically is the stateful video):

host# vhost-user-video --socket-path=/tmp/video.sock --v4l2-device=/dev/video3 --backend=v4l2-decoder

The QEMU invocation needs to create a chardev socket the device can use to communicate as well as share the guests memory over a memfd.

host# qemu-system								                            \
    -device vhost-user-video-pci,chardev=video,id=video                     \
    -chardev socket,path=/tmp/video.sock,id=video                           \
    -m 4096 		        					                            \
    -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on	\
    -numa node,memdev=mem							                        \
    ...

After booting, the device should be available at /dev/video0:

guest# v4l2-ctl -d/dev/video0 --info
Driver Info:
        Driver name      : virtio-video
        Card type        : 
        Bus info         : virtio:stateful-decoder
        Driver version   : 6.1.0
        Capabilities     : 0x84204000
                Video Memory-to-Memory Multiplanar
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04204000
                Video Memory-to-Memory Multiplanar
                Streaming
                Extended Pix Format

Example v4l2-ctl decode command:

guest# v4l2-ctl -d0 -x width=640,height=480 -v width=640,height=480,pixelformat=YU12 \
    --stream-mmap --stream-out-mmap --stream-from test_640_480-420P.fwht            \
    --stream-to out-test-640-480.YU12

Play the raw decoded video with ffplay or mplayer:

guest# ffplay -loglevel warning -v info -f rawvideo -pixel_format yuv420p \
    -video_size "640x480" ./out-test-640-480.YU12
guest# mplayer -demuxer rawvideo -rawvideo \
    format=i420:w=640:h=480:fps=25 out-test-640-480.YU12

Enable v4l2 debug in virtio-video driver:

# echo 0x1f > /sys/class/video4linux/videoX/dev_debug

License

This project is licensed under either of