Skip to content

Commit 777fde7

Browse files
committed
add example any-to-mp4-steam.js
1 parent 1266709 commit 777fde7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

examples/any-to-mp4-steam.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// The solution based on adding -movflags for mp4 output
2+
// For more movflags details check ffmpeg docs
3+
// https://ffmpeg.org/ffmpeg-formats.html#toc-Options-9
4+
5+
var fs = require('fs');
6+
var path = require('path');
7+
var ffmpeg = require('../index');
8+
9+
var pathToSourceFile = path.resolve(__dirname, '../test/assets/testvideo-169.avi');
10+
var readStream = fs.createReadStream(pathToSourceFile);
11+
var writeStream = fs.createWriteStream('./output.mp4');
12+
13+
ffmpeg(readStream)
14+
.addOutputOptions('-movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov')
15+
.format('mp4')
16+
.pipe(writeStream);

0 commit comments

Comments
 (0)