From 6f0df4b94b57283a66a0450823d5efc98c45179a Mon Sep 17 00:00:00 2001
From: Maitrayee Khalasi <87898010+MaitrayeeK@users.noreply.github.com>
Date: Tue, 19 May 2026 08:02:54 +0000
Subject: [PATCH] feat: add video sharpening filter option
---
src/components/VideoEditor.tsx | 24 ++++++++++++++++++++++++
src/hooks/useVideoEditor.ts | 4 ++++
src/lib/constants.ts | 1 +
src/lib/ffmpeg.ts | 3 +++
src/lib/types.ts | 2 ++
5 files changed, 34 insertions(+)
diff --git a/src/components/VideoEditor.tsx b/src/components/VideoEditor.tsx
index f89872d5..7f6e39ba 100644
--- a/src/components/VideoEditor.tsx
+++ b/src/components/VideoEditor.tsx
@@ -246,6 +246,30 @@ export default function VideoEditor() {
className="w-full"
/>
+ {/* Sharpness */}
+
+
+
+
+
+
updateRecipe({ sharpness: Number(e.target.value) })}
+ aria-label="Adjust sharpness"
+ className="w-full"
+ />
+
} title="Output format" delay={190}>
diff --git a/src/hooks/useVideoEditor.ts b/src/hooks/useVideoEditor.ts
index a2283128..652e8672 100644
--- a/src/hooks/useVideoEditor.ts
+++ b/src/hooks/useVideoEditor.ts
@@ -106,6 +106,10 @@ function validateRecipe(recipe: EditRecipe, duration: number ): string | null {
recipe.saturation < 0 || recipe.saturation > 3,
"Saturation must be between 0 and 3.",
],
+ [
+ recipe.sharpness < 0 || recipe.sharpness > 3,
+ "Sharpness must be between 0 and 3.",
+ ],
];
return (
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 95774741..ef164dd6 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -19,4 +19,5 @@ export const DEFAULT_RECIPE: EditRecipe = {
saturation: 1,
stabilization: false,
soundOnCompletion: false,
+ sharpness: 0,
};
\ No newline at end of file
diff --git a/src/lib/ffmpeg.ts b/src/lib/ffmpeg.ts
index beaeed1b..c9707945 100644
--- a/src/lib/ffmpeg.ts
+++ b/src/lib/ffmpeg.ts
@@ -120,6 +120,9 @@ function buildVideoFilter(recipe: EditRecipe, targetW: number, targetH: number):
`crop=${targetW}:${targetH}`
);
}
+ if (recipe.sharpness !== 0) {
+ filters.push(`unsharp=5:5:${recipe.sharpness}:5:5:0.0`);
+ }
if (recipe.speed !== 1) {
const pts = (1 / recipe.speed).toFixed(4);
diff --git a/src/lib/types.ts b/src/lib/types.ts
index bf167094..f997e2ec 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -15,6 +15,7 @@ export interface EditRecipe {
contrast: number;
saturation: number;
soundOnCompletion: boolean;
+ sharpness: number;
}
export type OverlayPosition =
@@ -80,6 +81,7 @@ export const DEFAULT_RECIPE: EditRecipe = {
contrast: 0,
saturation: 0,
soundOnCompletion: false,
+ sharpness: 1,
};
export const MAX_FILE_SIZE =