Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/components/VideoEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,30 @@ export default function VideoEditor() {
className="w-full"
/>
</div>
{/* Sharpness */}
<div className="space-y-2">
<div className="flex items-center justify-between text-xs">
<label htmlFor="sharpness-slider">Sharpness</label>
<button
type="button"
onClick={() => updateRecipe({ sharpness: 0 })}
className="text-film-500 hover:underline"
>
Reset
</button>
</div>
<input
id="sharpness-slider"
type="range"
min="0"
max="3"
step="1"
value={recipe.sharpness}
onChange={(e) => updateRecipe({ sharpness: Number(e.target.value) })}
aria-label="Adjust sharpness"
className="w-full"
/>
</div>
</div>
</Section>
<Section icon={<SlidersHorizontal size={12} />} title="Output format" delay={190}>
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useVideoEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
1 change: 1 addition & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export const DEFAULT_RECIPE: EditRecipe = {
saturation: 1,
stabilization: false,
soundOnCompletion: false,
sharpness: 0,
normalizeAudio: false,
};
3 changes: 3 additions & 0 deletions src/lib/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface EditRecipe {
contrast: number;
saturation: number;
soundOnCompletion: boolean;
sharpness: number;
}

export type OverlayPosition =
Expand Down Expand Up @@ -82,6 +83,7 @@ export const DEFAULT_RECIPE: EditRecipe = {
contrast: 0,
saturation: 0,
soundOnCompletion: false,
sharpness: 1,
};

export const MAX_FILE_SIZE =
Expand Down
Loading