JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 09.12.2019, 15:42
Tom Tom is offline
JD Adviser
 
Join Date: Jun 2018
Posts: 104
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.

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.
Reply With Quote
  #2  
Old 09.12.2019, 19:09
Tom Tom is offline
JD Adviser
 
Join Date: Jun 2018
Posts: 104
Default

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
Reply

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 21:34.
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 - 2024, Jelsoft Enterprises Ltd.