|
|
@@ -24,6 +24,8 @@ function parseArgs(argv) {
|
|
|
port: 9000,
|
|
|
fps: 30,
|
|
|
quality: 80,
|
|
|
+ width: 1280,
|
|
|
+ height: 720,
|
|
|
source: null,
|
|
|
verbose: false,
|
|
|
};
|
|
|
@@ -34,6 +36,8 @@ function parseArgs(argv) {
|
|
|
else if (a === "--port") out.port = Number(argv[++i]);
|
|
|
else if (a === "--fps") out.fps = Number(argv[++i]);
|
|
|
else if (a === "--quality") out.quality = Number(argv[++i]);
|
|
|
+ else if (a === "--width") out.width = Number(argv[++i]);
|
|
|
+ else if (a === "--height") out.height = Number(argv[++i]);
|
|
|
else if (a === "--source") out.source = argv[++i];
|
|
|
else if (a === "--verbose" || a === "-v") out.verbose = true;
|
|
|
else if (a === "--help" || a === "-h") {
|
|
|
@@ -43,6 +47,8 @@ function parseArgs(argv) {
|
|
|
--port N Viewer (HTTP) and WebSocket on same port (default 9000)
|
|
|
--fps N Target framerate (default 30)
|
|
|
--quality N JPEG 1-100 (default 80)
|
|
|
+ --width N Scale output width (default 1280, 0 = source native)
|
|
|
+ --height N Scale output height (default 720, 0 = source native)
|
|
|
--source STR Override GStreamer source element chain (before ! videoconvert)
|
|
|
--verbose Extra portal + pipeline debug (also NEBUCAST_VERBOSE=1)
|
|
|
|
|
|
@@ -150,7 +156,7 @@ async function main() {
|
|
|
function broadcastFrame(frame) {
|
|
|
for (const ws of clients) {
|
|
|
if (ws.readyState !== ws.OPEN) continue;
|
|
|
- if (ws.bufferedAmount > 8 * 1024 * 1024) continue;
|
|
|
+ if (ws.bufferedAmount > 128 * 1024) continue;
|
|
|
try {
|
|
|
ws.send(frame, { binary: true });
|
|
|
} catch {
|
|
|
@@ -255,6 +261,8 @@ async function main() {
|
|
|
const pipeline = buildPipeline(pipeSource, {
|
|
|
fps: opts.fps,
|
|
|
quality: opts.quality,
|
|
|
+ width: opts.width,
|
|
|
+ height: opts.height,
|
|
|
});
|
|
|
if (opts.verbose) console.info("[gstreamer] pipeline:", pipeline);
|
|
|
const gst = startGstreamer({
|
|
|
@@ -271,6 +279,8 @@ async function main() {
|
|
|
const pipeline = buildPipeline(source, {
|
|
|
fps: opts.fps,
|
|
|
quality: opts.quality,
|
|
|
+ width: opts.width,
|
|
|
+ height: opts.height,
|
|
|
});
|
|
|
if (opts.verbose) console.info("[gstreamer] pipeline:", pipeline);
|
|
|
const gst = startGstreamer({
|