Is there some formula like frames per second X resolution to determine the bitsPerSecond? I can't understand what values I'm supposed to be using. I want to specify the bitsPerSecond for 720p, 1080p and 4k video. I'm not sure if file type matters but this will most likely befor webm or mp4. I'm afraid some of my files are unnecessarily large while others I'm not using enough bits causing video glitches.
I did find values listed here.... https://restream.io/blog/what-is-a-good-upload-speed-for-streaming/ But even that im not sure how to convert over.
I am using RecordRTC https://github.com/muaz-khan/RecordRTC which is a wrapper for the MediaRecorder.
recorder = RecordRTC(camera, {
recorderType: MediaStreamRecorder,
mimeType: encoding_options,
bitsPerSecond: bits_per_second,
timeSlice: 15000,
getNativeBlob: true
});
I thought about doing something like this? But am I using too large of values or too small?
var bits_per_second = 5000000;
if (current_camera_height > 2100){
bits_per_second = 16777216
}
if (current_camera_height > 1000){
bits_per_second = 7500000
}
You can read this article about video bitrate to understand how it works. https://restream.io/blog/what-is-video-bitrate/
According to YouTube Recommended video bitrates ( https://support.google.com/youtube/answer/1722171?hl=en#zippy=%2Cbitrate), you can use
bits_per_second = 40000000 for 4K video,
bits_per_second = 16000000 for 2K video,
bits_per_second = 8000000 for 1080p video,
bits_per_second = 5000000 for 720p video,
bits_per_second = 2500000 for 480p video,
bits_per_second = 1000000 for 360p video