Node.js Streaming Using fluent-ffmpeg

Example

You can also use flent-ffmpeg to convert .mp4 files to .flv files, or other types:

res.contentType('flv');

    var pathToMovie = './public/' + req.params.filename;

    var proc = ffmpeg(pathToMovie)

        .preset('flashvideo')

        .on('end', function () {

            console.log('Stream Done');

        })

        .on('error', function (err) {

            console.log('an error happened: ' + err.message);

            res.send(err.message);

        })

        .pipe(res, { end: true });