I am trying no matter what format of video my clients upload to convert them into three different formats:
var videoExtensions = ['mp4', 'webm', 'ogg'];
var ffmpeg = require('fluent-ffmpeg');
videoExtensions.forEach(function (extension) {
var proc = new ffmpeg({source: media.file.path, nolog: false})
.withVideoCodec('libx264')
.withVideoBitrate(800)
.withAudioCodec('libvo_aacenc')
.withAudioBitrate('128k')
.withAudioChannels(2)
.toFormat(extension)
.saveToFile(media.targetDir + media.getName() + '.' + extension,
function (retcode, error) {
console.log('file has been converted succesfully');
});
});
On my local machine I am able to open and play the videos no problem
However as soon as I load them as resources into my browser it simply will not play.
If I however instead of converting just move the file I have no problem opening the file in my browser however then I will not be able to get the file in all three formats.
My question is am I doing something wrong in the above code or why is my browser "rejecting" the files so to speak?