USB HDMI Capture

Can you paste the log snippet with the error like other posts here


2025/03/01 15:23:02.229172 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 15:25:02.229474 [TNR] Closing connection M3U-usbhdmi ch201 after no data was received for 2m0s
2025/03/01 15:25:02.229794 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: read |0: file already closed
2025/03/01 15:25:02.229826 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 15:25:02.230053 [SNR] Buffer statistics for 192.168.1.131 (Casey’s iPhone) for ch201 USB HDMI Capture: buf=0% drop=0%

2025/03/01 15:25:43.971965 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 15:25:43.973935 [HLS] ffmpeg: capture-usb-hdmi:  /dev/video0: Device or resource busy
2025/03/01 15:25:43.974284 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: exit status 1
2025/03/01 15:25:43.974294 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 15:25:43.974331 [SNR] Buffer statistics for 192.168.1.131 (Casey’s iPhone) for ch201 USB HDMI Capture: buf=0% drop=0%

2025/03/01 16:02:09.515573 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 16:02:09.517632 [HLS] ffmpeg: capture-usb-hdmi:  /dev/video0: Device or resource busy
2025/03/01 16:02:09.518212 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: exit status 1
2025/03/01 16:02:09.518225 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 16:02:09.518366 [SNR] Buffer statistics for 192.168.1.149 (Upstairs Apple TV) for ch201 USB HDMI Capture: buf=0% drop=0%

After the first attempted tune the device/resource becomes unavailable so I have to run this to kill it.


rice@amd:~$ sudo fuser /dev/video0
[sudo] password for rice: 
/dev/video0:         63152m
rice@amd:~$ sudo kill -9 63152

Trying to tune after the kill results in this in the logs after streaming to the tuner failed timeout after 32s


2025/03/01 16:05:21.269007 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 16:07:21.269364 [TNR] Closing connection M3U-usbhdmi ch201 after no data was received for 2m0s
2025/03/01 16:07:21.269396 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: read |0: file already closed
2025/03/01 16:07:21.269401 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/01 16:07:21.269508 [SNR] Buffer statistics for 192.168.1.149 (Upstairs Apple TV) for ch201 USB HDMI Capture: buf=0% drop=0%

I'm getting a different error now. Any ideas would be helpful.

