Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

519
Vistas
Getting the "Invalid data found when processing input" error when I try to convert a raw pcm file to mp3?

I tried to convert a file from pcm into mp3 with ffmpeg and the npm package fluent-ffmpeg. This is my code:

const ffmpeg = require('fluent-ffmpeg');

function convert(input, output, callback) {
    ffmpeg(input)
        .output(output)
        .on('end', function() {                    
            console.log('conversion ended');
            callback(null);
        }).on('error', function(err){
           console.log('error: ' + err);
           callback(err);
        }).run();
   }

   convert('./test.pcm', './converted.mp3', function(err){
   if(!err) {
      console.log('conversion complete');
   }
});

But every time I execute the script, I get this error:

error: Error: ffmpeg exited with code 1: ./test.pcm: Invalid data found when processing input

When I tired running:

ffmpeg -f s16le -ar 48k -ac 2 -i test.pcm converted.mp3

Everything worked though. Is there something wrong with the npm package? Is there something I missed out or something I did wrong on my code?

Edit:

My code works when I try to convert an mp3 to a wav file (for example). So it's only struggling with pcm files.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda