I'm running a node.js HTTP server which has a video conversion API built using ffmpeg. I am wondering how best to report on the progress of the file conversion to a separate front end. The HTTP server is going to be standalone as its own service, so I would like to be able to render the percentage complete of the conversion to another server with a simple front end. Upon completion of the conversion the file is downloaded automatically.
My current end point /convert
takes a file URL with a .mov extension, downloads the file and runs it through the conversion process to only output Audio. Using response headers I force the browser to download the file once the conversion has ended, I also delete the temporary file once download has completed.
A full request would look like
https://www.someurl.com/convert?file=https://www.filetodownload.com/Skating.mov
I am using the fluent-ffmpeg npm package: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg which serves a "progress" event:
ffmpeg('/path/to/file.avi')
.on('progress', function(progress) {
console.log('Processing: ' + progress.percent + '% done');
});
I am thinking of emitting the progress.percent information on to a separate endpoint maybe along the lines of:
https://www.someurl.com/progress
Which will simply be my http server sending the percentage back to the browser. I feel as though I am going about the architecture incorrectly and there must be a better way of architecting the final outcome.
via munkee
No comments:
Post a Comment