RenderHeads / UnityPlugin-AVProVideo

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

Using OpenMediaFromBuffer with external splitter causing endless looping in AVPro #865

Closed xuserv closed 2 years ago

xuserv commented 3 years ago

Describe the issue The AVPro causing the whole standalone player or editor stop responding with OpenMediaFromBuffer and external splitter installed environment, However using OpenMedia works fine.

Your Setup (please complete the following information):

To Reproduce

  1. Install any kind of AIO codec bundles with splitters.
  2. Open Media via OpenMediaFromBuffer.
  3. AVPro unable to process due to splitter not returning any values and keep waiting for valid results.

Logs No Error Logs Generated, the whole Unity Editor or Standalone is stop responding.

Notes Want to use OpenMediaFromBuffer as possible, currently adapting with encrypted assetbundle.

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us unitysupport@renderheads.com

AndrewRH commented 3 years ago

We will have to look into this. If possible could you send us a cut down scene/script that demonstrates the issue?

Is your video MP4? Which codec packs have you tried?

Thanks,

AndrewRH commented 3 years ago

@kahnivore perhaps you could try to reproduce this once they send us their scene/script

Thanks,

AndrewRH commented 3 years ago

@kahnivore perhaps you could try to reproduce this once they send us their scene/script

Thanks,

kahnivore commented 3 years ago

@xuserv if you can send us a project so we can reproduce this please do so to unitysupport@renderheads.com with #865 in the subject line. Thanks!

xuserv commented 3 years ago

We will have to look into this. If possible could you send us a cut down scene/script that demonstrates the issue?

Is your video MP4? Which codec packs have you tried?

Thanks,

Used Video was MP4/AVC with 1920x1080 @ 60fps, I was using StarCodec with default setup and additional MP4/OGG splitters installed.

@xuserv if you can send us a project so we can reproduce this please do so to unitysupport@renderheads.com with #865 in the subject line. Thanks!

No problem! Will do asap.

xerorex commented 3 years ago

I am also experiencing this problem. Please solve it quickly.

xuserv commented 3 years ago

The project has been sent to developers and I also did additional test.

This only happens when media loads from buffer, reading from files or URL works fine as mentioned before. Without splitters it directly goes to 'Microsoft DTV-DVD Video Decoder', However with splitters it goes 'LAV Splitter' then 'Microsoft DTV-DVD Video Decoder'. My only guess is 'LAV Splitter' doesn't support Read from Buffer feature and making endless loop in here.

Is there any workaround on this? Asking users to uninstall codecs seems not a good idea to me.

-- [EDIT] Tried opening a local server then read from it, it does works but there is significant performance drops and no guarantee our port is not used in users pc.

kahnivore commented 3 years ago

Hey @xuserv

Checked out your project. I have LAV Splitter installed, and I'm struggling to reproduce your problem. I've tested your scene which is using OpenMediaFromBuffer and the file plays fine. Is there a step I'm missing here?

xerorex commented 3 years ago

@kahnivore In my case, an error occurred when installing the basic version of the codec and the 64-bit version of the codec 'full'. Consider this case. It is expected that problems will occur even if AIO codecs other than this codec are used.

http://www.starcodec.com/en/x64.php

xuserv commented 3 years ago

Hey @xuserv

Checked out your project. I have LAV Splitter installed, and I'm struggling to reproduce your problem. I've tested your scene which is using OpenMediaFromBuffer and the file plays fine. Is there a step I'm missing here?

That's odd, Have you installed splitters from 'Splitters' folder which included in project or installed from other sources?

You can install them via regsvr32 MP4Splitter.ax or regsvr32 OGGSplitter.ax and uninstall via regsvr32 /u MP4Splitter.ax or regsvr32 /u OGGSplitter.ax

kahnivore commented 3 years ago

I installed LAV Filters from here . Would this not be equivalent?

xuserv commented 3 years ago

I installed LAV Filters from here . Would this not be equivalent?

I think so, but seems it doesn't force loaded when media file loaded as seen in screenshot Installed from LAV Filters

However the StarCodec bundled one is force loaded StarCodec MP4Splitter

xerorex commented 3 years ago

@kahnivore Is there any progress on the issue?

kahnivore commented 3 years ago

Not yet, sorry. We need to investigate this a bit further.

xuserv commented 3 years ago

Is there any updates on this? I'm currently thinking about improve my local server solution or not.

xerorex commented 3 years ago

@kahnivore @AndrewRH I don't want you to forget this issue. I'm still waiting for a solution.

xuserv commented 3 years ago

Little update on this.

Tried opening a local server then read from it, it does works but there is significant performance drops.

This only happens on MediaFoundation Playback when Ranges response is not supported on Web Server, will proceed after timeout. using DirectShow Playback solved this somehow.

We ended up using Unity VideoPlayer, but this needs to be solved for someone want to play encrypted video. Using or Making a local server to prevent this problem isn't ideal solution.

stale[bot] commented 3 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.

AndrewRH commented 2 years ago

I've reproduced the issue. I had to install StarCodec64 (LAV Filters seemed file) to get the issues to appear.

1) Big Buck sample video doesn't load and freezes Unity. 2) RenderHeads and Cones sample videos do load, but don't handle seeking and don't loop.

The script I'm using for testing:

  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using RenderHeads.Media.AVProVideo;

  public class TestBufferedPlay : MonoBehaviour 
  {
      [SerializeField] MediaPlayer _mp = null;

      // Use this for initialization
      void Start () 
      {
          Debug.Log("reading " + _mp.MediaPath.GetResolvedFullPath());
          byte[] buffer = System.IO.File.ReadAllBytes(_mp.MediaPath.GetResolvedFullPath());
          _mp.OpenMediaFromBuffer(buffer);
      }
  }
AndrewRH commented 2 years ago

Okay progress...

So the Big Buck video freezes because of FLV Splitter which enters some code and never returns. If I install StarCodec64 without FLV Splitter then this video plays correctly.

The others videos however still have the issue where they can't seek/loop. This seems to be because it's using the LAV Splitter and not our internal GDCL-MPEG4 Demuxer as Big Buck sample video does. To work around this we're addeding the ability to force the usage of GDCL-MPEG4 which corrects this issue.

So in the list of preferred filters you can add GDCL-MPEG4 if you're going to be loading MP4 files from buffers and this should have much better behaviour with these different codec packs / splitters installed. Also this fixes the issue with FLV Splitter, so no need to deselect it during install.

This fix will be in the next update to AVPro Video: v2.4.2

Thanks for your patience.

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.