puppeteer-stream icon indicating copy to clipboard operation
puppeteer-stream copied to clipboard

[Question] How can you specify the quality of video?

Open antoniott15 opened this issue 2 years ago • 2 comments

are the options

	audioBitsPerSecond
	videoBitsPerSecond
	bitsPerSecond
	frameSize

the things that manage video quality? what do I need to choose if I want 4k or 1080p? also, does frame size specify the frame rate? like 60fps?

antoniott15 avatar Aug 31 '22 17:08 antoniott15

These options are quality options for encoding: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder To change the resolution pass the videoConstraints option

videoConstraints: {
        mandatory: {
            minWidth: 1920,
            minHeight: 1080,
            minFrameRate: 60
        }
    }

and change the page viewport:

await page.setViewport({
    width: 1920,
    height: 1080
})

SamuelScheit avatar Sep 01 '22 06:09 SamuelScheit

I'm on version 2.1.1 of puppeteer-stream, and I don't see an option called videoConstraints, where should I put it?

antoniott15 avatar Sep 01 '22 15:09 antoniott15

you can specify them for audio/video in the getStream options:

getStream(page, {
    video: {
        mandatory: {
            minWidth: 1920,
            minHeight: 1080,
            minFrameRate: 60
        }
    }
})

SamuelScheit avatar Mar 06 '23 01:03 SamuelScheit