USB HDMI Capture

Submitted the hang diagnostics above earlier. Starting locally per @turtletank 's workaround works.

My client issue with pausing only seems to be impacting my ipad - submitted client diagnostics there (1f0d1bc8-0ec8-4a17-a2fa-1e262a5f1043 ).
My iphone client worked without issue, so thinking it's maybe something with my (older and space constrained) ipad.

Also submitted d6244621-bba5-464e-b42e-69f11811f3ff from the local start.

Having trouble with Ubuntu Linux, just trying to test the capture before setting up with AH4C or ADBTuner.

I am using the capture card referenced in the first post from Amazon.

The m3u I’m using:


#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0

Output of v4l2-ctl --list-devices:


rice@amd:~$   v4l2-ctl --list-devices
USB3 Video: USB3 Video (usb-0000:08:00.0-5):
        /dev/video0
        /dev/video1
        /dev/media0

I’m able to successfully test capture and playback using:


rice@amd:~$ /home/rice/channels-dvr/2025.02.25.0015/ffmpeg -f v4l2 -i /dev/video0 -c:v copy -f matroska output.mkv
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1578.225791, bitrate: 1990656 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1990656 kb/s, 60 fps, 60 tbr, 1000k tbn
File 'output.mkv' already exists. Overwrite? [y/N] y
Output #0, matroska, to 'output.mkv':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, q=2-31, 1990656 kb/s, 60 fps, 60 tbr, 1k tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 size=       0kB time=00:00:00.00 bitrate=3904.0kbits/s speedframe=   61 fps=0.0 q=-1.0 size=  242944kB time=00:00:05.33 bitrate=373115.3kbits/s speframe=   91 fps= 91 q=-1.0 size=  364288kB time=00:00:05.83 bitrate=511526.8kbits/s speframe=  122 fps= 81 q=-1.0 size=  489984kB time=00:00:06.35 bitrate=632018.4kbits/s speframe=  152 fps= 75 q=-1.0 size=  611328kB time=00:00:06.85 bitrate=731094.7kbits/s speframe=  182 fps= 72 q=-1.0 size=  732928kB time=00:00:07.35 bitrate=816890.6kbits/s speframe=  213 fps= 70 q=-1.0 size=  858368kB time=00:00:07.86 bitrate=893828.7kbits/s speframe=  243 fps= 69 q=-1.0 size=  979968kB time=00:00:08.36 bitrate=959471.5kbits/s speframe=  274 fps= 68 q=-1.0 size= 1105408kB time=00:00:08.88 bitrate=1019419.4kbits/s spframe=  304 fps= 67 q=-1.0 size= 1227008kB time=00:00:09.38 bitrate=1071261.8kbits/s spframe=  334 fps= 66 q=-1.0 size= 1348608kB time=00:00:09.88 bitrate=1117858.6kbits/s spframe=  364 fps= 66 q=-1.0 size= 1469952kB time=00:00:10.38 bitrate=1159765.7kbits/s spframe=  394 fps= 65 q=-1.0 size= 1591552kB time=00:00:10.88 bitrate=1198014.7kbits/s spframe=  424 fps= 65 q=-1.0 size= 1713152kB time=00:00:11.38 bitrate=1232903.6kbits/s spframe=  455 fps= 64 q=-1.0 size= 1838592kB time=00:00:11.90 bitrate=1265692.9kbits/s spframe=  485 fps= 64 q=-1.0 size= 1960192kB time=00:00:12.39 bitrate=1295095.8kbits/s spframe=  515 fps= 64 q=-1.0 size= 2081536kB time=00:00:12.89 bitrate=1321958.5kbits/s spframe=  545 fps= 64 q=-1.0 size= 2203136kB time=00:00:13.39 bitrate=1346972.9kbits/s spframe=  575 fps= 63 q=-1.0 size= 2324480kB time=00:00:13.89 bitrate=1370036.7kbits/s spframe=  605 fps= 63 q=-1.0 size= 2446080kB time=00:00:14.39 bitrate=1391644.4kbits/s speed=1.51x    

[q] command received. Exiting.

frame=  605 fps= 63 q=-1.0 Lsize= 2450278kB time=00:00:14.39 bitrate=1394032.9kbits/s speed= 1.5x    
video:2450250kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001152%
[video4linux2,v4l2 @ 0x2515ef00] Some buffers are still owned by the caller on close.
ioctl(VIDIOC_QBUF): Bad file descriptor




rice@amd:~$ ffplay output.mkv
ffplay version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2003-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, matroska,webm, from 'output.mkv':   0KB sq=    0B f=0/0  
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:00:14.42, start: 0.000000, bitrate: 1392485 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 60 fps, 60 tbr, 1k tbn, 1k tbc
    Metadata:
      DURATION        : 00:00:14.415000000
  27.92 M-V:  0.000 fd=   1 aq=    0KB vq=    0KB sq=    0B f=0/0  

I’ve tried a lot of different m3u texts and I think I need to give the fetching guide data servers a break. I also feel like the capture is hanging behind the scenes and never releases the capture device.

New diagnostic log submitted under a04dc029-de50-4682-ad41-2a856d137a15

