胡斌

add -h and -w to input width and heigh

正在显示 1 个修改的文件 包含 11 行增加1 行删除
@@ -65,6 +65,14 @@ if(!argv.f){//framerate @@ -65,6 +65,14 @@ if(!argv.f){//framerate
65 argv.f = "20"; 65 argv.f = "20";
66 } 66 }
67 67
  68 +if(!argv.w){//width
  69 + argv.w = "800";
  70 +}
  71 +
  72 +if(!argv.h){//width
  73 + argv.h = "600";
  74 +}
  75 +
68 function startFFmpeg(videosize) { 76 function startFFmpeg(videosize) {
69 const args = ['-y','-f', 'rawvideo', '-pix_fmt', 'bgra', '-s' ]; 77 const args = ['-y','-f', 'rawvideo', '-pix_fmt', 'bgra', '-s' ];
70 78
@@ -93,6 +101,8 @@ app.disableHardwareAcceleration() @@ -93,6 +101,8 @@ app.disableHardwareAcceleration()
93 let win 101 let win
94 app.once('ready', () => { 102 app.once('ready', () => {
95 win = new BrowserWindow({ 103 win = new BrowserWindow({
  104 + width:argv.w,
  105 + height:argv.h,
96 webPreferences: { 106 webPreferences: {
97 offscreen: true 107 offscreen: true
98 } 108 }
@@ -119,7 +129,7 @@ win.webContents.executeJavaScript('const ipcToMain = require("electron").ipcRend @@ -119,7 +129,7 @@ win.webContents.executeJavaScript('const ipcToMain = require("electron").ipcRend
119 streamIn = null; 129 streamIn = null;
120 } 130 }
121 console.log("done") 131 console.log("done")
122 - if(elapsed > duration + 5000){//delay 5s after closing pipe ,then close 132 + if(elapsed > duration + 5000){//delay 5s after closingSgit l pipe ,then close
123 win.webContents.executeJavaScript('require("electron").ipcRenderer.send("close-main-window")'); 133 win.webContents.executeJavaScript('require("electron").ipcRenderer.send("close-main-window")');
124 } 134 }
125 } 135 }