{"record":{"id":"8571bf9bd1db3557","repo":"NickeManarin/ScreenToGif","slug":"ffmpeg-not-present","errorCode":null,"errorMessage":"FFmpeg not present.","messagePattern":"FFmpeg not present\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"ScreenToGif/Util/EncodingManager.cs","lineNumber":1405,"sourceCode":"        };\n\n        await using var stream = File.Create(preset.FullPath, Constants.BufferSize);\n        await KGySoftGifEncoder.EncodeAnimationAsync(config, stream, new TaskConfig\n        {\n            CancellationToken = cancellationToken,\n            ThrowIfCanceled = false\n        });\n\n        if (!cancellationToken.IsCancellationRequested)\n            await stream.FlushAsync(cancellationToken);\n    }\n\n    private static async Task EncodeWithFfmpeg(ExportPreset preset, List<IFrame> listFrames, int id, CancellationTokenSource tokenSource, string processing)\n    {\n        Update(id, EncodingStatus.Processing, null, true);\n\n        if (!await PathHelper.IsFfmpegPresent())\n            throw new ApplicationException(\"FFmpeg not present.\");\n\n        if (File.Exists(preset.FullPath))\n            File.Delete(preset.FullPath);\n\n        #region Generate concat\n\n        var concat = new StringBuilder();\n        foreach (var frame in listFrames)\n        {\n            concat.AppendLine(\"file '\" + frame.Path + \"'\");\n            concat.AppendLine(\"duration \" + (frame.Delay / 1000d).ToString(CultureInfo.InvariantCulture));\n        }\n\n        if (preset.Type is not ExportFormats.Gif or ExportFormats.Apng or ExportFormats.Webp or ExportFormats.Avif)\n        {\n            //Fix for last frame.\n            concat.AppendLine(\"file '\" + listFrames.LastOrDefault()?.Path + \"'\");\n            concat.AppendLine(\"duration 0\");","sourceCodeStart":1387,"sourceCodeEnd":1423,"githubUrl":"https://github.com/NickeManarin/ScreenToGif/blob/a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd/ScreenToGif/Util/EncodingManager.cs#L1387-L1423","documentation":"EncodeWithFfmpeg throws ApplicationException when PathHelper.IsFfmpegPresent() returns false. The check inspects UserSettings.All.FfmpegLocation, the app folder, %ProgramData%\\ScreenToGif\\ffmpeg.exe, and PATH for ffmpeg.exe; it also calls CheckFfmpegVersion on any candidate. Encoding never starts if no ffmpeg binary resolves.","triggerScenarios":"Export uses FFmpeg (most video/gif types) but ffmpeg.exe is missing from the configured location, the app folder, %ProgramData%\\ScreenToGif\\, and the system PATH.","commonSituations":"Fresh install without ffmpeg downloaded; user declined the ffmpeg download prompt; ffmpeg.exe deleted by AV or user; FfmpegLocation setting points to a moved file; portable build on a clean machine without PATH; CheckFfmpegVersion crashed silently leaving the binary unset.","solutions":["Use Options > Extras to download ffmpeg.exe into %ProgramData%\\ScreenToGif\\, or set FfmpegLocation manually.","Place ffmpeg.exe next to ScreenToGif.exe or add its folder to PATH.","Allow the ffmpeg through antivirus / restore from quarantine.","Re-verify with await PathHelper.IsFfmpegPresent() in the export panel before enabling FFmpeg-based encoders."],"exampleFix":"// before\nif (!await PathHelper.IsFfmpegPresent())\n    throw new ApplicationException(\"FFmpeg not present.\");\n\n// after\nif (!await PathHelper.IsFfmpegPresent())\n    throw new ApplicationException(\"FFmpeg not present. Download it via Options > Extras or set the FFmpeg path in Options.\");","handlingStrategy":"validation","validationCode":"if (!await PathHelper.IsFfmpegPresent())\n{\n    // disable FFmpeg-based encoders in the UI and offer download\n}","typeGuard":"bool CanUseFfmpegEncoder => PathHelper.IsFfmpegPresent().GetAwaiter().GetResult();","tryCatchPattern":"try { await EncodeWithFfmpeg(...); }\ncatch (ApplicationException ex) when (ex.Message == \"FFmpeg not present.\")\n{ /* open Options > Extras to download ffmpeg */ }","preventionTips":["Gate FFmpeg encoders behind IsFfmpegPresent() in the export panel.","On first run, prompt to download ffmpeg into %ProgramData%\\ScreenToGif\\.","Persist FfmpegLocation and re-validate after app updates."],"tags":["ffmpeg","encoding","native-dependency","missing-binary"],"backgroundTag":null,"analyzedSha":"a4d0a67c2131cd048ceec86cd40afc2f1a06f2fd","analyzedAt":"2026-08-13T11:12:06.147Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}