[SOLVED] USB Tuner Problems

RealEngineer

Member
Jun 25, 2022
13
4
8
I am having some trouble getting my USB tuner to work properly. I've been working on this for awhile, and I've tried a lot of solutions. Over the course of working on this, I've seen some symptoms I don't understand. I'll try to present what I've tried, and what problems I am running into as concisely as possible.

My goal is to run plex (and later on, jellyfin, but let's not worry about that for now) with a simple USB tuner hooked up to cable. The tuner is a hauppauge WINTV HVR 955Q. I was able to do this successfully when my server was running windows on bare metal. When I tried to do the same thing with an ubuntu server VM (4GB ram 2 cores), everything seemed to go smoothly, except the video came through degraded. There were defects similar to what you would expect using an antenna on a cloudy day or with a bad cable. Below is a shot from Spider man 2, someone just ran past the camera.

1669141840003.png
VM CPU and RAM usage never climbed above 55%, overall server IO delay never got above 8%, normally staying between 0-4 %. This doesn't look like it is a pure performance issue. Pre-recorded videos stream fine, so the problem is likely in how the tuner is interacting with the OS/plex itself. I figured it might be a problem with plex, so I tried TVheadend in a similar VM, and encountered the same issues. I figured it might be the tuner, but some experiments I did seem to disprove that.

I moved the USB tuner to my laptop, and there was no issue. Perfect, clear video. I then booted windows on my server using a "Windows to Go" USB stick, again, perfect video. I booted and installed plex on a live ubuntu USB running on my server, and there was no video degradation. It seems as though issues are only occurring inside of a VM, on bare metal everything runs smoothly. I have come to the conclusion that virtualized hardware might not be fast enough. If someone else has another explanation and/or possible solution, I would love to hear it. This is my root problem. In pursuing a solution to this problem, I encountered another problem, detailed below. If I can fix this problem, I don't need to fix the other one.

Since the issue appeared to be with virtualized hardware, I thought it might be wise to try running plex in an LXC. I installed plex on an LXC with ubuntu 20.04 LTS (Hauppauge drivers don't work with 22 yet), but then I couldn't get plex to detect the tuner. I think there may be something wrong with the pass through.

I tried both of these procedures, and the USB tuner was visible inside the LXC with lsusb, but I am not certain it worked properly.
https://medium.com/@konpat/usb-passthrough-to-an-lxc-proxmox-15482674f11d
https://forum.proxmox.com/threads/passthrough-usb-from-host-to-lxc.23856/

Both yeilded the same result. Inside the container, lsusb yields the following:

Code:
Bus 002 Device 005: ID 2040:b123 Hauppauge

Running lsusb in the host yields this:
Code:
Bus 002 Device 005: ID 2040:b123 Hauppauge WinTV-HVR-955Q

This in combination with plex not seeing the tuner at all has me convinced there is an issue with the tuner pass-through.

I'd appreciate any advice y'all can give me, or anything to try invesigate.
 
I have tried USB port passthrough to a VM in the past but it is too slow, too much overhead. USB/IP does appear to work better for VMs. Passthrough of a whole USB controller feels like overkill for one device (that works on Linux)
Eventually, I used (and am still using) MythTV on a Ubuntu container (LTS 22.04 at the moment) by passing through the USB TV tuner. Not by giving the container access to USB (which paths tend to vary), but passing the /dev/dvb directory instead and having the Proxmox host load all necessary drivers (automatically on boot):
lxc.cgroup2.devices.allow: c 212:* rwm lxc.mount.entry: /dev/dvb dev/dvb none bind,create=dir 0 0
Because the underlying Debian Linux supports the Haupauge DualHD, after I downloaded the necessary firmware, everything just works with Linux DVB.
I also needed to map the video user group of the Ubuntu container (44) to the video user group on the Proxmox host (44), for this to work with an unprivileged container:
lxc.idmap: u 0 100000 65535 lxc.idmap: g 0 100000 44 lxc.idmap: g 44 44 1 lxc.idmap: g 45 100045 65490
Hopefully something like that will work for you too.
 
@leesteken Thank you, that was super helpful. As an added note, I did need to modify /etc/subgid to allow me to map gid 44. After that, everything started working as intended, no video quality loss, etc. Now I just need to pass through GPU and mount network drive from other VM for storage, and everything will be working perfectly as intended.
 
  • Like
Reactions: leesteken
@leesteken and @RealEngineer , I'm struggling with the same thing -- getting a USB TV tuner to perform acceptably/be stable inside an Ubuntu VM on Proxmox. (It's sporadic, slow, and sometimes just dies until I reboot.) Similarly to your first post here, RealEngineer, this used to work perfectly on Windows bare metal.

I'm new to Proxmox and I'm a little unclear where I need to make the changes @leesteken describes: where do I add those configuration values, and what does the first line (lxc.cgroup2.devices.allow etc) mean?

EDIT: I found the config files for my VM at /etc/pve/local/qemu-server. I'm not really sure if this is where I should be doing those things though, I'm out of my depth here because I've only used the UI thus far. Here's what the config file for my Ubuntu VM looks like:
boot: order=scsi0;ide2;net0
cores: 4
ide2: none,media=cdrom
memory: 8196
meta: creation-qemu=7.1.0,ctime=1673717360
name: docker
net0: virtio=76:E0:BF:28:3D:6E,bridge=vmbr0,firewall=1
numa: 0
onboot: 1
ostype: l26
scsi0: local-lvm:vm-100-disk-0,iothread=1,size=32G
scsihw: virtio-scsi-single
smbios1: uuid=da85dd27-6da0-4de3-bd34-2d47fb3bf65b
sockets: 1
startup: order=2
usb0: host=2040:b123
vmgenid: b85b0a65-d36f-4b00-bef6-31a1e206fe0d
 
Last edited:
@leesteken and @RealEngineer , I'm struggling with the same thing -- getting a USB TV tuner to perform acceptably/be stable inside an Ubuntu VM on Proxmox. (It's sporadic, slow, and sometimes just dies until I reboot.) Similarly to your first post here, RealEngineer, this used to work perfectly on Windows bare metal.