2025/03/01 16:41:53.196041 [HLS] Starting live stream for channel 11634 from 192.168.50.149
2025/03/01 16:41:53.953126 [HLS] ffmpeg: capture-usb-hdmi:  Guessed Channel Layout for Input Stream #0.1 : stereo
2025/03/01 16:41:54.737502 [HLS] Probed live stream in 1.5409192s: h264 1920x1080 progressive 27011414bps
2025/03/01 16:41:55.481156 [HLS] Session ch11634-dANY-ip192.168.50.149 started in 2.285115s
2025/03/01 16:41:55.485441 [ENC] Starting encoder for ch11634 in F:\DVR-storage\DVR\Streaming\ch11634-dANY-ip192.168.50.149-3363225299\encoder-1-549494935 at 1 (0.054944) (encoder=h264_nvenc, codec=h264, acodec=copy, resolution=1080, deinterlacer=hardware, bitrate=7882, segment_size=0.01)
2025/03/01 16:41:55.800135 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  [h264 @ 0000029fb4d8ab00] Hardware is lacking required capabilities
2025/03/01 16:41:55.800135 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  [h264 @ 0000029fb4d8ab00] Failed setup for format cuda: hwaccel initialisation returned error.
2025/03/01 16:41:55.840216 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scale_0'
2025/03/01 16:41:55.841065 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Error reinitializing filters!
2025/03/01 16:41:55.841065 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Failed to inject frame into filter network: Function not implemented
2025/03/01 16:41:55.841065 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Error while processing the decoded data for stream #0:0
2025/03/01 16:41:55.994206 [ENC] Encoder stopped for ch11634 in F:\DVR-storage\DVR\Streaming\ch11634-dANY-ip192.168.50.149-3363225299\encoder-1-549494935 after starting from 1 without encoding any segments
2025/03/01 16:41:55.997859 [ENC] Starting encoder for ch11634 in F:\DVR-storage\DVR\Streaming\ch11634-dANY-ip192.168.50.149-3363225299\encoder-1-2264303537 at 1 (0.054944) (encoder=h264_nvenc, codec=h264, acodec=copy, resolution=1080, deinterlacer=hardware, bitrate=7882, segment_size=0.01)
2025/03/01 16:41:56.226332 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  [h264 @ 000001f7022eae00] Hardware is lacking required capabilities
2025/03/01 16:41:56.226451 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  [h264 @ 000001f7022eae00] Failed setup for format cuda: hwaccel initialisation returned error.
2025/03/01 16:41:56.279663 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scale_0'
2025/03/01 16:41:56.281461 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Error reinitializing filters!
2025/03/01 16:41:56.281461 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Failed to inject frame into filter network: Function not implemented
2025/03/01 16:41:56.281461 [HLS] ffmpeg: ch11634-dANY-ip192.168.50.149-1-h264-copy---7882-0-1080-0-0--hardware-false-false-0.01-0:  Error while processing the decoded data for stream #0:0
2025/03/01 16:41:56.398278 [ENC] Encoder stopped for ch11634 in F:\DVR-storage\DVR\Streaming\ch11634-dANY-ip192.168.50.149-3363225299\encoder-1-2264303537 after starting from 1 without encoding any segments. Marked segment as failed.
2025/03/01 16:42:11.366242 [HLS] Stopping transcoder session ch11634-dANY-ip192.168.50.149 (out=16.439722s finished=false first_seq=1 last_seq=1)
2025/03/01 16:42:11.366242 [TNR] Closed connection to M3U-USBHDMICapture for ch11634 USB HDMI Capture
2025/03/01 16:42:11.366242 [ERR] Error during stream M3U-USBHDMICapture ch11634 USB HDMI Capture: read |0: file already closed
2025/03/01 16:42:11.368596 [SNR] Buffer statistics for ch11634 USB HDMI Capture: buf=0% drop=0%
2025/03/01 16:42:11.436528 [HLS] ffmpeg: capture-usb-hdmi:  av_interleaved_write_frame(): Invalid argument
2025/03/01 16:42:11.453322 [HLS] ffmpeg: capture-usb-hdmi:      Last message repeated 1 times
2025/03/01 16:42:11.453322 [HLS] ffmpeg: capture-usb-hdmi:  Error writing trailer of pipe:: Invalid argument
2025/03/01 16:42:11.453322 [HLS] ffmpeg: capture-usb-hdmi:  Error closing file pipe:: Invalid argument
1 Like

Try this one:

1 Like

Linux Ubuntu 22.04 desktop, AMD 9600x cpu, channels version 2025.03.02.2319.

I’m getting clean hiccup free video at 60fps now but I’m not getting any audio. There is no mention on any audio errors concerning audio in the logs. Here are the following m3u formats I’ve tried.


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

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

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0?framerate=60&audio=plughw:Video,0

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0?framerate=60&audio=alsa_input.usb-UltraSemi_USB2_Video_20210621-02.analog-stereo

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0?framerate=60&audio=hw:Video,0

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0?framerate=60&audio=plughw:Video,0

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0?framerate=60&audio=alsa_input.usb-UltraSemi_USB2_Video_20210621-02.analog-stereo

If I run this command I get both video and audio capture, playback from the output.mkv file in VLC is successful with both audio and video.


ffmpeg -f v4l2 -framerate 60 -i /dev/video0 -f alsa -i hw:Video,0 -c:v copy -c:a aac output.mkv

Output of audio sources in terminal


rice@amd:~$ pactl list sources | grep -E 'Name:|Description:'
                Name: alsa_output.pci-0000_0c_00.6.iec958-stereo.monitor
                Description: Monitor of Family 17h (Models 10h-1fh) HD Audio Controller Digital Stereo (IEC958)
                Name: alsa_output.pci-0000_0c_00.1.hdmi-surround.monitor
                Description: Monitor of HD-Audio Generic Digital Surround 5.1 (HDMI)
                Name: alsa_input.usb-UltraSemi_USB2_Video_20210621-02.analog-stereo
                Description: USB2 Video Analog Stereo

