SamuelScheit / puppeteer-stream

A Library for puppeteer to retrieve audio and/or video streams
MIT License
335 stars 105 forks source link

[Bug] Wrong video size #15

Closed Aliaksandr-Kasko-JazzTeam closed 2 years ago

Aliaksandr-Kasko-JazzTeam commented 2 years ago

Even when I create browser with defined viewport (i.e. 300*600)

const width = 300;
const height = 600;

const browser = await launch({
        defaultViewport: {
          width: width,
          height: height
        },
        args: ['--no-sandbox']
      });
//...

video size of recorded video will be 1920*1080. What am I doing wrong?

KennyHarrer commented 2 years ago

Hello Aliaksandr! Try adding '--window-size=1920,1080', '--start-fullscreen' to your args.

Aliaksandr-Kasko-JazzTeam commented 2 years ago

Hi, @KennyHarrer. No, it doesn't matter. Even when I set args: ['--no-sandbox', `--window-size=${width},${height}`, '--start-fullscreen'] or without '--start-fullscreen'. All the same. Video size is 1920x1080. I need it to be 300x600 in this case

KennyHarrer commented 2 years ago

Have you tried setting the page view port? page.setViewport({width:300,height:600})

Aliaksandr-Kasko-JazzTeam commented 2 years ago

Yes, I tried this. And it has no effect.

StuartGooding commented 2 years ago

I believe that the background extension that is invoking the chrome.tabCapture.capture needs to allow for videoConstraints to be passed through to override the minWidth, maxWidth, minHeight and maxHeight of the video. I've found this can allow for the output video size to match your expected resolution.

SamuelScheit commented 2 years ago

resolved with #32