gpt4 book ai didi

javascript - 改变质量的 webRTC

转载 作者:太空狗 更新时间:2023-10-29 13:30:36 25 4
gpt4 key购买 nike

这个问题不是问resolutions和 frameRates on getUserMedia()

它是关于如何在使用getUSerMedia()时降低/提高视频中一帧的质量。

在这里Demo使用 getUserMedia()。

如何改变视频的质量? //请 fiddle 回答。

代码:

var video_constraints = {mandatory: {
maxWidth: 320,
maxHeight: 240,
maxAspectRatio:4/3,
maxFrameRate:1
},
optional: [ ]
};

var constraints = {audio: true, video: video_constraints };
navigator.getUserMedia(constraints, successCallback, errorCallback);

最佳答案

如果不是分辨率或帧速率,我假设您是在谈论比特率或相机设置(白平衡、曝光、对比度等)。

getUserMedia 提供的视频流应该以相机硬件可用的最高质量为您提供未压缩的视频。无法调整相机设置;它们是全自动的,由相机驱动程序和/或操作系统控制。如果你想调整图像,你可以用 Canvas 处理它,使用 2d 或 webgl 上下文。有multiple libraries可以帮助您。

至于比特率,只有当您通过对等连接传输视频时,这才会成为一个问题。这也是自适应和自动完成的。

Regardless of the quality and size of provided media streams, the network stack implements its own flow and congestion control algorithms: every connection starts by streaming audio and video at a low bitrate (<500 Kbps) and then begins to adjust the quality of the streams to match the available bandwidth.

来源: High Performance Browser Networking

关于javascript - 改变质量的 webRTC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24227705/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com