-
-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
HeiSir
committed
Jun 18, 2020
1 parent
7ff957b
commit c8022b9
Showing
10 changed files
with
1,101 additions
and
267 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use strict"; | ||
const ffmpeg = require('fluent-ffmpeg'); | ||
const fs = require('fs'); | ||
const { Readable} = require('stream'); | ||
const path = require('path'); | ||
|
||
|
||
const dir = 'E:\\Project\\my_project\\M3U8-Downloader\\source\\download\\1592447619950\\'; | ||
let inputStream = new Readable(); | ||
let _ffmpeg = ffmpeg(inputStream) | ||
.setFfmpegPath('E:\\Project\\my_project\\M3U8-Downloader\\source\\ffmpeg.exe') | ||
.videoCodec('copy') | ||
.audioCodec('copy') | ||
.save("E:\\Project\\my_project\\M3U8-Downloader\\source\\download\\1592447619950\\output.mp4") | ||
.on('progress', function(info) { | ||
console.log(info); | ||
}) | ||
.on('end', function() { | ||
console.log('done processing input stream'); | ||
}) | ||
.on('error', function(err) { | ||
console.log('an error happened: ' + err.message); | ||
}); | ||
|
||
function sleep(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)); | ||
} | ||
|
||
fs.readdir(dir,function(err,files){ | ||
for (let index = 0; index < files.length; index++) { | ||
const file = files[index]; | ||
if(file.endsWith(".ts")) | ||
{ | ||
inputStream.push( fs.readFileSync(path.join(dir,file)) ); | ||
//console.log(`file : ${index}`); | ||
} | ||
} | ||
inputStream.push(null); | ||
}); | ||
|
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
Oops, something went wrong.