mp4-mjpeg
mp4-mjpeg copied to clipboard
Output videos not playing
Am I using this incorrectly?
const mjpeg = require('./index.js');
const fs = require('fs');
function pad(number) {
if (number<=999) { number = ("00"+number).slice(-3); }
return number;
}
mjpeg({ fileName: "output.mp4" })
.then( (recorder) => {
console.log('start');
let current = 1;
function next() {
fs.readFile('./images/image-'+pad(current)+'.jpg', function (err, data) {
if (err) throw err;
recorder.appendImageBuffer( data );
if (++current <= 10) {
next();
} else {
recorder.finalize()
.then( () => {
console.log('MP4 video file is ready');
})
.catch( (error) => {
console.log('error', error);
})
}
});
}
next();
})
.catch( (error) => {
console.log('error', error);
})
From my understanding this is how you intend this library to work but the output isn't playable in any video player that I have. Am I missing something or setting this up in some incorrect way? Is there something special I need to do to the jpg files that I am loading maybe?
the output isn't playable in any video player that I have
same here, however ffmpeg is able to convert the output into playable file, which means it is missing codec problem.
BTW, the file does play in VLC on Windows with CCCP installed. However, MPC-HQ does not play it on the same machine. So the players support is basically non-existant.