Skip to content

Commit

Permalink
Merge pull request #650 from tws101/master
Browse files Browse the repository at this point in the history
Patching two flow plugins
  • Loading branch information
HaveAGitGat committed Jun 3, 2024
2 parents 0e5bf2a + 8774427 commit a5bd5cd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var plugin = function (args) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
args.inputs = lib.loadDefaultValues(args.inputs, details);
var propertyToCheck = String(args.inputs.propertyToCheck).trim();
var valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',');
var valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map(function (item) { return item.trim(); });
var condition = String(args.inputs.condition);
args.variables.ffmpegCommand.streams.forEach(function (stream) {
var _a;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ var plugin = function (args) {
}
}
if (newContainer === 'mp4') {
if ([
'hdmv_pgs_subtitle',
'eia_608',
'timed_id3',
'subrip',
].includes(codecName)) {
if (codecType === 'attachment'
|| [
'hdmv_pgs_subtitle',
'eia_608',
'timed_id3',
'subrip',
'ass',
'ssa',
].includes(codecName)) {
stream.removed = true;
}
}
Expand All @@ -92,6 +95,16 @@ var plugin = function (args) {
}
}
}
// handle genpts if coming from odd container
var container = args.inputFileObj.container.toLowerCase();
if ([
'ts',
'avi',
'mpg',
'mpeg',
].includes(container)) {
args.variables.ffmpegCommand.overallOuputArguments.push('-fflags', '+genpts');
}
}
return {
outputFileObj: args.inputFileObj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
args.inputs = lib.loadDefaultValues(args.inputs, details);

const propertyToCheck = String(args.inputs.propertyToCheck).trim();
const valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',');
const valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map((item) => item.trim());
const condition = String(args.inputs.condition);

args.variables.ffmpegCommand.streams.forEach((stream) => {
Expand All @@ -101,7 +101,6 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
const prop = String(target).toLowerCase();
for (let i = 0; i < valuesToRemove.length; i += 1) {
const val = valuesToRemove[i].toLowerCase();

const prefix = `Removing stream index ${stream.index} because ${propertyToCheck} of ${prop}`;
if (condition === 'includes' && prop.includes(val)) {
args.jobLog(`${prefix} includes ${val}\n`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {

if (newContainer === 'mp4') {
if (
[
codecType === 'attachment'
|| [
'hdmv_pgs_subtitle',
'eia_608',
'timed_id3',
'subrip',
'ass',
'ssa',
].includes(codecName)
) {
stream.removed = true;
Expand All @@ -108,6 +111,18 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
}
}
}
// handle genpts if coming from odd container
const container = args.inputFileObj.container.toLowerCase();
if (
[
'ts',
'avi',
'mpg',
'mpeg',
].includes(container)
) {
args.variables.ffmpegCommand.overallOuputArguments.push('-fflags', '+genpts');
}
}

return {
Expand Down

0 comments on commit a5bd5cd

Please sign in to comment.