USB HDMI Capture

@krishkal Please update to the latest DVR pre-release and try this again.

OK, it seems to be working now! Thanks!

2 Likes

Even though it seems to be working fine, I do see this in the logs, over and over again... is this normal?

2025/03/20 15:07:34.814323 [HLS] ffmpeg: capture-usb-hdmi:  [mjpeg @ 00000217a052c380] Found EOI before any SOF, ignoring
2025/03/20 15:07:34.815213 [HLS] ffmpeg: capture-usb-hdmi:  [mjpeg @ 00000217a052c380] No JPEG data found in image
2025/03/20 15:07:34.815213 [HLS] ffmpeg: capture-usb-hdmi:  [vist#0:0/mjpeg @ 000002179dbb4d80] Error submitting packet to decoder: Invalid data found when processing input

Would it be possible for the logs to ignore these lines? It creates thousands of these lines in the logs when streaming.


2025/03/20 17:02:40.822663 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294074063, next:13449462 st:0 invalid dropping
2025/03/20 17:02:40.822677 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294074063, next:13449462 invalid dropping st:0
2025/03/20 17:02:40.844102 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294090727, next:13466128 st:0 invalid dropping
2025/03/20 17:02:40.844162 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294090727, next:13466128 invalid dropping st:0
2025/03/20 17:02:40.855191 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294107399, next:13482794 st:0 invalid dropping
2025/03/20 17:02:40.855206 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294107399, next:13482794 invalid dropping st:0
2025/03/20 17:02:40.866359 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294124053, next:13499460 st:0 invalid dropping
2025/03/20 17:02:40.866379 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294124053, next:13499460 invalid dropping st:0
2025/03/20 17:02:40.887549 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294140717, next:13516126 st:0 invalid dropping
2025/03/20 17:02:40.887639 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294140717, next:13516126 invalid dropping st:0
2025/03/20 17:02:40.909010 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294157389, next:13532792 st:0 invalid dropping
2025/03/20 17:02:40.909041 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294157389, next:13532792 invalid dropping st:0
2025/03/20 17:02:40.920227 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294174044, next:13549458 st:0 invalid dropping
2025/03/20 17:02:40.920232 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294174044, next:13549458 invalid dropping st:0
2025/03/20 17:02:40.941514 [HLS] ffmpeg: capture-usb-hdmi:  DTS 927294190707, next:13566124 st:0 invalid dropping
2025/03/20 17:02:40.941517 [HLS] ffmpeg: capture-usb-hdmi:  PTS 927294190707, next:13566124 invalid dropping st:0

Here's the error I'm getting with

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

Log:

2025/03/21 08:24:06.890052 [TNR] Opened connection to M3U-USBCapture for ch9005 USB Capture
2025/03/21 08:24:06.890052 [HLS] Starting live stream for channel 9005 from 10.10.12.25
2025/03/21 08:24:07.103618 [HLS] ffmpeg: capture-camera:  [aist#0:1/pcm_s16le @ 0000020a522f7f40] Guessed Channel Layout: stereo
2025/03/21 08:24:07.104146 [HLS] ffmpeg: capture-camera:  [vost#0:0/h264_mf @ 0000020a522fab80] -enc_time_base -1 is deprecated, use -enc_timebase demux
2025/03/21 08:24:07.104146 [HLS] ffmpeg: capture-camera:  [aost#0:1/aac @ 0000020a522fec80] -enc_time_base -1 is deprecated, use -enc_timebase demux
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  [Eval @ 000000c6119fdb40] Undefined constant or missing '(' in 'prev_t))'
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  [Eval @ 000000c6119fdb40] Missing ')' or too many args in 'gt(floor(t),floor(prev_t))'
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  [vost#0:0/h264_mf @ 0000020a522fab80] Invalid force_key_frames expression 'gt(floor(t),floor(prev_t))'
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  [out#0/mpegts @ 0000020a522e37c0] Error processing forced keyframes
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  Error opening output file -.
2025/03/21 08:24:07.104655 [HLS] ffmpeg: capture-camera:  Error opening output files: Invalid argument
2025/03/21 08:24:07.134117 [ERR] Error during stream M3U-USBCapture ch9005 USB Capture: exit status 0xffffffea
2025/03/21 08:24:07.134117 [TNR] Closed connection to M3U-USBCapture for ch9005 USB Capture
2025/03/21 08:24:07.134117 [HLS] ffmpeg: ch9005-dANY-ip10.10.12.25-remux:  [in#0/mpegts @ 000001dc36887bc0] could not find codec parameters
2025/03/21 08:24:07.134117 [HLS] ffmpeg: ch9005-dANY-ip10.10.12.25-remux:  Error opening input file -.
2025/03/21 08:24:07.134117 [HLS] ffmpeg: ch9005-dANY-ip10.10.12.25-remux:  Error opening input files: End of file
2025/03/21 08:24:16.933664 [ERR] Probe failed for live stream after 10.0424215s and 0 bytes
2025/03/21 08:24:17.198732 [HLS] Couldn't generate stream playlist for ch9005-dANY-ip10.10.12.25: Couldn't find playlist: C:\-- Channels DVR\Streaming\ch9005-dANY-ip10.10.12.25-2668537006\remux\stream.m3u8: CreateFile C:\-- Channels DVR\Streaming\ch9005-dANY-ip10.10.12.25-2668537006\remux\stream.m3u8: The system cannot find the file specified.
2025/03/21 08:24:17.198732 [HLS] Stopping transcoder session ch9005-dANY-ip10.10.12.25 (out=0s finished=true first_seq=0 last_seq=-1)

HDMI Capture works fine in VLC. Any help greatly appreciated, thanks!

Update prerelease

That worked, thanks!

Ok so it randomly started working today. Then I did a bit of cable management and it stopped working again and I now have to reconnect every time I want to stream. Having the same error log as before. @tmm1

Make sure you are using a blue usb 3.0 port.

Most of those USB Capture devices even though they have a blue plug are really USB 2.0... they are fake USB 3.0.

Here is a screenshot of my card that Claims to be 3.0 and has a blue Cable....

Thanks @Rice The framefate dropped from 60 to 20fps on an i7 nuc running linux. It was in a usb 3/ lightning port when it was working at 60fps. tried a in a blue usb 3.0 and drops to 20 fps and stops working too.

I think you mean Thunderbolt.

Thanks yes I did mean that :slight_smile:

Mabey it’s a Linux limitation thing then. I accidentally plugged it into a usb2.0 on the back of my motherboard and I got 9fps max. It wouldn’t work in channels until it was back on 3.0. Ymmv

@tmm1 Any joy in stopping it from spinning after a successful stream? I thought maybe make the script disconnect from the HDMI dongle when a stream closes. Like a software version of pulling the usb out and back in

@tmm1
Is there anything you can do about these errors in the logs? I have hundreds of thousands of these lines when the capture is active making it impossible to find anything in the logs. 100-150 of these lines a second.


2025/03/24 11:27:50.801386 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804028406, next:533312 invalid dropping st:0
2025/03/24 11:27:50.802936 [HLS] ffmpeg: capture-usb-hdmi:  DTS 1252804045070, next:549978 st:0 invalid dropping
2025/03/24 11:27:50.802975 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804045070, next:549978 invalid dropping st:0
2025/03/24 11:27:50.815313 [HLS] ffmpeg: capture-usb-hdmi:  DTS 1252804061741, next:566644 st:0 invalid dropping
2025/03/24 11:27:50.815373 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804061741, next:566644 invalid dropping st:0
2025/03/24 11:27:50.836848 [HLS] ffmpeg: capture-usb-hdmi:  DTS 1252804078397, next:583310 st:0 invalid dropping
2025/03/24 11:27:50.836856 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804078397, next:583310 invalid dropping st:0
2025/03/24 11:27:50.858475 [HLS] ffmpeg: capture-usb-hdmi:  DTS 1252804095061, next:599976 st:0 invalid dropping
2025/03/24 11:27:50.858509 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804095061, next:599976 invalid dropping st:0
2025/03/24 11:27:50.880197 [HLS] ffmpeg: capture-usb-hdmi:  DTS 1252804111730, next:616642 st:0 invalid dropping
2025/03/24 11:27:50.880230 [HLS] ffmpeg: capture-usb-hdmi:  PTS 1252804111730, next:616642 invalid dropping st:0

Thank you!!

Thank you again for getting this to work on Linux. The only issue I am facing now is an audio video syncing issue. Is there anything that can be done to improve it? It's not horrendous but noticeable :slight_smile: Thank you again for your hard work.

Hi @tmm1 I found this about ffmpeg. Might this help my syncing issues?

  1. Correct FFmpeg Sync Audio to Video That is Too Fast or Slow
    You can easily do this by using the -async parameter of FFmpeg, which, as per the documentation "Stretches/squeezes" enables the sound stream to match the timestamps. The parameter takes a numeric value for the samples per second to fix the issue.

ffmpeg -async 25 -i input.mpg -r 25

Attempt gradually expanding the - async value until the sound and video are in sync.

Many thanks

Still scratching my head at this - @tmm1 are you running your mac DVR manually? It's just so odd that yours worked straight away on post 1, and everyone else has the same issue as the quoted post.