muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.54k stars 1.75k forks source link

MediaRecorder iOS does not obey the bitrate #793

Open maxcodefaster opened 2 years ago

maxcodefaster commented 2 years ago

I'm using MediaRecorder to record video from webcam and in case of safari (or iOS Chrome) output is mp4 file. The issue is that video from iOS chrome has huge bitrate.

Using recordrtc library, this code:

this.recorder = new RecordRTCPromisesHandler(new MediaStream([
      this.ownStream.getVideoTracks()[0],
      this.ownStream.getAudioTracks()[0]
    ]), {
      type: 'video',
      mimeType: 'video/mp4',
      recorderType: MediaStreamRecorder,
      audioBitsPerSecond: 48 * 1024,
      videoBitsPerSecond: 384 * 1024,
    });
await this.recorder.startRecording();

creates mp4 successfully, but result bitrate of output video is 92643 kb/s for 10 FPS video!

Full ffprobe output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4': Metadata: major_brand : iso5 minor_version : 1 compatible_brands: isomiso5hlsf creation_time : 2021-12-14T14:52:28.000000Z Duration: 00:00:00.59, start: 0.000000, bitrate: 92643 kb/s Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc), 640x480, 97341 kb/s, 10.14 fps, 20 tbr, 600 tbn, 1200 tbc (default) Metadata: rotate : 90 creation_time : 2021-12-14T14:52:28.000000Z handler_name : Core Media Video Side data: displaymatrix: rotation of -90.00 degrees Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 2552 kb/s (default) Metadata: creation_time : 2021-12-14T14:52:28.000000Z handler_name : Core Media Audio

dosdemon commented 5 months ago

Did you find any solution for it?