#1
|
|||
|
|||
High CPU usage while using ffmpeg in eventscripter.
script my mgpai uses ffmpeg 90% cpu usage and converting takes hours
running ffmpeg with same commands in windows cmd, cpu usage is 30% and converting takes some minutes cpu usage is normal when converting same file using same parameters in 'cmd' window. Code:
// Convert dts to ac3 and create new video file // Trigger Required: A new file has been created // Forum Topic: https://board.jdownloader.org/showpo...&postcount=489 var ffmpeg = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypath"); var ffprobe = callAPI("config", "get", "org.jdownloader.controlling.ffmpeg.FFmpegSetup", null, "binarypathprobe"); files.forEach(function(file) { if (["mkv", "mp4"].indexOf(getPath(file).getExtension()) == -1) return; var meta = callSync(ffprobe, "-i", file); var ac3 = meta.indexOf("Stream #0:1(ger): Audio: ac3") > -1; var dts = meta.indexOf("Stream #0:1(ger): Audio: dts") > -1; if (ac3 || dts) { var ext = getPath(file).getExtension(); var ac3Command = ["cmd", "/k", ffmpeg, "-i", file, "-map", "0:0", "-map", "0:m:language:ger", "-c:s", "copy", "-c:a", "copy", file.replace(ext, "_ac3." + ext)]; var dtsCommand = ["cmd", "/k", ffmpeg, "-i", file, "-map", "0:0", "-map", "0:m:language:ger", "-c:s", "copy", "-c:a", "ac3", "-b:a", "640k", file.replace(ext, "_ac3." + ext)]; callAsync(function(error) { if (!error) getPath(file).delete(); }, ac3 ? ac3Command : dtsCommand); } }); Last edited by raztoki; 10.12.2019 at 03:23. |
#2
|
|||
|
|||
i checked the ffmpeg commands and found an error in the mapping syntax
"-c:s", "copy" was missing, without it its encoding the video. |
Thread Tools | |
Display Modes | |
|
|