add 获取视频文件 medaInfo 信息
This commit is contained in:
parent
d16f5264bf
commit
ab4783d544
@ -16,7 +16,6 @@ function seep(time) {
|
|||||||
* @returns {number} 时长(秒)
|
* @returns {number} 时长(秒)
|
||||||
*/
|
*/
|
||||||
function getVideoTotalLength(filePath) {
|
function getVideoTotalLength(filePath) {
|
||||||
|
|
||||||
const lux = spawn("./bin/ffmpeg.exe", ['-i', filePath, '-show_entries', 'format=duration', '-v', 'quiet', '-of', 'csv="p=0"'])
|
const lux = spawn("./bin/ffmpeg.exe", ['-i', filePath, '-show_entries', 'format=duration', '-v', 'quiet', '-of', 'csv="p=0"'])
|
||||||
console.log("join")
|
console.log("join")
|
||||||
lux.stdout.on('data', (data) => {
|
lux.stdout.on('data', (data) => {
|
||||||
@ -31,6 +30,20 @@ function getVideoTotalLength(filePath) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取视频文件信息
|
||||||
|
* @param {String}filePath 文件绝对路径
|
||||||
|
* @return {Promise<JSON>} videoInfo
|
||||||
|
*/
|
||||||
|
function getMediaInfo(filePath) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const lux = spawn("./bin/MediaInfoCLI/MediaInfo.exe", ['--output=JSON', filePath])
|
||||||
|
lux.stdout.on('data', (data) => {
|
||||||
|
resolve(JSON.parse(data))
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function dow(info, callback) {
|
function dow(info, callback) {
|
||||||
const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url])
|
const lux = spawn("./bin/yt-dlp.exe", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url])
|
||||||
@ -48,5 +61,6 @@ function dow(info, callback) {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
seep,
|
seep,
|
||||||
dow,
|
dow,
|
||||||
getVideoTotalLength
|
getVideoTotalLength,
|
||||||
|
getMediaInfo,
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user