Running time 4 min

LXC V4L2 vs VFIO for Proxmox Capture Card Passthrough

Choose between LXC V4L2 and VFIO passthrough in Proxmox. Find your capture device, set permissions, check IOMMU groups, and verify video.

Illustrated title card for the guide: LXC V4L2 vs VFIO for Proxmox Capture Card Passthrough

Use LXC V4L2 passthrough when the Proxmox host exposes a capture node such as /dev/video0 and your Linux app can use V4L2. Use VFIO PCI passthrough when a virtual machine needs to control the PCI or PCIe capture card with its own driver. Proxmox containers · PCI passthrough · Linux VFIO · V4L2 device nodes

What to checkLXC V4L2VFIO in a VM
What you assignA host device node using dev0. Container optionsA PCI device or function using hostpci0. PCI passthrough
Where the capture driver runsIn the shared host kernel. Proxmox containers · V4L2 device nodesIn the VM. While the device is assigned, the host and other VMs lose access to it. Linux VFIO · PCI passthrough

For a USB capture device, the LXC route still applies if the host exposes a V4L2 capture node. To give a VM the USB device itself, use Proxmox host USB passthrough by vendor and product ID or by bus and port. V4L2 device nodes · Container options · USB passthrough

Pass a V4L2 capture node to LXC

On the Proxmox host, use v4l2-ctl from v4l-utils to list the card’s nodes and query a candidate. Change /dev/video0 to the path under your device in the listing. Look for Video Capture or Video Capture Multiplanar under Device Caps when that field appears. v4l2-ctl manual · Capability labels · V4L2 capabilities

v4l2-ctl --list-devices
v4l2-ctl --device /dev/video0 --info

A card can expose several nodes, and the numeric suffix can change with driver probe order. If the node changes, identify it again before updating dev0. Some hardware needs Media Controller pipeline setup. If your card exposes audio through ALSA, that audio input is separate from the V4L2 video node. V4L2 device nodes · Container options

In the container, run id -u ACCOUNT with the name of the capture account to get its UID. This example uses container 100, a free slot dev0, and an application UID of 1000. The mode 0600 gives the node owner read and write permission. Opening a V4L2 node requires read and write access, even for capture. id manual · File mode bits · V4L2 open requirements · Container options

Back on the host, use pct config 100 to find a free device slot. If the container is running, shut it down before applying the setting. Replace the example ID, node path and UID with your own values. pct command reference

pct config 100
pct shutdown 100
pct set 100 --dev0 path=/dev/video0,uid=1000,mode=0600
pct start 100

Assign a PCI capture card to a VM with VFIO

Check that the CPU and motherboard support IOMMU interrupt remapping. Enable the IOMMU in BIOS or UEFI using the motherboard’s documentation. Schedule downtime for the host reboot. To configure VFIO module loading, place the following entries in /etc/modules-load.d/vfio.conf. PCI passthrough

vfio
vfio_iommu_type1
vfio_pci

After changing module configuration, run update-initramfs -u -k all, then reboot the host. Run the checks below and replace NODE with your Proxmox node name. Look for the VFIO modules, a kernel message confirming that IOMMU or interrupt remapping is enabled, and the card’s PCI address and IOMMU group. PCI passthrough

lsmod | grep vfio
dmesg | grep -e DMAR -e IOMMU -e AMD-Vi
lspci
pvesh get /nodes/NODE/hardware/pci --pci-class-blacklist ""

Use the card’s iommugroup value to find other entries in the same group. A value of -1 means no group was detected. Use a separate IOMMU group for the card. Proxmox allows a card to share its group with its own functions, root port or PCIe bridge. Moving the card to a different slot can sometimes change the grouping. PCI passthrough · PCI inventory API · Linux VFIO

Use qm config 101 to check that hostpci0 is free. If the VM is running, shut it down first. Replace 101 and 03:00.0 with your VM ID and capture card’s host PCI address. qm command reference · PCI passthrough

qm config 101
qm shutdown 101
qm set 101 -hostpci0 03:00.0
qm start 101

If you intend to assign every function at that slot, use the shortened address 03:00 in the qm set command after checking the group. If your guest and card require a PCIe port, set pcie=on on the device entry and use a q35 VM. Proxmox tries to release the card from the host automatically. If that fails, follow its host-device configuration instructions. PCI passthrough

Verify video where the application runs

For a Linux app, run the checks inside the container or, with the capture driver available, inside the VM. Run them as the capture account. List the nodes again in that environment and use its video node in the following command. On a device that supports MMAP streaming, the example requests one frame and saves it to file.raw. Use a fresh output filename if file.raw already exists. v4l2-ctl manual · V4L2 streaming · Linux VFIO

v4l2-ctl --list-devices
v4l2-ctl --device /dev/video0 --stream-mmap --stream-count=1 --stream-to=file.raw

If the container reports a permission error, check the node’s uid and mode against the capture account. In a Linux VM, if lspci lists the card but no V4L2 capture node appears, check the guest’s capture driver. A V4L2 driver registers the video node. Container options · V4L2 open requirements · V4L2 device nodes · PCI passthrough

Evidence and limits. This guide uses Proxmox VE documentation, Linux 6.18 documentation and the v4l-utils 1.30.1 and GNU coreutils 9.7 manuals. No hardware run was performed. Proxmox version history · V4L2 device nodes · v4l2-ctl manual · id manual

Sources

Everything this guide was cut from, in the order it is cited.

  1. Proxmox VE Container Toolkit
  2. Proxmox VE pct command reference
  3. Proxmox VE container configuration options
  4. Proxmox VE PCI(e) passthrough
  5. Proxmox VE qm command reference
  6. Proxmox VE USB passthrough
  7. Proxmox documentation package changelog
  8. Linux 6.18 VFIO documentation
  9. Linux 6.18 V4L2 device nodes
  10. Linux 6.18 V4L2 capability flags
  11. Linux 6.18 V4L2 open requirements
  12. Linux 6.18 V4L2 memory-mapped streaming
  13. v4l2-ctl manual, v4l-utils 1.30.1
  14. GNU coreutils id manual
  15. GNU coreutils chmod manual
  16. v4l-utils 1.30.1 capability labels
  17. Proxmox VE PCI inventory API

Next on the reel