我们正在使用Electron框架开发Windows应用程序。此应用程序旨在显示来自USB摄像机的视频流。我们正在使用“ navigator.mediaDevices” API来访问USB视频流。问题是电子应用程序无法在4K USB视频分辨率下工作并引发错误。
我们能够看到视频流进入Electron应用程序,但仅适用于较低的分辨率,例如480p,因此质量达不到标准。 USB相机可以支持4K分辨率。但是,当我们提供更高的分辨率时,它可以工作到720p,但超出此范围,它会给出“ OverconstrainedError”。 (下面的代码段用于refn)
navigator.mediaDevices.getUserMedia({
video:
{
width: {
exact: usbWidth // works till 1280
},
height: {
exact: usbHeight // works till 720
},
deviceId: {
exact: deviceid
},
}
}).then(function (stream) {
stream.getTracks().forEach(function(track) {
console.log(track.getSettings());
})
我的问题是:
在Chromium之上构建的Electron是否对USB视频分辨率有任何限制?
Electron应用程序中是否可以支持4K USB视频分辨率?
是否存在参考代码,可以向我们指出正确的方向?
这是FFMPEG命令的响应:-
ffmpeg version N-94112-gbb11584924 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190621
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 29.100 / 56. 29.100
libavcodec 58. 53.100 / 58. 53.100
libavformat 58. 28.100 / 58. 28.100
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 55.100 / 7. 55.100
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[dshow @ 0000016c508c8dc0] DirectShow video device options (from video devices)
[dshow @ 0000016c508c8dc0] Pin "Capture" (alternative pin name "0")
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1920x1080 fps=30 max s=1920x1080 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1920x1080 fps=30 max s=1920x1080 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x720 fps=30 max s=1280x720 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x720 fps=30 max s=1280x720 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=640x360 fps=30 max s=640x360 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=640x360 fps=30 max s=640x360 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x960 fps=30 max s=1280x960 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x960 fps=30 max s=1280x960 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1024x768 fps=30 max s=1024x768 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1024x768 fps=30 max s=1024x768 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=640x480 fps=30 max s=640x480 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=640x480 fps=30 max s=640x480 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x1024 fps=30 max s=1280x1024 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x1024 fps=30 max s=1280x1024 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x800 fps=30 max s=1280x800 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=h264 min s=1280x800 fps=30 max s=1280x800 fps=60.0002
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1920x1080 fps=15 max s=1920x1080 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1920x1080 fps=15 max s=1920x1080 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x720 fps=15 max s=1280x720 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x720 fps=15 max s=1280x720 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=640x360 fps=15 max s=640x360 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=640x360 fps=15 max s=640x360 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x960 fps=15 max s=1280x960 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x960 fps=15 max s=1280x960 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1024x768 fps=15 max s=1024x768 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1024x768 fps=15 max s=1024x768 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=640x480 fps=15 max s=640x480 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=640x480 fps=15 max s=640x480 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x1024 fps=15 max s=1280x1024 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x1024 fps=15 max s=1280x1024 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x800 fps=15 max s=1280x800 fps=30
[dshow @ 0000016c508c8dc0] vcodec=mjpeg min s=1280x800 fps=15 max s=1280x800 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=640x480 fps=15 max s=640x480 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=640x480 fps=15 max s=640x480 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=640x360 fps=15 max s=640x360 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=640x360 fps=15 max s=640x360 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=320x240 fps=15 max s=320x240 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=320x240 fps=15 max s=320x240 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=320x180 fps=15 max s=320x180 fps=30
[dshow @ 0000016c508c8dc0] pixel_format=yuyv422 min s=320x180 fps=15 max s=320x180 fps=30