stride3d / stride3d/stride

Video with FFMpeg cannot be played multiple times

Open
#1,079 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Graphics bug
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:

  1. Follow the steps in the setup video manual
  2. Ensure the video is set to loop
  3. Use the following script instead of the StartupScript that 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();
        }
    }
  1. Add <StrideGraphicsApi>Vulkan</StrideGraphicsApi> to the <project>.Windows.csproj inside the <PropertyGroup>
  2. Run the windows project, the video will start after 10 seconds and when it loops it will throw the exception
  3. 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:
test-image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.