• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    My problem is to add codec to my webrtc

    Opera GX
    2
    6
    279
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BOSSXXXL
      BOSSXXXL last edited by

      hello guys im coding a new webrtc while the codec function works fine in chrome edge brave browsers it picks opus and H246 If i try opera gx it pick rtx and AUDIO G722

      
      function forceH264Codec(sdp) {
          const lines = sdp.split('\r\n');
          let mLineIndex = -1;
          for (let i = 0; i < lines.length; i++) {
              if (lines[i].startsWith('m=video')) {
                  mLineIndex = i;
                  break;
              }
          }
      
          if (mLineIndex === -1) {
              console.warn("No 'm=video' line found in SDP, cannot force H264");
              return sdp;
          }
      
          const h264PayloadTypes = lines
              .filter(line => line.startsWith('a=rtpmap') && line.includes('H264'))
              .map(line => line.split(':')[1].split(' ')[0]);
      
          if (h264PayloadTypes.length === 0) {
              console.warn("No H264 payload types found in SDP, cannot force H264");
              return sdp;
          }
      
          const originalMLine = lines[mLineIndex];
          const mLineParts = originalMLine.split(' ');
          let preferredMLine = mLineParts.slice(0, 3); // 'm=video', port, protocol
          preferredMLine.push(...h264PayloadTypes); // Add H264 payload types first
      
          // Add back other non-H264 payload types if any were present (though usually not needed when forcing H264)
          const existingPayloadTypes = new Set(mLineParts.slice(3));
          const otherPayloadTypes = [...existingPayloadTypes].filter(pt => !h264PayloadTypes.includes(pt)); // Ensure no duplicates
          preferredMLine.push(...otherPayloadTypes);
      
      
          lines[mLineIndex] = preferredMLine.join(' ');
          return lines.join('\r\n');
      }
      
      
       Stats: 
      {codec: {…}, packetsLost: 0, packetsReceived: 0, lossRate: '0%', bytesReceived: '0.00 MB', …}
      bytesReceived: "0.00 MB"
      codec: {mimeType: 'video/rtx', payloadType: 99, clockRate: 90000, channels: undefined}
      currentBitrate: "0 kbps"
      frameHeight: undefined
      frameWidth: undefined
      framesDropped: 0
      framesPerSecond: 0
      framesReceived: 0
      lossRate: "0%"
      packetsLost: 0
      packetsReceived: 0
      [[Prototype]]: Object
      script.js:2445 Increasing bitrate to 3300 kbps
      script.js:2554 Audio Stats: 
      {codec: {…}, packetsLost: 0, packetsReceived: 0, lossRate: '0%', bytesReceived: '0.00 MB', …}
      audioLevel: undefined
      bytesReceived: "0.00 MB"
      codec: {mimeType: 'audio/G722', payloadType: 9, clockRate: 8000, channels: 1}
      jitter: "0 ms"
      lossRate: "0%"
      packetsLost: 0
      packetsReceived: 0
      totalSamplesDuration: 0
      [[Prototype]]: Object
      
      
      Reply Quote 0
        leocg 1 Reply Last reply
      • leocg
        leocg Moderator Volunteer @BOSSXXXL last edited by

        @BOSSXXXL I don't think you can add codecs to Opera

        Reply Quote 0
          BOSSXXXL 1 Reply Last reply
        • BOSSXXXL
          BOSSXXXL @leocg last edited by

          @leocg I'm not trying to add actually the codecs are already there but the parameters are different from chrome

          Reply Quote 0
            leocg 1 Reply Last reply
          • leocg
            leocg Moderator Volunteer @BOSSXXXL last edited by

            @BOSSXXXL Maybe Opera uses different codecs?

            Reply Quote 0
              BOSSXXXL 1 Reply Last reply
            • BOSSXXXL
              BOSSXXXL @leocg last edited by

              @leocg no opera have all the codecs its like in chrome to open console you use f12 in opera different its same thing for opera they changed a lot of parameters even in codecs

              Reply Quote 0
                1 Reply Last reply
              • BOSSXXXL
                BOSSXXXL last edited by

                and opera made this feature taht makes my website handle more bandwith Disable non-proxied UDP i needed to add turn to the webrtc to solve video not being able to be processed

                Reply Quote 0
                  1 Reply Last reply
                • First post
                  Last post

                Computer browsers

                • Opera for Windows
                • Opera for Mac
                • Opera for Linux
                • Opera beta version
                • Opera USB

                Mobile browsers

                • Opera for Android
                • Opera Mini
                • Opera Touch
                • Opera for basic phones

                • Add-ons
                • Opera account
                • Wallpapers
                • Opera Ads

                • Help & support
                • Opera blogs
                • Opera forums
                • Dev.Opera

                • Security
                • Privacy
                • Cookies Policy
                • EULA
                • Terms of Service

                • About Opera
                • Press info
                • Jobs
                • Investors
                • Become a partner
                • Contact us

                Follow Opera

                • Opera - Facebook
                • Opera - Twitter
                • Opera - YouTube
                • Opera - LinkedIn
                • Opera - Instagram

                © Opera Software 1995-