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
feat: update prompt for higher-engagement clip selection and add automatic 9:16 portrait cropping to ffmpeg rendering
JayWebtech3b6168134742
diff --git a/src-tauri/src/llm.rs b/src-tauri/src/llm.rsindex 0b5e361..2bb6070 100644--- a/src-tauri/src/llm.rs+++ b/src-tauri/src/llm.rs@@ -31,11 +31,11 @@ pub async fn detect_candidates_with_claude() -> Result<Vec<CandidateDraft>> {let segments = compact_segments(&transcript.segments);let prompt = format!(- "You are identifying the strongest short-form clip candidates from a long-form transcript. \-For each candidate, the clip must be self-contained, hook-driven within the first 3 seconds, \-30-90 seconds long, and cut at clean sentence/thought boundaries. Favor concrete stories, \-strong opinions, emotional turns, surprising claims, clear payoffs, and audience reactions. \-Avoid rambling setup, context dependence, and pure filler. Return up to 10 candidates as JSON only: \+ "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 only: \{{\"candidates\":[{{\"start\":0,\"end\":0,\"score\":0.0,\"hook\":\"...\",\"rationale\":\"...\"}}]}}\n\nTranscript:\n{segments}");diff --git a/src-tauri/src/media.rs b/src-tauri/src/media.rsindex 0c0b993..2393efb 100644--- a/src-tauri/src/media.rs+++ b/src-tauri/src/media.rs@@ -117,13 +117,28 @@ pub fn render_flat_clip(let start = format!("{start_sec:.3}");let end = format!("{end_sec:.3}");- let output = Command::new("ffmpeg")- .args(["-y", "-i", source_path, "-ss", &start, "-to", &end])- .args(["-c:v", "libx264", "-preset", "fast", "-crf", "18"])- .args(["-c:a", "aac", "-b:a", "192k"])- .arg(output_path)- .output()- .context("running ffmpeg clip render")?;++ let probe = probe_media(source_path).ok();+ let has_video = probe.map(|p| p.has_video).unwrap_or(false);++ let mut cmd = Command::new("ffmpeg");+ cmd.args(["-y", "-i", source_path, "-ss", &start, "-to", &end]);++ if has_video {+ // Crop video to 9:16 portrait/vertical format while ensuring dimensions are even+ cmd.args([+ "-vf",+ "crop=w='2*trunc(min(iw,ih*9/16)/2)':h='2*trunc(min(ih,iw*16/9)/2)'",+ ]);+ cmd.args(["-c:v", "libx264", "-preset", "fast", "-crf", "18", "-pix_fmt", "yuv420p"]);+ } else {+ cmd.arg("-vn");+ }++ cmd.args(["-c:a", "aac", "-b:a", "192k"]);+ cmd.arg(output_path);++ let output = cmd.output().context("running ffmpeg clip render")?;if !output.status.success() {return Err(anyhow!(