Try this w/ next build:

#EXTM3U
#EXTINF:-1, channel-id="usb-hdmi",USB HDMI Capture
capture://v4l2/video0/hw:Video,0/?framerate=60
1 Like

Both 2019 and 2037 error with


2025/03/06 14:52:35.593192 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/06 14:52:35.595391 [HLS] ffmpeg: capture-usb-hdmi:  Unknown input format: 'alsa'
2025/03/06 14:52:35.595741 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: exit status 1
2025/03/06 14:52:35.595754 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/06 14:52:35.595794 [SNR] Buffer statistics for 192.168.1.131 (Casey’s iPhone) for ch201 USB HDMI Capture: buf=0% drop=0%

2119
Same log errors

Still same on Mac (assumingly due to capture device perms)

Fresh diagnostics on 61d5aa07-d474-4bc8-9300-7db8f867452d .

1 Like

I am still unable to get the sound to come through my Linux setup but I see others are having the same issue. I tried the latest config in the post and got the exact same error messages so that is promising.

I have made progress and created a home assistant automation that is based on a sensor that detects the channel number in Channels DVR and will then run a script to change the channel via a RF blaster.

Try this one:

No video or audio on 2051


2025/03/09 17:05:52.077460 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/09 17:05:52.086256 [HLS] ffmpeg: capture-usb-hdmi:  ALSA lib /home/vagrant/channels-server/ext/alsa-lib/src/conf.c:4580:(snd_config_update_r) Cannot access file /home/vagrant/channels-server/ext/dst/linux-x86_64/share/alsa/alsa.conf
2025/03/09 17:05:52.086279 [HLS] ffmpeg: capture-usb-hdmi:  ALSA lib /home/vagrant/channels-server/ext/alsa-lib/src/pcm/pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM hw:Video,0
2025/03/09 17:05:52.086281 [HLS] ffmpeg: capture-usb-hdmi:  [alsa @ 0x26876700] cannot open audio device hw:Video,0 (No such file or directory)
2025/03/09 17:05:52.086285 [HLS] ffmpeg: capture-usb-hdmi:  hw:Video,0: Input/output error
2025/03/09 17:05:52.086687 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: exit status 1
2025/03/09 17:05:52.086697 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/09 17:05:52.086742 [SNR] Buffer statistics for 192.168.1.131 (Casey’s iPhone) for ch201 USB HDMI Capture: buf=0% drop=0%

1 Like

Which audio output is preferred from the usb capture device? Analog or digital?

Does the USB capture device have an input port for Toslink or SPDIF otherwise? That could be interesting with regard to multi-channel (more than 2) audio. Actually, could the video be captured by the USB capture device and the audio brought in on the PC's SPDIF.

dunno, what do arecord -l and arecord -L show

I have the capture device linked in the first post. It doesn’t have optical outputs on it. It can output either analog or digital via the usb port. Most pc do not have an optical input. If my pc had an optical input I would have tried an hdmi audio stripper.

1 Like

