-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (32 loc) · 766 Bytes
/
Copy pathindex.js
File metadata and controls
35 lines (32 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"use strict";
var _require = require("child_process"),
exec = _require.exec;
var encodeVideo = function encodeVideo(id, video, uri) {
exec(
"cd encryptedVideos && cd " +
id +
" && openssl rand 16 > " +
id +
".key && echo " +
uri +
" > " +
id +
".keyinfo && echo " +
id +
".key >> " +
id +
".keyinfo && ffmpeg -y -i " +
video +
" -hls_time 9 -hls_key_info_file " +
id +
'.keyinfo -hls_playlist_type vod -hls_segment_filename "fileSequence%d.ts" prog_index.m3u8',
function (error, stdout, stderr) {
if (error) {
console.log(error.message);
} else {
console.log("key created");
}
}
);
};
module.exports = encodeVideo;