Tauri + FFprobe
This is on how to setup FFprobe for tauri

You will need a Tauri and Rust installed obviously
- Add the ffprobe dependency by running:
cargo add ffprobe
- Add custom convertion to your rust file
fn to_json<T: serde::Serialize>(data: T) -> Result<String, serde_json::Error> {
serde_json::to_string(&data)
}
- Add a tauri command:
#[tauri::command]
fn ffprobe(path: String) -> Result<String, ()> {
println!("path: {:?}", path);
// Open the input file
let ictx = match ffprobe::ffprobe(&path) {
Ok(ictx) => ictx,
Err(e) => {
eprintln!("ffprobe error: {}", e);
return Err(());
},
};
let output = to_json(ictx).unwrap();
Ok(output)
}
- Add the command to the invoke_handler in the main function
- Test the command:
import { invoke } from "@tauri-apps/api/core";
invoke("ffprobe", { path: p?.path }).then((result) => {
console.log("ffprobe: ", result);
}).catch((error) => {
console.error("FFProbe error: ", error)
})
Understanding the output
Streams
This list the media that is embed into the file
Format
Shows the encoding, size, duration and tags
