{"record":{"id":"a4954f117ebfaae6","repo":"stride3d/stride","slug":"could-not-find-stream-info","errorCode":null,"errorMessage":"Could not find stream info.","messagePattern":"Could not find stream info\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Video/FFmpeg/FFmpegMedia.cs","lineNumber":145,"sourceCode":"\n            if (startPosition != 0 && length != -1)\n                url = $@\"subfile,,start,{startPosition},end,{startPosition + length},,:{url}\";\n\n            var pFormatContext = ffmpeg.avformat_alloc_context();\n            var ret = ffmpeg.avformat_open_input(&pFormatContext, url, null, null);\n            if (ret < 0)\n            {\n                Logger.Error($\"Could not open file. Error code={ret.ToString(\"X8\")}\");\n                Logger.Error(GetErrorMessage(ret));\n                throw new ApplicationException(@\"Could not open file.\");\n            }\n\n            ret = ffmpeg.avformat_find_stream_info(pFormatContext, null);\n            if (ret < 0)\n            {\n                Logger.Error($\"Could not find stream info. Error code={ret.ToString(\"X8\")}\");\n                Logger.Error(GetErrorMessage(ret));\n                throw new ApplicationException(@\"Could not find stream info.\");\n            }\n\n            AVFormatContext = pFormatContext;\n            Duration = TimeSpan.FromSeconds((double)AVFormatContext->duration / ffmpeg.AV_TIME_BASE);\n            Url = url;\n\n            // Get the streams\n            for (int i = 0; i < pFormatContext->nb_streams; i++)\n            {\n                var stream = FFmpegStream.Create(pFormatContext->streams[i], this);\n                streams.Add(stream);\n            }\n\n            pDecodedFrame = ffmpeg.av_frame_alloc();\n            if (pDecodedFrame == null)\n                throw new ApplicationException(\"Couldn't allocate a frame for decoding.\");\n\n            pCpuCopyFrame = ffmpeg.av_frame_alloc();","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Video/FFmpeg/FFmpegMedia.cs#L127-L163","documentation":"FFmpegMedia.Open throws this ApplicationException when ffmpeg.avformat_find_stream_info returns a negative code, i.e. the container was opened but FFmpeg could not determine stream information (codecs, durations, parameters). Hex code and av_strerror details are logged before the throw.","triggerScenarios":"Calling Open on a file whose container opens successfully but whose streams cannot be probed: truncated/corrupt files, missing codecs in the FFmpeg build, network streams that time out during probing, or headers without enough metadata.","commonSituations":"Partially downloaded or corrupted media files; exotic codecs not compiled into the bundled FFmpeg binaries; slow/unreliable network streams exceeding FFmpeg's probe limits; streams with missing or wrong codec extradata.","solutions":["Inspect the logged hex error code and av_strerror message for the precise cause.","Verify the file plays in ffprobe/ffmpeg to rule out corruption or unsupported codecs.","For network streams, increase probe limits (probesize/analyzeduration) or check network availability.","Use a complete FFmpeg build that includes decoders for the stream's codecs."],"exampleFix":"// before\nformatContext->probesize = 5000; // too small, stream info probing fails\n// after\nformatContext->probesize = 5000000;\nformatContext->max_analyze_duration = 10 * ffmpeg.AV_TIME_BASE;\nret = ffmpeg.avformat_find_stream_info(pFormatContext, null);","handlingStrategy":"retry","validationCode":"// pre-check with ffprobe-style metadata or ensure the file size is complete\nvar fi = new FileInfo(path);\nif (fi.Length == 0 || !downloadComplete) throw new InvalidDataException(\"Incomplete media file\");","typeGuard":null,"tryCatchPattern":"try\n{\n    media.Open(url, startPosition, length);\n}\ncatch (ApplicationException ex) when (ex.Message == \"Could not find stream info.\")\n{\n    // check logs for hex code; retry once or mark media as unsupported/corrupt\n}","preventionTips":["Validate media files are fully downloaded/copy-complete before playback.","Bundle an FFmpeg build covering all codecs your content uses.","Raise probesize/max_analyze_duration for network streams.","Test content with ffprobe during asset ingestion to catch corrupt files early."],"tags":["ffmpeg","media-loading","stream-info"],"backgroundTag":"unexpected-response-shape","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}