RTCMultiConnection icon indicating copy to clipboard operation
RTCMultiConnection copied to clipboard

Improve Quality

Open marcoheine opened this issue 4 years ago • 1 comments

Hi!

I want to stream from mobile Devices. The quality from my iPhone is very good (LTE), but with Android phones (also LTE, more than 5 mb/s upload) it is very very bad.

My settings? Which options do I have to improve the quality?

 var bitrates = 512;
        var resolutions = 'Ultra-HD';
        var videoConstraints = {};

        if (resolutions == 'HD') {
            videoConstraints = {
                width: {
                    ideal: 1280
                },
                height: {
                    ideal: 720
                },
                frameRate: 30,
                facingMode: 'application'
            };
        }

        if (resolutions == 'Ultra-HD') {
            videoConstraints = {
                width: {
                    ideal: 1920
                },
                height: {
                    ideal: 1080
                },
                frameRate: 30,
                facingMode: 'application'
            };
        }

        videoConstraints.facingMode = 'environment';

        console.log(videoConstraints);

        connection.mediaConstraints = {
            video: videoConstraints,
            audio: true
        };

        var CodecsHandler = connection.CodecsHandler;

        connection.processSdp = function(sdp) {
            var codecs = 'vp8';

            if (codecs.length) {
                sdp = CodecsHandler.preferCodec(sdp, codecs.toLowerCase());
            }

            if (resolutions == 'HD') {
                sdp = CodecsHandler.setApplicationSpecificBandwidth(sdp, {
                    audio: 128,
                    video: bitrates,
                    screen: bitrates
                });

                sdp = CodecsHandler.setVideoBitrates(sdp, {
                    min: bitrates * 8 * 1024,
                    max: bitrates * 8 * 1024,
                });
            }

            if (resolutions == 'Ultra-HD') {
                sdp = CodecsHandler.setApplicationSpecificBandwidth(sdp, {
                    audio: 128,
                    video: bitrates,
                    screen: bitrates
                });

                sdp = CodecsHandler.setVideoBitrates(sdp, {
                    min: bitrates * 8 * 1024,
                    max: bitrates * 8 * 1024,
                });
            }

            return sdp;
        };

Thanks!

marcoheine avatar Feb 17 '21 12:02 marcoheine

If you use Firefox on mobile devices, it could look better. Otherwise you can try to increase the bitrate.

Patrick-Vogt avatar Feb 28 '21 13:02 Patrick-Vogt