Kagami / ffmpeg.js

Port of FFmpeg with Emscripten
Other
3.24k stars 329 forks source link

{ code: 101, msg: 'The input file path must be a string' } #187

Closed Konglomneshued closed 1 year ago

Konglomneshued commented 1 year ago

Error occurred in handler for 'loadSong': { code: 101, msg: 'The input file path must be a string' }

const loadSong = async (
   songPath: Path // a string representing the path to the song
) => {
   const decodedPath = decodeURI(songPath);

   const [ path, extension ] = decodedPath.split('.');

   return new Promise((resolve, reject) => {
      if (extension === 'm4a') {
         const newPath = path + '.flac';
         ffmpeg({
            arguments: [ '-i', decodedPath, '-acodec', 'alac', newPath ],
            print: data => resolve(data),
            printErr: error => {
               console.error(error.msg);
               reject(error);
            }
         });
      } else {
         resolve(decodedPath);
      }
   });
};

Tried using a string literal instead of variables for my arguments and I get the same error.

Konglomneshued commented 1 year ago

Installed wrong ffmpeg library, sorry.