RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
224 stars 27 forks source link

Can I load new videos without effects other playing videos? #1053

Open keitasumiya opened 2 years ago

keitasumiya commented 2 years ago

Describe the issue I would like to instantiate new AVPro videos without effects some AVPro videos which already plays. Could you tell me the way how can I do it? (This issue is relevant to my previous issue: https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1017) (I made a test project for this issue so is it OK if I send the test project?)

Your Setup (please complete the following information):

To Reproduce

  1. Add a "MediaPlayer"
  2. Change MediaPlayer settings as followings:
    • Startup/Auto Open: true or false
    • Startup/Auto Play: false
    • Platform Specific/Windows/Use Low Latency: true
    • Platform Specific/Windows/Use Hap/NotchLC: true
  3. Add a "Apply to Material"
  4. Set a test Material into "Apply to Material"
  5. Add Quad and set the test material to show
  6. Make a prefab from game object including those 1-5
  7. Instantiate the prefab and open and play a video 10 times in a frame
  8. Instantiate the prefab and open and play a video 10 times in a frame again. At that time, those videos which made in 7 cause frame drops because of opening new videos in 8. An following slow-motion gif video is a test for h265 videos : AddVideos_h265_slowmotion mov

Logs If applicable, add error logs to help explain your problem.

Screenshots If applicable, add screenshots to help explain your problem.

Videos videos for debug: https://www.dropbox.com/sh/782pd4h5enrvdwa/AAC6K6J04adxs4-uo-vjQh2da?dl=0

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us unitysupport@renderheads.com I made a test project for this issue so is it OK if I send the test project?

AndrewRH commented 2 years ago

Thanks for the clear demonstration of the issue.

I assume this is for some sort of VJ use case? Are you also using the 'Use Custom MOV Parser' option? Have you tried turning some of the other options off, such as: image Use Text Tracks : Disabled Use Stereo Detection : Disabled Use Facebook Audio 360 : Disabled Audio Output : None

Also - does the issue only happen with mp4 files? What happens if you disable the 'Use Hap/NotchLC codec' option?

Thanks,

keitasumiya commented 2 years ago

Thank you for your reply.

Yes, I make a VJ-like system for business and occur this problem... I tested your suggestions but it did not solve this problem. Results are as followings:


  1. h265 mp4, Media Foundation, NO "Use Hap/NotchLC" Frame drops still occur. Settings: h265_MF_NoUseHap_crop

Slow Motion capture: h265_MF_NoUseHap_slowmotion mov


  1. h265 mp4, Media Foundation, "Use Hap/NotchLC" Frame drops still occur. Settings: h265_MF_UseHap_crop

Slow Motion capture: h265_MF_UseHap_slowmotion mov


  1. hap, Media Foundation, "Use Hap/NotchLC" Not only frame drops still occur but also videos are almost stopped. Acctually I don't use Media Foundation for hap video because of the previous issue ( https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1017 ). Settings: hap_MF_crop

Normal Speed capture:

hap_MF_normalSpeed mov


  1. hap, DirectShow Frame drops still occur. Acctually I use this Direct Show for hap video because of the previous issue ( https://github.com/RenderHeads/UnityPlugin-AVProVideo/issues/1017 ). Settings: hap_DirectShow_crop

Normal Speed capture: hap_DirectShow_normalSpeed mov


Thanks,

keitasumiya commented 2 years ago

@AndrewRH

Hi, I tested your suggestions as the previous comment. If possible, I would appreciate your reply.

Thanks, Keita

AndrewRH commented 2 years ago

Hi Keita,

Sorry for the slow response - we've very busy at the moment so I haven't had time to investigate this further.

Perhaps you could open the videos in sequence instead of at the same time? Maybe open one video and then a few frames/milliseconds later open the next one.

For DirectShow we anticipate a delay (causing frame drop) because the API is not asynchronous. This can only be fixed by moving all of the code to another thread. This is a known solution, it will just take time to implement it.

For Media Foundation the API is meant to be asynchronous, but I guess there is something in there that's causing a delay - perhaps the texture creation / destruction. I will have to investigate this to find the cause and then see what we can do about it.

Also - perhaps you could reduce the number of chunks in your Hap encoding? Try 4 or 8 chunks, as this will mean we can create less threads which may help loading time.

Thanks,

keitasumiya commented 2 years ago

Hi, Andrew

Thank you so much for your reply. And I am sorry for my previous comment because you are so busy now.

Moreover, thank you for your advices. As you mentioned, I open those videos in sequence. So I’ll try opening those in other threads.

I really appreciate your kind messages. Thanks, Keita

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed because it has not had recent activity. If you wish to continue this issue, then please create a new issue as we do not monitor closed issues.

AndrewRH commented 2 years ago

This is an optimisation issue and it would be good to improve this. We need to investigate where the bottlenecks are for loading Hap videos. We may need to expose some options, as our Hap decoder is optimised towards high resolutions, but that may be hurting performance for simpler videos that just need to load fast.. Could also be some texture creation overhead. Anyway, something seems to be blocking the main thread...