Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <!--
- NOTE: FIXED VERSION!
- PLEASE DO NOT USE https://pastebin.com/YcR3dGYh AS THE LOOKUP TABLE CONTAINED WRONG VALUES FOR LEVEL 1, 2, 3, 4, 5 and 6!
- https://datatracker.ietf.org/doc/html/rfc6184
- Description
- This quick and dirty tool identifies the level_idc and does a lookup for you.
- Author
- DaveLawang, https://community.cisco.com/, July 2023
- https://community.cisco.com/t5/telepresence-and-video-infrastructure/cms-what-causes-the-bad-presentation-quality-example-attached/m-p/4893159
- How to use
- 1) Fire up your browser
- 2) Start your WebRTC session
- 3) Open another tab and enter edge://webrtc-internals or chrome://webrtc-internals (Firefox: about:webrtc)
- 4) Ctrl + F -> search for "profile-level-id"
- 5) Copy value and insert it here
- Sidenote:
- You can copy & paste this whole code here to run it in the browser:
- https://www.w3schools.com/html/tryit.asp?filename=tryhtml_intro
- -->
- <style>
- table, th, td {
- border: 0px;
- }
- #screenresolution, #userInput {
- border: 2px solid red;
- border-radius: 4px;
- background-color: #ff3;
- height: 35px;
- width: 450px;
- color: #f00;
- }
- .boldresult {
- font-size: 1.2em;
- font-weight: bold;
- font-family: sans-serif;
- text-align: center;
- }
- .button {}
- </style>
- </head>
- <body onload="checkScreenresolution();">
- <h1>Quick WebRTC Video Quality Checker</h1>
- <p>
- <h2>Description</h2>
- You experience bad video quality in an online meeting?<br />Blurred image, low resolution, lags, macroblocking? This quick and dirty tool identifies what maximum resolution/bitrate your browser has picked for the meeting.<br /> This tool identifies the level_idc (<a href="https://datatracker.ietf.org/doc/html/rfc6184
- " target="_blank">RFC6184</a>) and does a lookup for you.<br />
- <br />
- <h1>How to use</h2>
- <ol>
- <li>Fire up your browser</li>
- <li>Start your WebRTC session</li>
- <li>Open another tab and enter <span style="color: #f00;">edge://webrtc-internals</span> or <span style="color: #f00;">chrome://webrtc-internals</span> (Firefox: about:webrtc)</li>
- <li>Ctrl + F -> search for "<span style="color: #f00;">profile-level-id</span>" <span style="color: #3b3;">//Make sure you have picked the right video stream</span></li>
- <li>Copy value and insert it here</li>
- </ol>
- </p>
- <table>
- <tr>
- <td>Current screen resolution:</td>
- <td id="screenresolution" class="boldresult"></td>
- </tr>
- <tr>
- <td>profile-level-id:</td>
- <td><input type="text" id="userInput" placeholder="Insert profile-level-id value here (XXXXXX)..." ></td>
- </tr>
- </tr>
- <tr>
- <td></td>
- <td style="text-align: center;"><button onclick="myFunction()" id="analyze">Analyze</button></td>
- </tr>
- </table>
- <h1>What your stream was set to (Displayed after analysis)</h1>
- <div id="result" style="color: #f00;"></div>
- <div id="lookuptable"></div>
- <script>
- //Lookup array, source https://en.wikipedia.org/wiki/Advanced_Video_Coding#Levels
- var tableArr = [
- ["level_idc (rfc6184)", "Level", "Maximum decoding speed (macroblocks/s)", "Maximum frame size (macroblocks)", "Maximum video bit rate for video coding layer (VCL) (Constrained Baseline, Baseline, Extended and Main Profiles) (kbits/s)", "Examples for high resolution @ highest frame rate (maximum stored frames)"],
- ["0a", "1", "1,485", "99", "64", "176×144@15.0 (4)" ],
- ["1b", "1b", "1,485", "99", "128", "176×144@15.0 (4)" ],
- ["0b", "1.1", "3,000", "396", "192", "352×288@7.5 (2)" ],
- ["0c", "1.2", "6,000", "396", "384", "352×288@15.2 (6)" ],
- ["0d", "1.3", "11,880", "396", "768", "352×288@30.0 (6)" ],
- ["14", "2", "11,880", "396", "2,000", "352×288@30.0 (6)" ],
- ["15", "2.1", "19,800", "792", "4,000", "352×576@25.0 (6)" ],
- ["16", "2.2", "20,250", "1,620", "4,000", "720×576@12.5 (5)" ],
- ["1e", "3", "40,500", "1,620", "10,000", "720×576@25.0 (5)" ],
- ["1f", "3.1", "108,000", "3,600", "14,000", "1,280×720@30.0 (5)" ],
- ["20", "3.2", "216,000", "5,120", "20,000", "1,280×1,024@42.2 (4)" ],
- ["28", "4", "245,760", "8,192", "20,000", "2,048×1,024@30.0 (4)" ],
- ["29", "4.1", "245,760", "8,192", "50,000", "2,048×1,024@30.0 (4)" ],
- ["2a", "4.2", "522,240", "8,704", "50,000", "2,048×1,080@60.0 (4)" ],
- ["32", "5", "589,824", "22,080", "135,000", "3,672×1,536@26.7 (5)" ],
- ["33", "5.1", "983,040", "36,864", "240,000", "4,096×2,304@26.7 (5)" ],
- ["34", "5.2", "2,073,600", "36,864", "240,000", "4,096×2,304@56.3 (5)" ],
- ["3c", "6", "4,177,920", "139,264", "240,000", "8,192×4,320@30.2 (5)" ],
- ["3d", "6.1", "8,355,840", "139,264", "480,000", "8,192×4,320@60.4 (5)" ],
- ["3e", "6.2", "16,711,680", "139,264", "800,000", "8,192×4,320@120.9 (5)" ]
- ]
- function checkScreenresolution() {
- document.getElementById("screenresolution").innerHTML = screen.width + "x" + screen.height ;
- document.getElementById("userInput").focus();
- }
- var input = document.getElementById("userInput");
- input.addEventListener("keypress", function(event) {
- if (event.key === "Enter") {
- event.preventDefault();
- document.getElementById("analyze").click();
- }
- })
- function myFunction() {
- var profile_level_id = document.getElementById("userInput").value;
- profile_level_id = profile_level_id.replace(/\s+/, ""); //sanitization, remove whitespaces
- var level_idc = profile_level_id.slice(-2); //Get the level_idc according to rfc6184
- var value_found = false;
- var result = "";
- //create a Table Object
- let table = document.createElement('table');
- //iterate over every array(row) within tableArr
- var rownumber = 0;
- for (let row of tableArr) {
- //Insert a new row element into the table element
- var temprow = table.insertRow();
- temprow.style.align = "center";
- //Iterate over every index(cell) in each array(row)
- for (let cell of row) {
- //While iterating over the index(cell)
- //insert a cell into the table element
- let newCell = table.rows[table.rows.length - 1].insertCell();
- if(rownumber==0) {temprow.style.backgroundColor = "#bba"; temprow.style.fontWeight = "bold";}
- //add text to the created cell element
- if(cell == level_idc.toLowerCase()) { temprow.style.backgroundColor = "#ff0"; value_found=true; }
- newCell.textContent = cell;
- newCell.align = "center";
- rownumber++;
- }
- }
- //append the compiled table to the DOM
- document.getElementById("lookuptable").innerHTML = "";
- document.getElementById("lookuptable").appendChild(table);
- if(value_found){result="";}
- else{result="<h1>Error: Value not found in the lookup table!</h1>Make sure you haven't accidentally pasted unwanted characters. It should be a six digit, hexadecimal value.<br /><br />";}
- document.getElementById("result").innerHTML = result;
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement