Skip to content

Fix to silent & generic errors when loading videos with unsupported codecs#73

Open
shoyguer wants to merge 1 commit intoEIRTeam:masterfrom
shoyguer:fix/decoder-not-found-fallback
Open

Fix to silent & generic errors when loading videos with unsupported codecs#73
shoyguer wants to merge 1 commit intoEIRTeam:masterfrom
shoyguer:fix/decoder-not-found-fallback

Conversation

@shoyguer
Copy link

@shoyguer shoyguer commented Mar 3, 2026

Currently when av_find_best_stream returns AVERROR_DECODER_NOT_FOUND, the container is parsed and the stream exists. The codec is just not registered in this FFmpeg build.

The old code treated this the same as a missing stream. It fell through to "Couldn't find video stream: Decoder not found", with no hint about which codec is the problem. The playback object returned null and VideoStreamPlayer failed silently.

Changes

  • Adds a dedicated AVERROR_DECODER_NOT_FOUND handler in prepare_decoding(). It re-probes ignoring decoder availability, names the codec, and tries a named fallback before failing.
  • Renames _codec_id_to_libvpx to _codec_id_to_preferred_decoder_name since the function now covers more than VP8/VP9.
  • Extends the fallback table with AV_CODEC_ID_HEVC ("hevc") and AV_CODEC_ID_AV1 ("libaom-av1"). If a future build includes those decoders, the plugin picks them up with no code change.
  • The error now names the codec instead of giving a generic message.

Before

These is how errors were shown, for reference:

Couldn't find video stream: Decoder not found
Plugin returned null playback

After (unsupported codec, no fallback available)

Example to how errors are shown now:

No decoder found for 'hevc': codec not supported by this FFmpeg build.

After (supported named decoder found)

No default decoder for 'vp9', retrying with 'libvpx-vp9'.

With these changes, now my .mp4 videos that were NOT being played.
I used this export properties on Davinci Resolve
image

Info about the videos after Davinci:
video.txt

Info about the videos after I used Handbrake to compress them further:
videohb.txt
(all information taken from MediaInfo).

I was getting these errors before:

E 0:00:07:010   scene_loader.gd:184 @ _fade_in(): Couldn't find video stream: Decoder not found
  <C++ Error>   Condition "stream_index < 0" is true.
  <C++ Source>  D:\a\EIRTeam.FFmpeg\EIRTeam.FFmpeg\video_decoder.cpp:127 @ VideoDecoder::prepare_decoding()
  <Stack Trace> scene_loader.gd:184 @ _fade_in()
                scene_loader.gd:319 @ load_scene()
                intro.gd:45 @ <anonymous lambda>()


E 0:00:07:010   scene_loader.gd:184 @ _fade_in(): Plugin returned null playback
  <C++ Error>   Condition "ret.is_null()" is true. Returning: nullptr
  <C++ Source>  scene/resources/video_stream.cpp:161 @ instantiate_playback()
  <Stack Trace> scene_loader.gd:184 @ _fade_in()
                scene_loader.gd:319 @ load_scene()
                intro.gd:45 @ <anonymous lambda>()

Now everything runs perfectly, with the same videos.

Hope it helps, as it helped me. If you find ANY issues, please let me know, so I can fix them ASAP.
Thanks for your time and for this amazing plugin!
😄

@shoyguer shoyguer changed the title Fix to silent error and generic error when loading videos with unsupported codecs Fix to silent & generic errors when loading videos with unsupported codecs Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant