riolubruh / YABDP4Nitro

Yet Another BetterDiscord Plugin for Nitro features. Unlock screensharing modes, use cross-server and gif emotes and much more!
Other
732 stars 141 forks source link

New codec? #197

Closed itsTyrion closed 2 months ago

itsTyrion commented 2 months ago

Hi, I noticed this on someone else's screenshare today. Does Discord allow H.265 for screenshare now? image The person has Nitro and, apparently, no clientmods and runs Windows. Is this something you might be able to look into? I've also noticed "Allow H265 codec" in the mobile app for some months (iOS/Android)

itsTyrion commented 2 months ago

I console-logged e.codecs in the updateVideoQuality hook and it looks like there's actually a H.265 option:

function debugShit(pfx, obj) {
    console.log(`vq-${pfx}: ${JSON.stringify(obj, null, 2)}`);
}
if(this.settings.videoCodec > 0){ // Video codecs
    BdApi.Patcher.before("YABDP4Nitro", this.videoOptionFunctions, "updateVideoQuality", (e) => {
        debugShit("all", e.codecs);
[
  {
    "type": "audio",
    "name": "opus",
    "priority": 1,
    "payloadType": 120
  },
  {
    "type": "video",
    "name": "AV1",
    "priority": 3,
    "payloadType": 101,
    "rtxPayloadType": 102,
    "encode": false,
    "decode": false
  },
  {
    "type": "video",
    "name": "H265",
    "priority": 2,
    "payloadType": 103,
    "rtxPayloadType": 104,
    "encode": false,
    "decode": false
  },
  {
    "type": "video",
    "name": "H264",
    "priority": 4,
    "payloadType": 105,
    "rtxPayloadType": 106,
    "encode": false,
    "decode": false
  },
  {
    "type": "video",
    "name": "VP8",
    "priority": 1,
    "payloadType": 107,
    "rtxPayloadType": 108,
    "encode": true,
    "decode": true
  },
  {
    "type": "video",
    "name": "VP9",
    "priority": 5,
    "payloadType": 109,
    "rtxPayloadType": 110,
    "encode": true,
    "decode": true
  }
]
riolubruh commented 2 months ago

Discord has been working on H265 for a long time it seems. Did they finally release the codec without any fanfare...?

itsTyrion commented 2 months ago

Maybe? The mobile app had a setting for allowing to view H265 streams for like... 3/4 of a year?

I saw the screen share switch to H264 later after more people joined and I think it went back later? Which would match the behavior on adapting to the client with the worst connection.

Unrelated: in the plug-in settings, the codec dropdown/list is cut off for me, idk if that's new.