1 Like

Hmm, this is what I see in your DVR log:

2025/02/25 17:15:06.796877 [HLS] ffmpeg: capture-usb-hdmi:  [video4linux2,v4l2 @ 0x428cf640] ioctl(VIDIOC_DQBUF): No such device
2025/02/25 17:15:06.796880 [HLS] ffmpeg: capture-usb-hdmi:  /dev/video0: No such device

Wonder if it is a permissions thing? What does ls -alh /dev/video* show? What user is the DVR running as?

1 Like

It’s possible that was from when I yanked the card out of the usb port because my testing was showing it was in use and never lets it go.

rice@amd:~$ ls -alh /dev/video0
crw-rw----+ 1 root video 81, 0 Feb 25 17:15 /dev/video0

User rice in the home directory

Looking back at the logs that is indeed when I pulled the card from the usb port because I was getting device or resource busy.

Should the m3u capture://v4l2/video0 have /dev in it? I think I tried it that way but got errors

The /dev/ part is not required. I didn't really test this on Linux yet.. sounds like it needs more work.

@hancox can you try this on macOS DVR Pre-Release Notes - #1680 by fancybot

1 Like

no real change, unfort - still hangs on normal start on iOS client

014e3f4a-661d-49d7-ae20-2978b0614e5d submitted

This is great. I always wanted to try the LinkPI products to pull in YTTV channels into Channels DVR, but it was too expensive for what I would gain.

I use a Synology NAS as the Channels DVR server. I assume that I need to purchase USB to HDMI capture cards, but they need to be setup on my Windows PC and not directly into the Synology NAS, correct? Is there any other way to get the USB to HDMI devices onto the network instead of through a PC? I'd rather not run both the Synology NAS and the Windows PC. Any other options?

Couldn't you use the linux option since DSM is like Linux?
Synology works great for me. I bought some hdmi encoders and onn boxes and they work great.

Unfortunately that's above my head.

The HDMI encoder approach is what I wanted to try, but again it's a pricey buy in.

I have thought about purchasing the capture device.
I have a windows device on the network.
The 2 hdmi encoders i've setup are working great.

I have bought the capture card recommended from Amazon. I cannot get it to work with this using Linux

#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0

However I am seeing video when I follow this print

ffplay -f v4l2 -input_format nv12 -video_size 1920x1080 -framerate 30 -i /dev/video0

From this article

Found one of the links above for USB Capture Devices has "Used - Like New" listed for $11.25 if you are looking for low investment for testing.

https://www.amazon.com/gp/product/B08Z3XDYQ7

I got this capture dongle today. (Amazon Vine program)
https://www.amazon.com/dp/B0DQ59PPS5?tag=channels04-20

It supports much more than the other older "Game station" style capture device.

[dshow @ 000001963e373fc0] "USB3.0 Capture" (video)
[dshow @ 000001963e373fc0]   Alternative name "@device_pnp_\\?\usb#vid_345f&pid_2130&mi_00#6&1346e323&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001963e373fc0] "Digital Audio Interface (USB3.0 Capture)" (audio)
[dshow @ 000001963e373fc0]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{70E232B1-54CB-4982-9E9B-CAE6B8B141E7}"
dummy: Immediate exit requested

C:\Windows\System32>C:\ProgramData\ChannelsDVR\latest\ffmpeg.exe -f dshow -list_options true -i video="USB3.0 Capture"
[dshow @ 000001c02207d000] DirectShow video device options (from video devices)
[dshow @ 000001c02207d000]  Pin "Capture" (alternative pin name "0")
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1920x1080 fps=10 max s=1920x1080 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1920x1080 fps=10 max s=1920x1080 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=2560x1440 fps=10 max s=2560x1440 fps=30
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=2560x1440 fps=10 max s=2560x1440 fps=30 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1360x768 fps=10 max s=1360x768 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1360x768 fps=10 max s=1360x768 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x1024 fps=10 max s=1280x1024 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x1024 fps=10 max s=1280x1024 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x960 fps=10 max s=1280x960 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x960 fps=10 max s=1280x960 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x720 fps=10 max s=1280x720 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1280x720 fps=10 max s=1280x720 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1024x768 fps=10 max s=1024x768 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=1024x768 fps=10 max s=1024x768 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=800x600 fps=10 max s=800x600 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=800x600 fps=10 max s=800x600 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=720x576 fps=10 max s=720x576 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=720x576 fps=10 max s=720x576 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=720x480 fps=10 max s=720x480 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=720x480 fps=10 max s=720x480 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=640x480 fps=10 max s=640x480 fps=60.0002
[dshow @ 000001c02207d000]   pixel_format=yuyv422  min s=640x480 fps=10 max s=640x480 fps=60.0002 (tv, bt470bg/bt709/unknown, topleft)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1920x1080 fps=10 max s=1920x1080 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1920x1080 fps=10 max s=1920x1080 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=2560x1440 fps=10 max s=2560x1440 fps=30
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=2560x1440 fps=10 max s=2560x1440 fps=30 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1360x768 fps=10 max s=1360x768 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1360x768 fps=10 max s=1360x768 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x1024 fps=10 max s=1280x1024 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x1024 fps=10 max s=1280x1024 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x960 fps=10 max s=1280x960 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x960 fps=10 max s=1280x960 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x720 fps=10 max s=1280x720 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1280x720 fps=10 max s=1280x720 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1024x768 fps=10 max s=1024x768 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=1024x768 fps=10 max s=1024x768 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=800x600 fps=10 max s=800x600 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=800x600 fps=10 max s=800x600 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=720x576 fps=10 max s=720x576 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=720x576 fps=10 max s=720x576 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=720x480 fps=10 max s=720x480 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=720x480 fps=10 max s=720x480 fps=60.0002 (pc, bt470bg/bt709/unknown, center)
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=640x480 fps=10 max s=640x480 fps=60.0002
[dshow @ 000001c02207d000]   vcodec=mjpeg  min s=640x480 fps=10 max s=640x480 fps=60.0002 (pc, bt470bg/bt709/unknown, center)

