@@ -72,15 +72,15 @@ export class VideoRecorder extends Script {
7272 }
7373 }
7474
75- getResolutionDimensions ( ) {
75+ getVideoSettings ( ) {
7676 switch ( this . resolution ) {
7777 case Resolution . FULLHD :
78- return { width : 1920 , height : 1080 } ;
78+ return { width : 1920 , height : 1080 , bitrate : 8_000_000 } ; // 8 Mbps for 1080p
7979 case Resolution . HD :
80- return { width : 1280 , height : 720 } ;
80+ return { width : 1280 , height : 720 , bitrate : 5_000_000 } ; // 5 Mbps for 720p
8181 case Resolution . SD :
8282 default :
83- return { width : 854 , height : 480 } ;
83+ return { width : 854 , height : 480 , bitrate : 2_000_000 } ; // 2 Mbps for 480p
8484 }
8585 }
8686
@@ -120,7 +120,7 @@ export class VideoRecorder extends Script {
120120 this . framesEncoded = 0 ;
121121 this . framesEncodedAtFlush = 0 ;
122122
123- const { width, height } = this . getResolutionDimensions ( ) ;
123+ const { width, height, bitrate } = this . getVideoSettings ( ) ;
124124
125125 // Create video frame muxer
126126 this . muxer = new Muxer ( {
@@ -146,11 +146,12 @@ export class VideoRecorder extends Script {
146146 error : e => console . error ( e )
147147 } ) ;
148148
149+ // Configure encoder with video settings
149150 this . encoder . configure ( {
150151 codec : 'avc1.420028' , // H.264 codec
151152 width,
152153 height,
153- bitrate : 8_000_000 // 8 Mbps
154+ bitrate
154155 } ) ;
155156
156157 // Set canvas to video frame resolution
0 commit comments