Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

Add 'Quarter' preview quality option to editor

Richie McIlroy72030a4c6092
diff --git a/Cargo.lock b/Cargo.lock
index 94269460b..4dde01198 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1398,6 +1398,21 @@ dependencies = [
"workspace-hack",
]
+[[package]]
+name = "cap-frame-converter"
+version = "0.1.0"
+dependencies = [
+ "cap-media-info",
+ "crossbeam-channel",
+ "ffmpeg-next",
+ "flume",
+ "parking_lot",
+ "thiserror 1.0.69",
+ "tracing",
+ "windows 0.60.0",
+ "workspace-hack",
+]
+
[[package]]
name = "cap-gpu-converters"
version = "0.1.0"
@@ -1486,6 +1501,7 @@ dependencies = [
"cap-enc-mediafoundation",
"cap-fail",
"cap-flags",
+ "cap-frame-converter",
"cap-media",
"cap-media-info",
"cap-mediafoundation-ffmpeg",
diff --git a/apps/desktop/src/routes/editor/Player.tsx b/apps/desktop/src/routes/editor/Player.tsx
index f8fc1fc71..d60352b93 100644
--- a/apps/desktop/src/routes/editor/Player.tsx
+++ b/apps/desktop/src/routes/editor/Player.tsx
@@ -45,6 +45,7 @@ export function PlayerContent() {
const previewOptions = [
{ label: "Full", value: "full" as PreviewQuality },
{ label: "Half", value: "half" as PreviewQuality },
+ { label: "Quarter", value: "quarter" as PreviewQuality },
];
// Load captions on mount
@@ -262,7 +263,7 @@ export function PlayerContent() {
</EditorButton>
</div>
<div class="flex items-center gap-2">
- <span class="text-xs font-medium text-gray-11">Preview</span>
+ <span class="text-xs font-medium text-gray-11">Preview quality</span>
<KSelect<{ label: string; value: PreviewQuality }>
options={previewOptions}
optionValue="value"
@@ -289,10 +290,10 @@ export function PlayerContent() {
)}
>
<KSelect.Trigger class="flex items-center gap-2 h-9 px-3 rounded-lg border border-gray-3 bg-gray-2 dark:bg-gray-3 text-sm text-gray-12">
- <KSelect.Value<{ label: string; value: PreviewQuality }>
- class="flex-1 text-left truncate"
- placeholder="Select preview quality"
- >
+ <KSelect.Value<{
+ label: string;
+ value: PreviewQuality;
+ }> class="flex-1 text-left truncate">
{(state) =>
state.selectedOption()?.label ?? "Select preview quality"
}
@@ -306,9 +307,6 @@ export function PlayerContent() {
as={KSelect.Content}
class={cx(topLeftAnimateClasses, "w-44")}
>
- <MenuItem as="div" class="text-gray-11" data-disabled="true">
- Select preview quality
- </MenuItem>
<MenuItemList<typeof KSelect.Listbox>
as={KSelect.Listbox}
class="max-h-40"
@@ -514,10 +512,7 @@ function PreviewCanvas() {
height = width / frameAspect();
}
- return {
- width: Math.min(width, frameWidth()),
- height: Math.min(height, frameHeight()),
- };
+ return { width, height };
};
return (
diff --git a/apps/desktop/src/routes/editor/context.ts b/apps/desktop/src/routes/editor/context.ts
index 088fab417..01f70479b 100644
--- a/apps/desktop/src/routes/editor/context.ts
+++ b/apps/desktop/src/routes/editor/context.ts
@@ -57,13 +57,14 @@ export const OUTPUT_SIZE = {
y: 1080,
};
-export type PreviewQuality = "half" | "full";
+export type PreviewQuality = "quarter" | "half" | "full";
export const DEFAULT_PREVIEW_QUALITY: PreviewQuality = "full";
const previewQualityScale: Record<PreviewQuality, number> = {
full: 1,
half: 0.5,
+ quarter: 0.25,
};
export const getPreviewResolution = (quality: PreviewQuality): XY<number> => {