Got it working fine in Channels at 2160x1440 30fps.
Input latency is still a huge issue, 3sec a min . But, audio/video sync looks good.

NOTE: Not sure if related to recent pre-release updates, but ffmpeg.exe will not work, "Not a valid win 32 application". Had to replace it with .exe from a couple versions back. (i made a separate thread on that.)

This is what my logs are saying when I try to stream:

2025/02/28 07:58:56.742326 [HLS] ffmpeg: capture-usb-hdmi: [AVFilterGraph @ 0xb344950] No such filter: ''
2025/02/28 07:58:56.742433 [HLS] ffmpeg: capture-usb-hdmi: Error reinitializing filters!
2025/02/28 07:58:56.742446 [HLS] ffmpeg: capture-usb-hdmi: Failed to inject frame into filter network: Invalid argument
2025/02/28 07:58:56.742458 [HLS] ffmpeg: capture-usb-hdmi: Error while processing the decoded data for stream #0:0
2025/02/28 07:58:56.742489 [HLS] ffmpeg: capture-usb-hdmi: [video4linux2,v4l2 @ 0xb343270] Some buffers are still owned by the caller on close.
2025/02/28 07:58:56.762404 [ERR] Error during stream M3U-USBTest ch9000 USB HDMI Capture: exit status 1
2025/02/28 07:58:56.762497 [TNR] Closed connection to M3U-USBTest for ch9000 USB HDMI Capture

Here is mine

verson 2025.02.27.2340

#EXTM3U

#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://dshow/USB3 Video/Digital Audio Interface (USB3 Digital Audio)/?framerate=60&video_size=1920x1080

2025/02/28 14:35:58.155447 [HLS] Starting live stream for channel 11435 from 192.168.4.35
2025/02/28 14:35:58.317391 [HLS] ffmpeg: capture-usb-hdmi: Guessed Channel Layout for Input Stream #0.1 : stereo
2025/02/28 14:35:58.317940 [HLS] ffmpeg: capture-usb-hdmi: [AVFilterGraph @ 0000020c551661c0] No such filter: ''
2025/02/28 14:35:58.317940 [HLS] ffmpeg: capture-usb-hdmi: Error reinitializing filters!
2025/02/28 14:35:58.317940 [HLS] ffmpeg: capture-usb-hdmi: Failed to inject frame into filter network: Invalid argument
2025/02/28 14:35:58.317940 [HLS] ffmpeg: capture-usb-hdmi: Error while processing the decoded data for stream #0:0
2025/02/28 14:35:58.349709 [ERR] Error during stream M3U-USBCapture ch11435 USB HDMI Capture: exit status 1
2025/02/28 14:35:58.349709 [TNR] Closed connection to M3U-USBCapture for ch11435 USB HDMI Capture
2025/02/28 14:35:58.349709 [HLS] ffmpeg: ch11435-dANY-ip192.168.4.35-remux: Output file #0 does not contain any stream
2025/02/28 14:35:58.351948 [HLS] Stopping transcoder session ch11435-dANY-ip192.168.4.35 (out=0s finished=true first_seq=0 last_seq=-1)
2025/02/28 14:35:58.352954 [ERR] Probe cancelled for live stream after 197.5063ms and 0 bytes

Try new prerelease

Thank you, it's working now

1 Like

Great thanks, I can see video now, though its choppy. Dropped resolution down to 720 which helped it a bit but I think my hardware is limited on a raspberry pi 4. Can't hear any sound but this is in the log

2025/03/01 07:10:15.338107 [HLS] ffmpeg: capture-usb-hdmi: [mpegts @ 0x174b2370] Non-monotonous DTS in output stream 0:0; previous: 97802722, current: 0; changing to 97802723. This may result in incorrect timestamps in the output file.

Many thanks

A Pi is not good enough this does Software Encoding Capture not hardware. Folks hanging on to a PI to run Channels DVR and Software HDMI Capture are trying to squeeze water out of a rock.

Low Powered Machines cannot do reliable Software Transcoding ... you would need to invest in a hardware Capture Device...

If you want the full potential Of Channels DVR and all the contributions from the Community, you need to move from Low Powered devices.

1 Like