phoboslab / jsmpeg-vnc

A low latency, high framerate screen sharing server for Windows and client for browsers
2.39k stars 396 forks source link

Estimating bitrate #69

Open roelvz opened 4 years ago

roelvz commented 4 years ago

The code uses the width * 1500 to estimate the bitrate. Could you explain why this would be a good estimate? if( !bit_rate ) { bit_rate = out_width * 1500; } // estimate bit rate based on output size

phoboslab commented 4 years ago

It's just a guess to provide some default. Higher resolutions require higher bitrates and 1500 bits per pixel worked reasonably well for a few resolutions I tested this with. Of course this completely ignores the image height, which may be problem for portrait-orientation.

I believe I googled for the right way to set a reasonable bitrate for MPEG1 back then, but couldn't find anything. Maybe dig into the ffmpeg source to see how they do it!?

roelvz commented 4 years ago

Thanks for the quick answer.

I'm sure there are much more sophisticated estimate methods, but this seems to work fine for me. I was just curious what was the reasoning behind the 1500.