I'm new to Proxmox and I'm a little unclear where I need to make the changes @leesteken describes: where do I add those configuration values, and what does the first line (lxc.cgroup2.devices.allow etc) mean?

EDIT: I found the config files for my VM at /etc/pve/local/qemu-server. I'm not really sure if this is where I should be doing those things though, I'm out of my depth here because I've only used the UI thus far. Here's what the config file for my Ubuntu VM looks like:
UBS passthrough does not work very well for high bandwidth or latency sensitive devices. PCIe passthrough of a whole USB controller might work better, if you can get it to work. Alternatively, run Ubuntu in a unprivileged container, load the tuner drivers on the Proxmxo host and passthrough /dev/dvb (and set permissions correctly), like many others on this forum.
 
UBS passthrough does not work very well for high bandwidth or latency sensitive devices. PCIe passthrough of a whole USB controller might work better, if you can get it to work. Alternatively, run Ubuntu in a unprivileged container, load the tuner drivers on the Proxmxo host and passthrough /dev/dvb (and set permissions correctly), like many others on this forum.

Yes, thank you, I saw your earlier comments (and others) about USB passthrough not working well. That's why I'm here. That last part is what I'm trying to do but I don't understand how. I'm struggling to understand which config files are the right ones and exactly how to map through the /dev/dvb device to a qemu VM.

From reading the mount point docs, I figured out a way to map a host path to the VM in /etc/pve/local/qemu-server/100.conf with a line like this:

Code:
mp0: /dev/dvb,mp=/dev/dvb

But I'm not sure that's right, and I haven't yet figured out where/how to set the permissions for it.
 
Last edited:
I was just starting to figure that out...thank you :) That explains why I couldn't find out how to do it.

I suppose I'm going to look into switching my Ubuntu install over to an LXC container.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!