stride3d/stride · error · InvalidOperationException

No video track found in

Error message

No video track found in {url}

What it means

Thrown by MediaCodecVideoBackend.ProbeVideoDimensions after it probed the stream with FFmpeg and found no video stream track in the container. Initialization therefore cannot determine the video dimensions, so it aborts with this error naming the URL.

Solutions

  1. Verify the URL/file actually contains a video stream (e.g. ffprobe -show_streams)
  2. Check the application's media selection logic — an audio asset may have been passed by mistake
  3. Inspect the file for corruption or truncation; re-encode or re-download the asset
  4. Catch InvalidOperationException and fall back to an audio-only playback path

Example fix

// before
videoBackend.Initialize(audioOnlyFilePath); // throws: no video track
// after
if (MediaProbe.HasVideoTrack(audioOnlyFilePath))
    videoBackend.Initialize(audioOnlyFilePath);
else
    InitializeAsAudioOnly(audioOnlyFilePath);
Defensive patterns

Strategy: validation

Validate before calling

bool hasVideo = MediaProbe.EnumerateStreams(url).Any(s => s.MediaType == AVMediaType.AVMEDIA_TYPE_VIDEO);
if (!hasVideo)
{
    Logger.Warning($"{url} has no video track");
    return;
}

Try / catch

try
{
    videoBackend.Initialize(url);
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith("No video track found"))
{
    HandleAudioOnlyAsset(url, ex);
}

Prevention

When it happens

Trigger: Calling Initialize on a media URL whose container has only audio streams (e.g. an .mp3 or audio-only .mp4), a corrupted/empty file that yields no decodable video stream, or a URL whose demuxer opens but exposes zero video streams.

Common situations: Passing an audio file path where a video was expected; a live/fragmented stream whose video track appears later; files truncated so the video track header is missing; typos pointing at the wrong asset.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/fb6741371786873f. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Video/Backends/MediaCodecVideoBackend.cs:316

    {
        using var file = new Java.IO.FileInputStream(url);
        var probe = new MediaExtractor();
        try
        {
            probe.SetDataSource(file.FD, startPosition, length);
            for (int i = 0; i < probe.TrackCount; i++)
            {
                var format = probe.GetTrackFormat(i);
                var mime = format.GetString(MediaFormat.KeyMime);
                if (mime != null && mime.StartsWith("video/"))
                    return (format.GetInteger(MediaFormat.KeyWidth), format.GetInteger(MediaFormat.KeyHeight));
            }
        }
        finally
        {
            probe.Release();
        }
        throw new InvalidOperationException($"No video track found in {url}");
    }
}
#endif

View on GitHub (pinned to 96fad776d2)