Merge pull request #35 from ibanezbass/master

Add Intel & AMD GPU Encoding
This commit is contained in:
DevL0rd 2020-05-11 14:57:56 -06:00 committed by GitHub
commit 01c4a944ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 24 deletions

View file

View file

@ -71,11 +71,17 @@ function startVideoProcess() {
fps = 30; fps = 30;
} }
var ffmpegVideoArgs = []; var ffmpegVideoArgs = [];
if (encoding == "NVENC") { if (encoding == "NVENC") { //Nvidia Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-c:v", "h264_nvenc", "-gpu", "0", "-rc", "cbr_ld_hq", "-zerolatency", "1", "-f", "h264", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-cq:v", "19", "-g", "999999", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"]; ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-c:v", "h264_nvenc", "-gpu", "0", "-rc", "cbr_ld_hq", "-zerolatency", "1", "-f", "h264", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-cq:v", "19", "-g", "999999", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using Nvidia Encoding"); console.log("Using Nvidia Encoding");
} else { } else if(encoding == "AMDVCE"){ //AMD Video Coding Engine
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-vf", "scale=1280x720", "-preset", "ultrafast", "-tune", "zerolatency", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-x264-params", 'nal-hrd=cbr', "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / 2) + "M", "tcp://" + ip + ":2222"]; ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_amf", "-usage", "1", "-rc", "cbr", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using AMD Video Coding Engine");
} else if(encoding == "QSV"){
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-c:v", "h264_qsv", "-preset", "faster", "-profile", "baseline", "-vf", "scale=1280x720", "-pix_fmt", "yuv420p", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / (fps / 4)) + "M", "tcp://" + ip + ":2222"];
console.log("Using Intel QSV Encoding");
} else { //CPU Software Encoding
ffmpegVideoArgs = ["-probesize", "50M", "-hwaccel", "auto", "-f", "gdigrab", "-framerate", fps, "-video_size", screenWidth + "x" + screenHeight, "-offset_x", "0", "-offset_y", "0", "-draw_mouse", "1", "-i", "desktop", "-f", "h264", "-vf", "scale=1280x720", "-preset", "ultrafast", "-tune", "zerolatency", "-pix_fmt", "yuv420p", "-profile:v", "baseline", "-x264-params", "nal-hrd=cbr", "-b:v", quality + "M", "-minrate", quality - 3 + "M", "-maxrate", quality + "M", "-bufsize", (quality / 2) + "M", "tcp://" + ip + ":2222"];
console.log("Using CPU Encoding"); console.log("Using CPU Encoding");
} }
ffmpegProcess = spawn( ffmpegProcess = spawn(

View file

@ -269,9 +269,9 @@
} }
}, },
"mkdirp-classic": { "mkdirp-classic": {
"version": "0.5.2", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.2.tgz", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-ejdnDQcR75gwknmMw/tx02AuRs8jCtqFoFqDZMjiNxsu85sRIJVXDKHuLYvUUPRBUtV2FpSZa9bL1BUa3BdR2g==" "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
}, },
"nan": { "nan": {
"version": "2.14.0", "version": "2.14.0",

View file

@ -56,6 +56,8 @@
<div class="dropdown-menu" aria-labelledby="encodingDrop"> <div class="dropdown-menu" aria-labelledby="encodingDrop">
<a class="dropdown-item" href="javascript:setEncoding('CPU')">CPU</a> <a class="dropdown-item" href="javascript:setEncoding('CPU')">CPU</a>
<a class="dropdown-item" href="javascript:setEncoding('NVENC')">Nvidia Encoding</a> <a class="dropdown-item" href="javascript:setEncoding('NVENC')">Nvidia Encoding</a>
<a class="dropdown-item" href="javascript:setEncoding('AMDVCE')">AMD Video Coding Engine</a>
<a class="dropdown-item" href="javascript:setEncoding('QSV')">Intel QuickSync</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -92,6 +92,10 @@ function applyClientSettings() {
$("#ipInput").val(clientSettings.ip); $("#ipInput").val(clientSettings.ip);
if (clientSettings.encoding == "NVENC") { if (clientSettings.encoding == "NVENC") {
$("#encodingDrop").html("Encoding (Nvidia)"); $("#encodingDrop").html("Encoding (Nvidia)");
} else if(clientSettings.encoding == "AMDVCE"){
$("#encodingDrop").html("Encoding (AMD)")
} else if(clientSettings.encoding == "QSV"){
$("#encodingDrop").html("Encoding (Intel)");
} else { } else {
$("#encodingDrop").html("Encoding (CPU)"); $("#encodingDrop").html("Encoding (CPU)");
clientSettings.encoding = "CPU"; clientSettings.encoding = "CPU";

View file

@ -138,9 +138,9 @@ function startStreamer(arg) {
if (arg.abxySwap) { if (arg.abxySwap) {
args.push("/abxySwap"); args.push("/abxySwap");
} }
if (arg.encoding == "NVENC") { if (arg.encoding == "NVENC" || arg.encoding == "AMDVCE" || arg.encoding == "QSV") {
args.push("/e"); args.push("/e");
args.push("NVENC"); args.push(arg.encoding);
} }
if (arg.limitFPS) { if (arg.limitFPS) {
args.push("/limitFPS"); args.push("/limitFPS");

View file

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@electron/get": { "@electron/get": {
"version": "1.10.0", "version": "1.12.2",
"resolved": "https://registry.npmjs.org/@electron/get/-/get-1.10.0.tgz", "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.12.2.tgz",
"integrity": "sha512-hlueNXU51c3CwQjBw/i5fwt+VfQgSQVUTdicpCHkhEjNZaa4CXJ5W1GaxSwtLE2dvRmAHjpIjUMHTqJ53uojfg==", "integrity": "sha512-vAuHUbfvBQpYTJ5wB7uVIDq5c/Ry0fiTBMs7lnEYAo/qXXppIVcWdfBr57u6eRnKdVso7KSiH6p/LbQAG6Izrg==",
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
"env-paths": "^2.2.0", "env-paths": "^2.2.0",
@ -34,9 +34,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "12.12.35", "version": "12.12.38",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.35.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.38.tgz",
"integrity": "sha512-ASYsaKecA7TUsDrqIGPNk3JeEox0z/0XR/WsJJ8BIX/9+SkMSImQXKWfU/yBrSyc7ZSE/NPqLu36Nur0miCFfQ==" "integrity": "sha512-75eLjX0pFuTcUXnnWmALMzzkYorjND0ezNEycaKesbUBg9eGZp4GHPuDmkRc4mQQvIpe29zrzATNRA6hkYqwmA=="
}, },
"ansi_up": { "ansi_up": {
"version": "4.0.4", "version": "4.0.4",
@ -71,7 +71,8 @@
"boolean": { "boolean": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.1.tgz", "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.1.tgz",
"integrity": "sha512-HRZPIjPcbwAVQvOTxR4YE3o8Xs98NqbbL1iEZDCz7CL8ql0Lt5iOyJFxfnAB0oFs8Oh02F/lLlg30Mexv46LjA==" "integrity": "sha512-HRZPIjPcbwAVQvOTxR4YE3o8Xs98NqbbL1iEZDCz7CL8ql0Lt5iOyJFxfnAB0oFs8Oh02F/lLlg30Mexv46LjA==",
"optional": true
}, },
"bootstrap": { "bootstrap": {
"version": "4.4.1", "version": "4.4.1",
@ -199,9 +200,9 @@
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI="
}, },
"electron": { "electron": {
"version": "8.2.2", "version": "8.2.5",
"resolved": "https://registry.npmjs.org/electron/-/electron-8.2.2.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-8.2.5.tgz",
"integrity": "sha512-GH4RCbpuzEn3XpTmsf+wLaJ2KOPSOoBJvQ0s6ftTLs5+IQEgKZvkdYCj8TCBNXFhss31RT3BUqoEQQUyZErK0A==", "integrity": "sha512-LxSCUwmlfJtRwthd3ofpYaZ+1C2hQSW8Ep1DD9K3VbnDItO+kb3t1z35daJgAab78j54aOwo9gMxJtvU0Ftj6w==",
"requires": { "requires": {
"@electron/get": "^1.0.1", "@electron/get": "^1.0.1",
"@types/node": "^12.0.12", "@types/node": "^12.0.12",
@ -370,9 +371,9 @@
} }
}, },
"graceful-fs": { "graceful-fs": {
"version": "4.2.3", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==" "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
}, },
"http-cache-semantics": { "http-cache-semantics": {
"version": "4.1.0", "version": "4.1.0",
@ -396,9 +397,9 @@
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
}, },
"jquery": { "jquery": {
"version": "3.5.0", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.0.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz",
"integrity": "sha512-Xb7SVYMvygPxbFMpTFQiHh1J7HClEaThguL15N/Gg37Lri/qKyhRGZYzHRyLH8Stq3Aow0LsHO2O2ci86fCrNQ==" "integrity": "sha512-XwIBPqcMn57FxfT+Go5pzySnm4KWkT1Tv7gjrpT1srtf8Weynl6R273VJ5GjkRb51IzMp5nbaPjJXMWeju2MKg=="
}, },
"json-buffer": { "json-buffer": {
"version": "3.0.0", "version": "3.0.0",