Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaComposition GetThumbnailsAsync returns the first thumbnail regardless of the provided timestamps. #5049

Open
ianeuman opened this issue Jan 17, 2025 · 15 comments
Labels
area-External area-Media Support for media playback or encoding

Comments

@ianeuman
Copy link

Describe the bug

When using the GetThumbnailsAsync method inside the MediaComposition class, all the thumbnails returned are the same as the first thumbnail regardless of the timestamps provided to generate the thumbnails.

Steps to reproduce the bug

  1. Clone this github repository. https://github.com/ianeuman/winappsdk-thumbnail
  2. Build and run the solution.
  3. All the frames are the same regardless of the specified timestamps.

Expected behavior

The frames returned are different, representing each provided timestamp.

Screenshots

No response

NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

Packaging type

Unpackaged

Windows version

Windows 11 version 23H2 (22631, November 2023 Update)

IDE

Visual Studio 2022

Additional context

The current workaround is to manually call GetThumbnailAsync for each timestamp, but that's around 4-5 times slower.

@castorix
Copy link

castorix commented Jan 17, 2025

I tested on Windows 10 22H2, Windows App SDK 1.6.241114003, with a random .MP4 and it works fine, all thumbnails are correctly extracted :
Some frames :

Image

@ianeuman
Copy link
Author

ianeuman commented Jan 18, 2025

I tried using the same version 1.6.241114003 yet it's not working for me, I'm curious if it's an issue related to a recent windows version update.

For reference:

Image

@castorix
Copy link

I tested with this MP4 : sample_1280x720_surfing_with_audio.mp4
from https://filesamples.com/formats/mp4 (on Windows 10 vs Windows 11 as you wrote)

@DarranRowe
Copy link

Win11 24H2 shows no issues too.

Image

I wonder if the encoding is the issue. What is the encoding of the file? H264? HEVC? AV1? What is the container? MP4? MKV? Something else?

@ianeuman
Copy link
Author

The other videos that I'm using are all h264 encoded in an mp4 container, tried the sample wave sample .mp4 and I get the same error:

Image

Running it again but starting at 00:01 just so that it's more visible and not only a black screen:

Image

Tried running it in a separate windows machine on Win11 22H2 using build 22621.4836 produces the same results.

@whiskhub
Copy link

What kind of GPU (brand) do you have? Maybe the GPU decoder isn't working properly.

@kmgallahan
Copy link

Try using VideoFramePrecision.NearestKeyFrame just as a test, not a solution.

@ianeuman
Copy link
Author

Thanks for everyone's help/input, really appreciate the quick responses!

Machine 1: Nvidia RTX 4080 super
Machine 2: Nvidia RTX 2080 super

Tried the waves video using VideoFramePrecision.NearestKeyFrame and the only difference in the output is which is the frame that gets written to disk.

Image

@ianeuman
Copy link
Author

I'll try updating to a newer version of the drivers to see if that changes the behavior.

@DarranRowe
Copy link

DarranRowe commented Jan 21, 2025

Image

This was from capturing a game using H264 in the MP4 container using OBS. But I am using an AMD 7800XT using the latest drivers.

@whiskhub
Copy link

Just tried it on my machine, I see the same buggy behavior as you do with identical images. I also have a NVIDIA GPU.
Pretty sure it is a problem in the NVIDIA H.264 Media Foundation decoder then.

@ianeuman
Copy link
Author

Updated to latest Nvidia drivers for my GPU and I have the same behavior, so I think whiskhub might be correct and it might be a buggy implementation for Nvidia graphics cards.

@RDMacLachlan RDMacLachlan added area-Media Support for media playback or encoding area-External labels Jan 22, 2025
@riverar
Copy link
Contributor

riverar commented Jan 23, 2025

Dumb question: Have you opened the images to verify their contents? A shell extension/preview handler bug (or caching issue) would render those files incorrectly in File Explorer.

@whiskhub
Copy link

Dumb question: Have you opened the images to verify their contents?

Yeah, they're really identical files 😅

@ianeuman
Copy link
Author

Yes, same for me, identical files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-External area-Media Support for media playback or encoding
Projects
None yet
Development

No branches or pull requests

7 participants