tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Could not start video recording. Please check your camera.

Open isorropisths opened this issue 11 months ago • 7 comments

Steps to reproduce

  1. Hold the camera icon

Expected behaviour

Video message should start recording

Actual behaviour

The blurry bubble appears, and after a few seconds i get "Could not start video recording. Please check your camera." After it disappears, the LED on my webcam blinks, as it was about to start but the timeout was short.

Same thing happens in Settings, camera gets recognized (UVC Camera) and after it blinks once, I then I can see the feed fine. If I then quickly close the settings panel and click the camera button while the camera LED is still on, the video message recording starts fine. As soon as I finish video recording and I let the LED go off, the video message has the same error, and I need to perform the workaround again.

Other applications using the webcam don't take this long to initialize the webcam, and hence don't timeout.

NOTE: When testing the webcam in settings, it appears as 4:3 zoomed. If I then change the Input device (Either 'Default' or 'UVC Camera'), it uses the camera's full resolution (720p 16:9).

Happens in both static binary & Flatpak.

Operating system

Fedora 43

Version of Telegram Desktop

6.3.6

Installation source

Static binary from official website

Crash ID

No response

Logs

No relevant logs are generated when attempting to record a video message.

isorropisths avatar Dec 14 '25 10:12 isorropisths

@isorropisths I wonder what timeout should I put there.

john-preston avatar Dec 14 '25 11:12 john-preston

I have the same issue with USB web camera, however I don't even get video feed in settings. USB web camera (Lenovo 510) is IR capable and supports Windows Hello authentication.

Image

"Lenovo 510 I" is not selectable, only "Default" and "Lenovo 510 R" can be selected. I assume when "Lenovo 510 I" is selected, Telegram tries to start video feed in settings, camera does not like it and disappears.

All other applications work with webcamera fine. Telegram 6.3.6, Linux Debian 13, Gnome 48, Wayland, telegram installed from .tar.gz.

tvardero avatar Dec 14 '25 18:12 tvardero

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

github-actions[bot] avatar Jun 13 '26 02:06 github-actions[bot]

This is still happening and still very annoying.

isorropisths avatar Jun 13 '26 08:06 isorropisths

Still happening with external camera that supports Windows Hello.

Edit: I have switched from Debian 13 to Fedora 44, and from Gnome to KDE. Still present.

tvardero avatar Jun 16 '26 20:06 tvardero

Just for the record, version 6.9.3, Fedora 44, since this ticket was opened 7 months ago and things have updated, but this bug is still present.

isorropisths avatar Jun 16 '26 20:06 isorropisths

Here's what my debugging with claude resulted in:

Root cause, with syscall evidence (Telegram Desktop 7.2.9 static binary, Debian 13, kernel 7.1.8, Razer Kiyo X, uvcvideo):

The 5 s kInitTimeout in round_video_recorder.cpp expires before the camera capturer has even finished enumerating capabilities. strace -P /dev/video0 on the thread that creates the VideoCameraCapturer during a failing attempt:

21:29:36.658  openat("/dev/video0", O_RDONLY) = 88
21:29:36.658  ioctl(88, VIDIOC_TRY_FMT, {128x96 MJPG})   <0.042>
      ... 195 x VIDIOC_TRY_FMT, 40-126 ms each, 8.28 s total ...
21:29:44.898  ioctl(88, VIDIOC_TRY_FMT, ...)
21:29:44.940  openat("/dev/video0", O_RDWR|O_NONBLOCK) = 74
21:29:44.940  ioctl(74, VIDIOC_S_FMT, {1280x720 MJPG}) = 0
21:29:44.982  ioctl(74, VIDIOC_S_PARM, {1/30}) = 0
21:29:45.023  ioctl(74, VIDIOC_REQBUFS/QUERYBUF/QBUF x4)
21:29:45.024  ioctl(74, VIDIOC_STREAMON) = 0          <- LED turns on
21:29:45.257  ioctl(74, VIDIOC_STREAMOFF) = 0         <- recorder already failed at ~21:29:41.6

So: webrtc::DeviceInfoV4l2::FillCapabilities (tg_owt) probes 14 sizes x 7 pixel formats with VIDIOC_TRY_FMT. On UVC cameras every TRY_FMT is a real USB PROBE round-trip (uvcvideo uvc_probe_video: SET_CUR + GET_CUR). On this camera each one takes ~42 ms, measured independently of Telegram (python fcntl.ioctl loop: 41-43 ms for every format/size). 195 probes = 8.3 s. The capture itself starts fine ~40 ms after enumeration ends, which is the LED blink everyone sees, but by then the recorder already fired Error::VideoTimeout.

That also explains the Settings workaround: the preview has no timeout, so it appears after ~8 s, and while its capturer is alive Calls::Instance::getVideoCapture() hands the recorder the same already-streaming capturer, so _firstVideoFrameTime is set immediately.

Other apps are fast because they don't brute-force TRY_FMT: ffmpeg does one S_FMT (first frame in 0.46 s here), Chrome uses VIDIOC_ENUM_FMT / ENUM_FRAMESIZES / ENUM_FRAMEINTERVALS, which are answered from cached descriptors and take microseconds.

Suggested fixes, in order of preference:

  1. In tg_owt DeviceInfoV4l2::FillCapabilities, enumerate via VIDIOC_ENUM_FMT + VIDIOC_ENUM_FRAMESIZES (+ ENUM_FRAMEINTERVALS) instead of TRY_FMT brute force, falling back to TRY_FMT only when ENUM_FRAMESIZES is unsupported. This makes capturer creation ~instant.
  2. Or cache the capability map per device id for the process lifetime, so only the first capturer creation pays the 8 s.
  3. As a stopgap, start kInitTimeout only after the capturer reports a resolution (i.e. after StartCapture returned), or raise it to ~15 s. Raising the number alone is fragile: the cost scales with how many formats the camera reports and how slow its firmware answers PROBE.

I can't be sure it's correct, but it's all I have, hope it helps

domo-kun-ru avatar Sep 17 '26 18:09 domo-kun-ru