Encode array of JPEG images to MPEG1

201 Views Asked by At

I have this web worker code that I need to be able to use to convert an array of JPEG images into MPEG1

importScripts('ffmpeg-core.min.js')

onmessage = function(e) {
    var images = e.data[0]
    console.log('Got frames: ' + images.length)
    var memfs = [];
    var args = ['-framerate', '30', '-i'];
    for (var i =0;i<images.length;i++) {
        var n = 'img-'+pad(i, 3)+'.jpg' 
        memfs.push({name: n, data:images[i]}) 
        args.push('-i'); //adding those to args
        args.push(n);
    }
    // ffmpeg -i source.mp4 -s 640x360 -f mpegts -codec:v mpeg1video -bf 0 -codec:a mp2 -q 4 out.ts

    // var mpeg1Blob = ...
    // postMessage(mpeg1Blob)
}

How can I make this convert the images into MPEG1. MPEG1 for https://github.com/phoboslab/jsmpeg

0

There are 0 best solutions below