rice@amd:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Video [USB3 Video], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 0: ALC897 Analog [ALC897 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Generic_1 [HD-Audio Generic], device 2: ALC897 Alt Analog [ALC897 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
rice@amd:~$ arecord -L 
null
    Discard all samples (playback) or generate zero samples (capture)
default
    Playback/recording through the PulseAudio sound server
samplerate
    Rate Converter Plugin Using Samplerate Library
speexrate
    Rate Converter Plugin Using Speex Resampler
jack
    JACK Audio Connection Kit
oss
    Open Sound System
pulse
    PulseAudio Sound Server
upmix
    Plugin for channel upmix (4,6,8)
vdownmix
    Plugin for channel downmix (stereo) with a simple spacialization
usbstream:CARD=Generic
    HD-Audio Generic
    USB Stream Output
hw:CARD=Video,DEV=0
    USB3 Video, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Video,DEV=0
    USB3 Video, USB Audio
    Hardware device with all software conversions
sysdefault:CARD=Video
    USB3 Video, USB Audio
    Default Audio Device
front:CARD=Video,DEV=0
    USB3 Video, USB Audio
    Front output / input
dsnoop:CARD=Video,DEV=0
    USB3 Video, USB Audio
    Direct sample snooping device
usbstream:CARD=Video
    USB3 Video
    USB Stream Output
hw:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC897 Analog
    Direct hardware device without any conversions
hw:CARD=Generic_1,DEV=2
    HD-Audio Generic, ALC897 Alt Analog
    Direct hardware device without any conversions
plughw:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC897 Analog
    Hardware device with all software conversions
plughw:CARD=Generic_1,DEV=2
    HD-Audio Generic, ALC897 Alt Analog
    Hardware device with all software conversions
sysdefault:CARD=Generic_1
    HD-Audio Generic, ALC897 Analog
    Default Audio Device
front:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC897 Analog
    Front output / input
dsnoop:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALC897 Analog
    Direct sample snooping device
dsnoop:CARD=Generic_1,DEV=2
    HD-Audio Generic, ALC897 Alt Analog
    Direct sample snooping device
usbstream:CARD=Generic_1
    HD-Audio Generic
    USB Stream Output
rice@amd:~$ 

Try this

I get audio but no video, just a black screen


2025/03/09 20:54:32.779003 [TNR] Opened connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/09 20:54:33.024852 [HLS] ffmpeg: capture-usb-hdmi:  Guessed Channel Layout for Input Stream #0.0 : stereo
2025/03/09 20:54:33.368489 [HLS] ffmpeg: capture-usb-hdmi:  Codec AVOption g (set the group of picture (GOP) size) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
2025/03/09 20:54:33.368504 [HLS] ffmpeg: capture-usb-hdmi:  Codec AVOption preset (Set the encoding preset (cf. x264 --fullhelp)) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
2025/03/09 20:54:33.368510 [HLS] ffmpeg: capture-usb-hdmi:  Codec AVOption x264opts (x264 options) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
2025/03/09 20:54:33.368512 [HLS] ffmpeg: capture-usb-hdmi:  Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (pipe:) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
2025/03/09 20:54:33.378692 [HLS] ffmpeg: capture-usb-hdmi:  [alsa @ 0x446d6700] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2025/03/09 20:54:33.379714 [HLS] ffmpeg: capture-usb-hdmi:  [mpegts @ 0x446dc380] frame size not set
2025/03/09 20:54:42.467143 [SNR] Buffer statistics for 192.168.1.131 (Casey’s iPhone) for ch201 USB HDMI Capture: buf=0% drop=0%
2025/03/09 20:54:42.467171 [ERR] Error during stream M3U-usbhdmi ch201 USB HDMI Capture: read |0: file already closed
2025/03/09 20:54:42.467176 [TNR] Closed connection to M3U-usbhdmi for ch201 USB HDMI Capture
2025/03/09 20:54:42.488250 [HLS] ffmpeg: capture-usb-hdmi:  av_interleaved_write_frame(): Broken pipe
2025/03/09 20:54:42.490647 [HLS] ffmpeg: capture-usb-hdmi:  [video4linux2,v4l2 @ 0x446da0c0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2025/03/09 20:54:42.491132 [HLS] ffmpeg: capture-usb-hdmi:  av_interleaved_write_frame(): Broken pipe
2025/03/09 20:54:42.491374 [HLS] ffmpeg: capture-usb-hdmi:      Last message repeated 1 times
2025/03/09 20:54:42.491377 [HLS] ffmpeg: capture-usb-hdmi:  Error writing trailer of pipe:: Broken pipe
2025/03/09 20:54:42.491379 [HLS] ffmpeg: capture-usb-hdmi:  Error closing file pipe:: Broken pipe

Does it help if you:

macOS > System Settings > Privacy & Security > Screen & Audio System Recording > :heavy_plus_sign: > ~/Library/Application Support/ChannelsDVR/latest/ffmpeg