Is there a way to increase the bitrate for recording video from a 3D window?
The image on the saved file is very unstable and sometimes produces pixels at high file resolutions.
This is my current screen record script.
function runCode(app, puzzles) {
const type = v3d.Detector.checkIOS() ? ‘video/mp4’ : ‘video/webm;codecs=avc1’
const stream = app.renderer.domElement.captureStream()
const recorder = new MediaRecorder(stream, { mimeType: type })
recorder.addEventListener(‘dataavailable’, function (e) {
const link = document.createElement(‘a’)
link.href = URL.createObjectURL(e.data)
link.download = ‘video.webm’
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
link.remove()
})
const recordBtn = parent.document.getElementById(‘recordBtn’)
recordBtn.addEventListener(‘click’, function () {
if (recorder.state == ‘inactive’) {
setScreenScale(1)
setTimeout(function () {
recorder.start()
}, 100)
recordBtn.classList.add(‘stopped’)
} else if (recorder.state != ‘inactive’) {
recorder.stop()
recordBtn.classList.remove(‘stopped’)
}
})
function setScreenScale(factor) {
app.renderer.setPixelRatio(factor)
if (app.postprocessing) app.postprocessing.composer.setPixelRatio(factor)
app.onResize()
}
}