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

175
Visualizações
Convert a Video Blob URL to Video mp4 File

I'm trying to convert mediaBlobUrl that I get after recording a video using Media Recorder to a mp4 file,

const {
        status,
        startRecording,
        stopRecording,
        mediaBlobUrl,
    } = useReactMediaRecorder({ video: true });

const myFile = new File([mediaBlobUrl], "demo.mp4", { type: 'video/mp4' });

But after logging out the file, I always get the file size as 64 Bytes and it doesn't work.

Note: However If I download the file using blob url like this,

<a href={mediaBlobUrl} download="myFile">Download file</a>

And then upload the file and check its size, it is working fine.

Is there any other way to convert the blob Url to a mp4 video file?

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

0

The mediaBlobUrl provided by react-media-recorder is an object URL and not a Blob. That's why the conversion to a File fails.

There is an onstop function which allows you to access the Blob directly. But you can also convert the object URL back into a Blob as described here.

const mediaBlob = await fetch(mediaBlobUrl)
    .then(response => response.blob());

const myFile = new File(
    [mediaBlob],
    "demo.mp4",
    { type: 'video/mp4' }
);

Please note that this will only produce a valid file if the MediaRecorder was actually configured to record an mp4.

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