Skip to content

AutoShorts is a local-first desktop application for turning long-form video or audio recordings into high-impact, vertical short-form clip candidates (9:16 portrait) with AI-powered viral moment ranking.

Rust

Merge main into youtube-importer and resolve merge conflicts

Jethro Adamu8212f16f9bd2
diff --cc src-tauri/src/lib.rs
index fd61bb5,fad9cc7..948ddb2
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@@ -953,31 -918,6 +996,7 @@@ fn build_drawtext_filters
let fontsize = ((cropped_width as f64) * 0.075).clamp(16.0, 80.0).round() as i64;
let padding = ((fontsize as f64) * 0.3).clamp(4.0, 24.0).round() as i64;
- // Premium system font hierarchy
- let font_paths = [
- // macOS
- "/System/Library/Fonts/Supplemental/Futura.ttc",
- "/System/Library/Fonts/Avenir Next.ttc",
- "/System/Library/Fonts/Supplemental/Arial Bold.ttf",
- "/System/Library/Fonts/Helvetica.ttc",
- // Windows
- "C:/Windows/Fonts/SegoeUIb.ttf",
- "C:/Windows/Fonts/arialbd.ttf",
- "C:/Windows/Fonts/arial.ttf",
- // Linux
- "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf",
- "/usr/share/fonts/truetype/freefont/FreeSansBold.ttf",
- ];
- let mut font_option = String::new();
- for path in &font_paths {
- if std::path::Path::new(path).exists() {
- // Windows FFmpeg requires a single backslash to escape the colon even inside single quotes
- let clean_path = path.replace('\\', "/").replace(':', "\\:");
- font_option = format!("fontfile='{}':", clean_path);
- break;
- }
- }
-
++
let drawtext = match caption_style {
"classic-outline" => {
// Classic yellow text with a bold outline (CapCut style)
diff --cc src-tauri/src/llm.rs
index ca981ba,56f7f9b..990072a
--- a/src-tauri/src/llm.rs
+++ b/src-tauri/src/llm.rs
@@@ -36,18 -37,21 +37,25 @@@ pub async fn detect_candidates_with_dee
) -> Result<Vec<CandidateDraft>> {
let segments = compact_segments(&transcript.segments);
let prompt = format!(
- "You are identifying the most viral moments and strongest short-form clip candidates from a long-form transcript. \
-For each candidate, the clip must be self-contained, starting with an extremely engaging hook within the first 3 seconds (to capture immediate attention on social feeds), \
-30-90 seconds long, and cut at clean sentence/thought boundaries. Favor highly shareable content: concrete stories, \
-strong opinions, emotional turns, surprising or counter-intuitive claims, clear payoffs, and high-energy/dramatic peaks. \
-Avoid rambling setup, context-dependent references, and pure filler. Return up to 10 candidates as JSON matching this schema: \
-{{\"candidates\":[{{\"start\":0.0,\"end\":0.0,\"score\":0.0,\"hook\":\"...\",\"rationale\":\"...\"}}]}}\n\nTranscript:\n{segments}"
+ "You are an elite, world-class social media strategist with a track record of generating viral multi-million-view Shorts, TikToks, and Reels. \
+Your sole objective is to identify the ABSOLUTE BEST, most highly-engaging, and trend-setting short-form clip candidates from the provided transcript. \
+Do NOT pick random or mediocre segments. Be ruthless in your selection, but extract AS MANY highly viral moments as possible. \
+Every candidate must have an insanely strong, curiosity-inducing hook in the first 3 seconds to stop the scroll. \
+Clips should be 30-90 seconds long, completely self-contained, cut at clean boundaries, and deliver a massive payoff (a mind-blowing fact, hilarious joke, highly controversial opinion, or deep emotional insight). \
+Return up to 25 candidates as JSON matching exactly this schema: \
+{{\"candidates\":[{{\"start\":0.0,\"end\":0.0,\"score\":0.0,\"hook\":\"...\",\"rationale\":\"...\"}}]}}
+
+Transcript:
+{segments}"
);
+ let default_model = "deepseek-chat".to_string();
+ let model = model_name
+ .filter(|m| !m.trim().is_empty())
+ .map(|m| m.trim().to_string())
+ .or_else(|| std::env::var("DEEPSEEK_MODEL").ok().filter(|m| !m.trim().is_empty()))
+ .unwrap_or(default_model);
+
let response = reqwest::Client::new()
.post("https://api.deepseek.com/chat/completions")
.header("Authorization", format!("Bearer {api_key}"))
@@@ -259,20 -256,20 +268,24 @@@ pub async fn detect_candidates_with_ope
) -> Result<Vec<CandidateDraft>> {
let segments = compact_segments(&transcript.segments);
let prompt = format!(
- "You are identifying the most viral moments and strongest short-form clip candidates from a long-form transcript. \
-For each candidate, the clip must be self-contained, starting with an extremely engaging hook within the first 3 seconds (to capture immediate attention on social feeds), \
-30-90 seconds long, and cut at clean sentence/thought boundaries. Favor highly shareable content: concrete stories, \
-strong opinions, emotional turns, surprising or counter-intuitive claims, clear payoffs, and high-energy/dramatic peaks. \
-Avoid rambling setup, context-dependent references, and pure filler. Return up to 10 candidates as JSON matching this schema: \
-{{\"candidates\":[{{\"start\":0.0,\"end\":0.0,\"score\":0.0,\"hook\":\"...\",\"rationale\":\"...\"}}]}}\n\nTranscript:\n{segments}"
+ "You are an elite, world-class social media strategist with a track record of generating viral multi-million-view Shorts, TikToks, and Reels. \
+Your sole objective is to identify the ABSOLUTE BEST, most highly-engaging, and trend-setting short-form clip candidates from the provided transcript. \
+Do NOT pick random or mediocre segments. Be ruthless in your selection, but extract AS MANY highly viral moments as possible. \
+Every candidate must have an insanely strong, curiosity-inducing hook in the first 3 seconds to stop the scroll. \
+Clips should be 30-90 seconds long, completely self-contained, cut at clean boundaries, and deliver a massive payoff (a mind-blowing fact, hilarious joke, highly controversial opinion, or deep emotional insight). \
+Return up to 25 candidates as JSON matching exactly this schema: \
+{{\"candidates\":[{{\"start\":0.0,\"end\":0.0,\"score\":0.0,\"hook\":\"...\",\"rationale\":\"...\"}}]}}
+
+Transcript:
+{segments}"
);
- let model =
- std::env::var("OPENROUTER_MODEL").unwrap_or_else(|_| "google/gemini-2.5-flash".to_string());
+ let default_model = "google/gemini-2.5-flash".to_string();
+ let model = model_name
+ .filter(|m| !m.trim().is_empty())
+ .map(|m| m.trim().to_string())
+ .or_else(|| std::env::var("OPENROUTER_MODEL").ok().filter(|m| !m.trim().is_empty()))
+ .unwrap_or(default_model);
let response = reqwest::Client::new()
.post("https://openrouter.ai/api/v1/chat/completions")
diff --cc src/main.tsx
index 31d3ff5,5eb93bb..10ed429
--- a/src/main.tsx
+++ b/src/main.tsx
@@@ -161,9 -155,9 +164,12 @@@ function App()
const [openrouterKey, setOpenrouterKey] = useState(() => {
return localStorage.getItem("autoshorts_openrouter_key") || "";
});
+ const [groqKey, setGroqKey] = useState(() => {
+ return localStorage.getItem("autoshorts_groq_key") || "";
+ });
+ const [openrouterModel, setOpenrouterModel] = useState(() => {
+ return localStorage.getItem("autoshorts_openrouter_model") || "";
+ });
const [downloadingModelName, setDownloadingModelName] = useState<string | null>(null);
const [modelDownloadStatus, setModelDownloadStatus] = useState("");
@@@ -265,10 -258,10 +275,14 @@@
localStorage.setItem("autoshorts_openrouter_key", openrouterKey);
}, [openrouterKey]);
+ useEffect(() => {
+ localStorage.setItem("autoshorts_groq_key", groqKey);
+ }, [groqKey]);
+
+ useEffect(() => {
+ localStorage.setItem("autoshorts_openrouter_model", openrouterModel);
+ }, [openrouterModel]);
+
const pullModelDirectly = async (modelName: string) => {
setDownloadingModelName(modelName);
setModelDownloadProgress(0);
@@@ -823,27 -775,27 +848,38 @@@
</label>
)}
{llmEngine === "openrouter" && (
- <label>
- <span>OpenRouter API Key</span>
- <input
- value={openrouterKey}
- onChange={(event) => setOpenrouterKey(event.target.value)}
- placeholder={environment?.hasOpenrouterKey ? "Loaded from env" : "Optional (OpenRouter API Key)"}
- type="password"
- />
- </label>
+ <>
+ <label>
+ <span>OpenRouter API Key</span>
+ <input
+ value={openrouterKey}
+ onChange={(event) => setOpenrouterKey(event.target.value)}
+ placeholder={environment?.hasOpenrouterKey ? "Loaded from env" : "Optional (OpenRouter API Key)"}
+ type="password"
+ />
+ </label>
+ <label>
+ <span>OpenRouter Model</span>
+ <input
+ value={openrouterModel}
+ onChange={(event) => setOpenrouterModel(event.target.value)}
+ placeholder="Optional (e.g. google/gemini-2.5-flash, deepseek/deepseek-r1)"
+ type="text"
+ />
+ </label>
+ </>
)}
+ {llmEngine === "groq" && (
+ <label>
+ <span>Groq API Key</span>
+ <input
+ value={groqKey}
+ onChange={(event) => setGroqKey(event.target.value)}
+ placeholder={environment?.hasGroqKey ? "Loaded from env" : "Optional (Groq API Key)"}
+ type="password"
+ />
+ </label>
+ )}
{llmEngine === "local" && (
<label>