{"record":{"id":"aa3e862279e86371","repo":"tonhowtf/omniget","slug":"ffmpeg-media","errorCode":null,"errorMessage":"ffmpeg: {}","messagePattern":"ffmpeg: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/instagram/media.rs","lineNumber":305,"sourceCode":"    let out = video.with_extension(format);\n    let mut cmd = crate::core::process::command(&ffmpeg);\n    cmd.args([\"-y\", \"-hide_banner\", \"-loglevel\", \"error\", \"-i\"])\n        .arg(video)\n        .arg(\"-vn\");\n    if format == \"mp3\" {\n        cmd.args([\"-c:a\", \"libmp3lame\", \"-q:a\", \"2\"]);\n    } else {\n        cmd.args([\"-c:a\", \"copy\"]);\n    }\n    cmd.arg(&out);\n    let status = cmd\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::null())\n        .stderr(std::process::Stdio::piped())\n        .output()\n        .await?;\n    if !status.status.success() {\n        return Err(anyhow!(\n            \"ffmpeg: {}\",\n            String::from_utf8_lossy(&status.stderr).trim()\n        ));\n    }\n    Ok(out)\n}\n\n/// Baixa uma lista de itens para `dest`, reportando `ig:<job>` com\n/// done/total e o nome do arquivo atual.\npub async fn download_items(\n    client: &IgClient,\n    items: &[MediaItem],\n    dest: &str,\n    opts: &DownloadOptions,\n    progress: &super::super::ProgressFn,\n    job: &str,\n    flag: &AtomicBool,\n) -> anyhow::Result<DownloadResult> {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/instagram/media.rs#L287-L323","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nffmpeg -i clip.mp4 -vn -acodec aac out.m4a\n// after (input may have no audio; probe first)\nffprobe -v error -select_streams a -show_entries stream=codec_type clip.mp4 && ffmpeg -i clip.mp4 -vn -acodec aac out.m4a","handlingStrategy":"try-catch","validationCode":"let ok = Command::new(\"ffprobe\")\n    .args([\"-v\", \"error\", \"-select_streams\", \"a:0\", \"-show_entries\",\n           \"stream=codec_type\", \"-of\", \"csv=p=0\", input])\n    .output()\n    .await?\n    .stdout\n    .starts_with(b\"audio\");\nif !ok { bail!(\"arquivo não tem faixa de áudio\"); }","typeGuard":null,"tryCatchPattern":"match extract_audio(&file, &out).await {\n    Ok(audio) => use_audio(audio),\n    Err(e) if e.to_string().starts_with(\"ffmpeg:\") => {\n        let ffmpeg_msg = e.to_string().trim_start_matches(\"ffmpeg: \").to_string();\n        log::warn!(\"ffmpeg falhou: {ffmpeg_msg}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["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"],"tags":["rust","ffmpeg","subprocess","audio-extraction"],"backgroundTag":"command-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}