Add fit-to-size two-pass encoding, file argument, recipes, and batch mode

- Fit to size: computes H.264 bitrate from duration and runs a
  two-pass encode to land on a target size in MB
- lazyff FILE opens straight in the editor
- Recipes: save/load named edit stacks (~/.config/lazyff/recipes.json)
- Batch: mark files with Space, run one edit stack across all of them
  through a sequential job queue with per-file results
This commit is contained in:
2026-06-11 11:55:55 +01:00
parent d9cb0231d1
commit 16acb43daf
8 changed files with 850 additions and 167 deletions
+19 -5
View File
@@ -1,6 +1,7 @@
mod app;
mod ffmpeg;
mod ops;
mod recipes;
mod ui;
use std::process::Command;
@@ -13,17 +14,27 @@ use ratatui::DefaultTerminal;
use app::App;
fn main() -> Result<()> {
let mut initial: Option<std::path::PathBuf> = None;
if let Some(arg) = std::env::args().nth(1) {
match arg.as_str() {
"--version" | "-V" => {
println!("lazyff {}", env!("CARGO_PKG_VERSION"));
return Ok(());
}
_ => {
"--help" | "-h" => {
println!("lazyff {} — a friendly TUI for FFmpeg", env!("CARGO_PKG_VERSION"));
println!("Usage: lazyff (opens a file browser in the current directory)");
println!("Usage: lazyff [FILE]");
println!(" no argument open a file browser in the current directory");
println!(" FILE open this video/audio file straight in the editor");
return Ok(());
}
_ => {
let path = std::path::PathBuf::from(&arg);
if !path.is_file() {
bail!("{arg}: no such file");
}
initial = Some(path);
}
}
}
@@ -33,14 +44,17 @@ fn main() -> Result<()> {
}
}
// Probe the initial file before entering the alternate screen so errors
// print normally.
let app = App::new(initial)?;
let mut terminal = ratatui::init();
let result = run(&mut terminal);
let result = run(&mut terminal, app);
ratatui::restore();
result
}
fn run(terminal: &mut DefaultTerminal) -> Result<()> {
let mut app = App::new()?;
fn run(terminal: &mut DefaultTerminal, mut app: App) -> Result<()> {
loop {
app.poll_run_messages();
terminal.draw(|f| ui::draw(f, &mut app))?;