Video recorded using MediaRecorder Web API comes with audio sped up

31 views Asked by At

I've been using the MediaRecorder Web API to record a MediaStream obtained using getUserMedia() to record video + audio coming from a webcam + microphone.

getUserMedia is not called with specific constraints other than video = true and audio = true.

MediaRecorder is instantiated with audioBitsPerSecond set to 128000 and videoBitsPerSecond set to 1024000.

Most of the time, (I'd say 99% of the time), this setup works and video and audio are recorded in sync and with reasonable quality.

However, I am seeing that some videos, even though they've been properly recorded, come up with audio that seems to be crazily sped up and very low quality. Video playback is fine.

Could this be an issue with the audio sample rate? Note that I am not specifying any sample rate constraint when calling getUserMedia.

Reproducing this issue on my device has been challenging, making it difficult to debug.

I would greatly appreciate insights from anyone who has experienced and addressed this problem.

I've tried manually setting a sample rate constraint of 48000 when calling getUserMedia, but still some videos came up with audio sped up.

I've also tried the AudioContext API, setting the sample rate to 48000. No luck.

0

There are 0 answers