JDownloader Community - Appwork GmbH


Thread Tools Display Modes
Old 09.12.2019, 16:42
Tom Tom is offline
Giga Loader
Join Date: Jun 2018
Posts: 97
Default 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.

// 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 04:23.
Reply With Quote
Old 09.12.2019, 20:09
Tom Tom is offline
Giga Loader
Join Date: Jun 2018
Posts: 97

i checked the ffmpeg commands and found an error in the mapping syntax
"-c:s", "copy" was missing, without it its encoding the video.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 02:24.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.