Video with FFMpeg cannot be played multiple times
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: Release
Version: 4.1.0.1459-beta
Platform(s): Windows with <StrideGraphicsApi>Vulkan</StrideGraphicsApi>
Describe the bug
The first time a video is played (if delayed, see note) it works as expected, however, if the video loops or is played again sometime after the first playthrough has completed an exception is thrown. Specifically private FrameExtractionStatus ExtractNextImage(StreamInfo streamInfo, AVPacket* pPacket, AVStream* pStream, byte_ptrArray4 dstData, int_array4 dstLinesize) throws an ApplicationException("Couldn't transfer frame data from GPU to CPU"); on line 401
Note: If first time the video is played is not delayed (i.e. played in the Start method of a StartupScript or immediately in the Execute method of an AsyncScript) the exception will be thrown immediately rather than when it loops
To Reproduce
Steps to reproduce the behavior:
- Follow the steps in the setup video manual
- Ensure the video is set to loop
- Use the following script instead of the
StartupScriptthat the manual suggests, in order to delay the startup of the video
public class PlayVideoScript : AsyncScript
{
public override async Task Execute()
{
await Task.Delay(10 * 1000);
Entity.Get<VideoComponent>()?.Instance.Play();
}
}
- Add
<StrideGraphicsApi>Vulkan</StrideGraphicsApi>to the<project>.Windows.csprojinside the<PropertyGroup> - Run the windows project, the video will start after 10 seconds and when it loops it will throw the exception
- If it does not throw the exception try using specifically the video file attached to this issue
Expected behavior
The video to play successfully every time and for it to loop
Screenshots
Log and callstacks
video-crash.txt
Additional context
Video used during testing:
https://user-images.githubusercontent.com/2172023/121974554-fd2f0a00-cdc2-11eb-9aa0-b83f289bc51a.mp4
Target texture used during testing:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ExtractNextImage(StreamInfo streamInfo, AVPacket* pPacket, AVStream* pStream, byte_ptrArray4 dstData, int_array4 dstLinesize), especially the GPU-to-CPU transfer failing on line 401. Review the attached video-crash.txt and reproduce using the setup video manual, delayed playback, looping, Vulkan, and the provided video. Done means the video plays and loops successfully without the exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- audio-video-rtc, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100