Open nareshallakonda opened 3 months ago
const convertVideoFromBytes = async (videoBytes, inputFileName) => { try { await ffmpeg.current.load(); const blob = new Blob([videoBytes], { type: 'video/avi' }); const url = URL.createObjectURL(blob); const outputFileName = inputFileName.replace(/.avi$/, ".mp4"); if (typeof ffmpeg.current.run === 'function') { await ffmpeg.current.run('-i', url, outputFileName); } else { throw new Error('ffmpeg.run is not a function'); } console.log('Conversion completed successfully'); URL.revokeObjectURL(url); console.log(outputFileName,'outputFileName') return outputFileName;
} catch (error) { // Error converting video console.error('Error converting video:', error); throw error; }
};
when i use await ffmpeg.current.load(); , its getting like issue !
const convertVideoFromBytes = async (videoBytes, inputFileName) => { try { await ffmpeg.current.load(); const blob = new Blob([videoBytes], { type: 'video/avi' }); const url = URL.createObjectURL(blob); const outputFileName = inputFileName.replace(/.avi$/, ".mp4"); if (typeof ffmpeg.current.run === 'function') { await ffmpeg.current.run('-i', url, outputFileName); } else { throw new Error('ffmpeg.run is not a function'); } console.log('Conversion completed successfully'); URL.revokeObjectURL(url); console.log(outputFileName,'outputFileName') return outputFileName;
};
when i use await ffmpeg.current.load(); , its getting like issue !