Created
November 29, 2017 08:41
-
-
Save yoannmoinet/97d9e3fe479fa3bf9132bff184443f03 to your computer and use it in GitHub Desktop.
Stream video back in correct format.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ffmpeg form 'fluent-ffmpeg'; | |
const filePath = '/Users/yoann/Desktop/video.avi'; | |
const route = (req, res) => { | |
res.writeHead(200, getHeaders({'Content-Type': 'video/mp4'})); | |
ffmpeg(filePath) | |
.format('mp4') | |
.addOptions([ | |
'-movflags frag_keyframe+faststart' | |
]) | |
.pipe(res, {end: true}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment