-
-
Save matthewhudson/31a78b95cbb2329f82c6bc5d03a1b617 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