const { exec } = require('child_process');

exec('ffmpeg -version', (error, stdout, stderr) => {
   if (error) {
      console.log('FFmpeg is not installed. Installing FFmpeg...');
      exec('apt update && apt install -y ffmpeg', (installError, installStdout, installStderr) => {
         if (installError) {
            console.error(`Error installing FFmpeg: ${installError}`);
            return;
         }
         console.log('FFmpeg installed successfully.');
      });
   } else {
      console.log('FFmpeg is already installed.');
   }
});