Skip to content

Unable to increase video quality #162

@theorchids

Description

@theorchids

Can someone help me with it, video quality is very low & file size is low (< 250 kb)
Here is my code

  const file = fs.createWriteStream(`./videos/vid-${new Date().getMilliseconds()}.webm`);
  const browser = await launch({
    executablePath: "C:/Program Files/Google/Chrome/Application/chrome.exe",
    args: ["--autoplay-policy=no-user-gesture-required"],
    defaultViewport: {
      width: 1536,
      height: 703,
    },
    headless: "new",
  });

  const page = await browser.newPage();
  await page.goto("http://localhost:3000?capture=true");
  const stream = await getStream(page, {
    audio: true,
    video: true,
    // bitsPerSecond: 100000000,
    videoConstraints: {
      mandatory: {
        width: 1536,
        height: 703,
        frameRate: 60,
        facingMode: "environment",
        advanced: [{ width: 1920, height: 1280 }, { aspectRatio: 1.333 }],
      },
    },
  });
  const element = await page.waitForSelector(".playBtn");

  element?.click();
  stream.pipe(file);
  setTimeout(async () => {
    await stream.destroy();
    file.close();
    console.log("finished");

    await browser.close();
    (await wss).close();
  }, 1000 * 10);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions