Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let output = Flow.TempPath + '/' + Flow.NewGuid() + '.mkv';
- let handbrake = Flow.GetToolPath('handbrakecli');
- let presetFilePath = Variables.presetFilePath;
- let presetName = Variables.presetName;
- let executeArgs = new ExecuteArgs();
- executeArgs.command = handbrake;
- executeArgs.argumentList = [
- '--preset-import-file', presetFilePath,
- '-Z', presetName,
- '-i', Variables.file.FullName,
- '-o', output
- ];
- executeArgs.workingDirectory = Flow.TempPath + '/';
- executeArgs.add_Output((line) => {
- let matches = line.match(/^Encoding: task (?<task>\d) of (?<totalTasks>\d), (?<percentage>\d+\.\d+) % \((?<fps>\d+\.\d+ fps), avg (?<avgfps>\d+\.\d+ fps), ETA (?<eta>\d+h\d+s)\)$/);
- if (matches) {
- Flow.PartPercentageUpdate(matches.groups.percentage);
- Flow.AdditionalInfoRecorder('stage',matches.groups.task + ' of ' + matches.groups.totalTasks);
- Flow.AdditionalInfoRecorder('fps',matches.groups.fps);
- Flow.AdditionalInfoRecorder('avgfps',matches.groups.avgfps);
- Flow.AdditionalInfoRecorder('eta',matches.groups.eta);
- }
- });
- let process = Flow.Execute(executeArgs);
- if(process.exitCode !== 0){
- Logger.ELog('Failed processing ffmpeg: ' + process.exitCode);
- return -1;
- }
- if(Flow.FileExists(output) !== true)
- {
- Logger.ELog('Output file does not exist from HandBrakeCLI: ' + output);
- return -1;
- }
- Flow.SetWorkingFile(output);
- return 1;
Advertisement
Add Comment
Please, Sign In to add comment