Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

javascript - How do you determine bitsPerSecond for media recording?

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 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
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
...