USB HDMI Capture

Gladiator2

Just snagged one of these on a lighting deal!
Thanks for the link @tmm1

Success! Got the ADBTuner configured, and all YTTV channels added. Scheduled some recordings. Let's see if that all works out fine.

Nice.

I have this one coming from Amazon Vine Program. So, is free to me.
Hopefully, it not junk.
Amazon.com: Papeaso USB 3.0 Video Capture Card, HDMI to USB-A/C Capture Card with pd, 1440P 30fps & 1080P 60fps Video Capture, for Streaming, Teaching,Gaming, Video conferencing or Live Broadcasting : Electronics

This is so dope @tmm1 , can’t wait to try it!

Right, now that everyone on Windows has it working, let's go to Mac.

Submitted 9d1b1dd9-9f72-4ab2-bcb6-0a16abb34907 - my attempt just sort of dies, and I'm only trying a single capture tuner to test before fiddling with adbtuner

./ffmpeg -hide_banner -f avfoundation -list_devices 1 -i /dev/null

[AVFoundation indev @ 0x145f04700] AVFoundation video devices:
[AVFoundation indev @ 0x145f04700] [0] USB3 Video
[AVFoundation indev @ 0x145f04700] [1] Capture screen 0
[AVFoundation indev @ 0x145f04700] AVFoundation audio devices:
[AVFoundation indev @ 0x145f04700] [0] USB3 Digital Audio
#EXTM3U

#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://avfoundation/USB3 Video/USB3 Digital Audio/?framerate=60

FYI, if you had missed it, I had posted some notes about MacOS earlier. Make sure you are running Channels DVR in the foreground and that Terminal has camera access permission. Otherwise ffmpeg will just hang waiting for video data that never arrives.

I'm not sure what the best long term work around for this is going to be. But I can confirm that when Channels DVR is launched outside of launchd the USB devices work fine by themselves and with ADBTuner.

1 Like

Has anyone tried it with YUY2? It looks like the MJPEG works fine.

Thanks - that sort of solves it, but oddly, the iOS client seems to only do a single frame, then pause. I'll wait for @tmm1 to chime in on the camera perms front, before proceeding more - he's obviously worked around at least some of it, if not knows the solution.

I'll check it out tonight. Diagnostics would be helpful.

What are placeholders based on seconds minutes ? I want to add a 2 hour place holder for custom captures.

Channels Support - Add Custom Channels with M3U Playlists

Thanks

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