Open bas-purple opened 6 days ago
Hi @bas-purple,
Thanks for reporting this - we are aware of DirectShow in particular stalling the main thread on open/close. Unfortunately there isn't a quick fix but we are in the process of rewriting the plugin to move all video players to their own threads which should hopefully alleviate this.
You can see further comments here: https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1111 - we'll probably merge these tickets going forward to streamline things.
Cheers,
@RichRH
Bummer to hear, but thanks for the response.
Do what you need to do to streamline things^^.
Unity version
2022.3.42f1
Unity editor platform
Windows
AVPro Video edition
Ultra
AVPro Video version
3.1.0
Device hardware
No specific hardware.
Which Windows version are you using?
Windows 11 and Windows 10
Graphics API
D3D 11
Video API
DirectShow
Audio output
System Direct
Any other Media Player component configuration required to reproduce the issue.
Have LAV filters installed. (from Lav decoder: v0.79.2.19-git). We use k-lite to install ours, but I would imagine it happens with any installation. We did not verify with any other versions though.
Which output component(s) are you using?
Resolve to RenderTexture
Any other component configuration required to reproduce the issue.
No response
The issue
In our application we create scenes (not unity scenes) with different videos playing. When our application switches between scenes, we call CloseMedia on videos in the current scene (and at the same time we use OpenMedia for the videos in the new scene).
Our clients can upload and play their own videos. Due to requests from clients to support more codecs (primarily HEVC), we decided to transition from Media Foundation to DirectShow. We installed LAV filters on the devices running our software and just to be sure we verify if the LAV filters are installed. If they are not we fall back to Media Foundation.
Unfortunately, changing to DirectShow resulted in lag spikes when videos are loading out. This does not happen with the Media Foundation.
I have tried to wrap the CloseMedia call in a Task to offload it to another thread but that did not help.
Is this just something that comes with using DirectShow or is this something we can prevent from happening?
In this example you can see that when we transition from one scene to the other, there are 2 distinct dips in fps. The first dip is expected due to loading in a new video. We always had that dip, but the second dip is new. It is a bit difficult to see, but the entire application freezes for a frame during that dip.
Github(does not seem to work): https://github.com/user-attachments/assets/a16f0410-22d8-4ac9-a5b2-09ac613f9fdb Google Drive: https://drive.google.com/file/d/1L0wUo6YlIfDUMLAzKKmnN1fc2-Exjb9V/view?usp=drive_link
Media Foundation: Direct Show:
Media information
No response
Log output
No response