Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

283
Visualizações
What's the best way to reduce the frame rate used by a MediaRecorder?

I have a MediaStream from a WebRTC remote peer from which I would like to create a video recording in the browser.

I'm currently creating the MediaRecorder like this:

const recorder = new MediaRecorder(mediaStream);

The original stream has a frame rate of e.g. 30fps. I would like the recording to have a lower framerate, e.g. 12fps.

So far the only strategy I can find is to create an intermediary canvas, repeatedly copy the original stream to the canvas, and create a new stream with the desired framerate based on the canvas, something like this:

const video = document.getElementById('my_video_element');
// ... do more to set up video here
video.srcObject = mediaStream;
const canvas = document.createElement('canvas');
canvas.width = 1280;
canvas.height = 720;
setInterval(() => {
  canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
}, 18);
const desiredFps = 12;
const recorder = new MediaRecorder(canvas.captureStream(desiredFps));

Is there a better/simpler way?

Note: I am aware that the videoBitsPerSecond setting can be used to reduce the bitrate of the output recording. But I find that even for a fixed videoBitsPerSecond setting value, reducing the fps of the canvas stream reduces the effective bitrate of the MediaRecorder.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You have the right approach. You're doing temporal resampling. That's what ffmpeg would do if you did it with native code.

If you're starting with 30fps, you should resample to either 10fps or 15fps. That way you can keep every other decoded frame, or every third frame. That makes for a nicer-looking recording.

Resampling from 30fps to 12fps and getting tolerable output is possible, but it's a computational monster because of the need for temporal interpolation. Relying on browser WebRTC to do that? Not wise.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda