fix ffmpeg调用出错
This commit is contained in:
parent
77a3bccc55
commit
64124557c6
@ -1,4 +1,6 @@
|
||||
const {spawn} = require('child_process');
|
||||
const path = require('path');
|
||||
const { cwd } = require('process');
|
||||
|
||||
|
||||
function seep(time) {
|
||||
@ -19,10 +21,12 @@ function seep(time) {
|
||||
*/
|
||||
function getVideoSpecifyTimeImage(filePath, seconds, save) {
|
||||
return new Promise((resolve) => {
|
||||
console.info(formatSeconds(seconds))
|
||||
const lux = spawn("./bin/ffmpeg.exe", ['-ss', formatSeconds(seconds), '-i', filePath, '-vframes 1', save])
|
||||
const lux = spawn("ffmpeg", ['-ss',`${formatSeconds(seconds)}`,'-i',filePath,'-vframes','1',save],{
|
||||
env:{
|
||||
path:path.join(cwd(),'./bin/')
|
||||
}
|
||||
})
|
||||
lux.stdout.on('data', (data) => {
|
||||
console.log("开始")
|
||||
console.log(data)
|
||||
});
|
||||
lux.on('close', (code) => {
|
||||
@ -30,7 +34,10 @@ function getVideoSpecifyTimeImage(filePath, seconds, save) {
|
||||
console.log(code.toString())
|
||||
resolve(save)
|
||||
});
|
||||
|
||||
lux.stderr.on("data",(err)=>{
|
||||
console.log(String(err))
|
||||
})
|
||||
console.log(lux)
|
||||
})
|
||||
}
|
||||
|
||||
@ -69,7 +76,11 @@ function createTorrent(filePath, save) {
|
||||
|
||||
|
||||
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("yt-dlp", ['--cookies-from-browser', 'chrome', '-P', info.save, '-o', info.title + '.mp4', info.url],{
|
||||
env:{
|
||||
path:path.join(cwd(),'./bin/')
|
||||
}
|
||||
})
|
||||
lux.stdout.on('data', (data) => {
|
||||
console.log(String(data))
|
||||
callback(String(data), false)
|
||||
|
Loading…
Reference in New Issue
Block a user