tonhowtf/omniget · error
ffmpeg
Error message
ffmpeg: {} What it means
extract_audio runs ffmpeg as a child process to pull the audio track out of a downloaded Instagram media file. When ffmpeg exits with a nonzero status the library wraps ffmpeg's trimmed stderr into this anyhow error, so the actual diagnostic text comes straight from ffmpeg.
Solutions
- Read the ffmpeg message after 'ffmpeg: ' — it names the real problem
- Ensure the source file downloaded completely and contains an audio stream (ffprobe it)
- Match the output file extension/codec to a supported one
- Check that the installed ffmpeg version supports the required demuxers/codecs
Example fix
// before ffmpeg -i clip.mp4 -vn -acodec aac out.m4a // after (input may have no audio; probe first) ffprobe -v error -select_streams a -show_entries stream=codec_type clip.mp4 && ffmpeg -i clip.mp4 -vn -acodec aac out.m4a
Defensive patterns
Strategy: try-catch
Validate before calling
let ok = Command::new("ffprobe")
.args(["-v", "error", "-select_streams", "a:0", "-show_entries",
"stream=codec_type", "-of", "csv=p=0", input])
.output()
.await?
.stdout
.starts_with(b"audio");
if !ok { bail!("arquivo não tem faixa de áudio"); } Try / catch
match extract_audio(&file, &out).await {
Ok(audio) => use_audio(audio),
Err(e) if e.to_string().starts_with("ffmpeg:") => {
let ffmpeg_msg = e.to_string().trim_start_matches("ffmpeg: ").to_string();
log::warn!("ffmpeg falhou: {ffmpeg_msg}");
}
Err(e) => return Err(e),
} Prevention
- Verify the downloaded media contains an audio stream before extracting
- Check the download completed (file size/hash) before invoking ffmpeg
- Keep a recent ffmpeg build with common codecs; log full stderr for diagnosis
When it happens
Trigger: Calling extract_audio (via download_items) when ffmpeg exits nonzero: the input file has no audio stream, the file is corrupt or incomplete, the output path/codec combination is invalid, or the ffmpeg binary build lacks needed codecs.
Common situations: Instagram item is a video with no audio track; download was truncated by a network failure; output extension disagrees with the chosen codec; ffmpeg missing optional encoder.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/aa3e862279e86371.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/instagram/media.rs:305
let out = video.with_extension(format);
let mut cmd = crate::core::process::command(&ffmpeg);
cmd.args(["-y", "-hide_banner", "-loglevel", "error", "-i"])
.arg(video)
.arg("-vn");
if format == "mp3" {
cmd.args(["-c:a", "libmp3lame", "-q:a", "2"]);
} else {
cmd.args(["-c:a", "copy"]);
}
cmd.arg(&out);
let status = cmd
.stdin(std::process::Stdio::null())
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::piped())
.output()
.await?;
if !status.status.success() {
return Err(anyhow!(
"ffmpeg: {}",
String::from_utf8_lossy(&status.stderr).trim()
));
}
Ok(out)
}
/// Baixa uma lista de itens para `dest`, reportando `ig:<job>` com
/// done/total e o nome do arquivo atual.
pub async fn download_items(
client: &IgClient,
items: &[MediaItem],
dest: &str,
opts: &DownloadOptions,
progress: &super::super::ProgressFn,
job: &str,
flag: &AtomicBool,
) -> anyhow::Result<DownloadResult> {View on GitHub (pinned to 8600b91f42)