Skip to content

Commit

Permalink
add audio removal functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
tahsinature committed Nov 16, 2024
1 parent 02126e6 commit daeedfe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hardbrake",
"version": "1.0.8",
"version": "1.1",
"module": "src/index.ts",
"type": "module",
"license": "MIT",
Expand Down
6 changes: 4 additions & 2 deletions src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const getProgressAndRemainingTime = (line: string) => {
return { progress, remainingTime };
};

export const main = async (files: File[], preset: string) => {
export const main = async (files: File[], preset: string, { keepAudio = true }) => {
const audioFlag = keepAudio ? "" : "-a none";

for (const file of files) {
const outputFileName = `${file.fileNameWithoutExtension}__HandBraked__${preset}.mp4`;
file.outputFullPath = path.resolve(file.dir, outputFileName);
file.cmd = `HandBrakeCLI -i '${file.originalFullPath}' -o '${file.outputFullPath}' -Z '${preset}'`;
file.cmd = `HandBrakeCLI -i '${file.originalFullPath}' ${audioFlag} -o '${file.outputFullPath}' -Z '${preset}'`;
}

const progressBar = new ProgressBar(files.length);
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ const hardbrake = async () => {
}

const preset = await askPreset();
const keepAudio = await askToggle("Do you want to keep the audio?");

await main(files, preset);
await main(files, preset, { keepAudio });

const happyWithResults = await askToggle("Are you happy with the results?");
if (!happyWithResults) {
Expand Down

0 comments on commit daeedfe

Please sign in to comment.