Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

[Released] AVPro Video - complete video playback solution

Discussion in 'Assets and Asset Store' started by AndrewRH, Feb 12, 2016.

  1. ultraschall

    ultraschall

    Joined:
    Feb 14, 2013
    Posts:
    29
    If you can provide a 5.5 Only version that does not work in 5.3 - its also fine for us !
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi Chuck,
    We're working on it - it's a little difficult without Hololens hardware in hand :) To be honest it appears to be a bug in Unity / Hololens, so if you could pass the bug on to them to look that would probably be best. I will let you know if we make a breakthrough here. So far it's working fine in the Hololens emulator.
    Thanks,
     
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi, we've tested this here but seeking backwards is working fine. Does it work if you use the "BigBuckBunny_720p30.mp4" sample video?

    Perhaps could you explain in more detail (with a code snippet) about how exactly you're seeking and share your video?

    Thanks,
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yes we're working on this. It would be out soon (today or later this week).
    Thanks,
     
  5. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    Thank you! We are having the same issue. After upgrading to 5.5 it does not work on the HoloLens :(
     
  6. HarryCodder

    HarryCodder

    Joined:
    Feb 20, 2015
    Posts:
    68
    Hi Andrew,

    We ran into a small problem with some older Android devices (Motorola G3, Nexus 7 2013, Samsung Galaxy Tab A) where MediaPlayerEvent.EventType.FirstFrameReady was never fired even though the video can be played fine.
    It seems to work on other devices (LG G3 for instance).
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi, Are you using the actual hololens or the emulator? If you're using the hardware then is there any difference if you use the emulator instead? Also the "m_AppCallbacks.AddCommandLineArg("-force-d3d11-no-singlethreaded");" line should no longer be needed. You could try disabling the hardware decoding (in Platform Specific panel in the MediaPlayer component) to see if that makes any difference?

    Thanks
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    A linux version :) Maybe in 2017....who knows! Currently though we don't have any plans for this.... If we do integrate support for libVLC / FFMPEG then this might make the Linux port more feasible. At least hopefully Unity 5.6's new video support will support Linux. Thanks,
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    The MediaPlayer component has a m_VideoPath public member which you could use.

    If you manually change video via OpenVideoFromFile() then you can set this field member variable so that you can keep track of the currently playing video.

    I hope that helps.
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Unfortunately I don't have hololens hardware so it's quite difficult to debug... We're trying and I'll let you know if we find anything. Does it work if you use the hololens emulator?
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Interesting... You may be able to help us debug this as we don't have these devices. You can see in MediaPlayer.cs line 1054 and line 1026 there is related code.

    Before the event is fired it checks these conditions:
    (m_Texture != null && m_Control.CanPlay() && m_Texture.GetTextureFrameCount() > 0);

    I suspect that CanPlay() is returning false..... perhaps you could confirm this?

    Also, it would be very helpful if you could check the "adb logcat" to see if there are any errors coming from Android.

    Thanks,
     
  12. adre

    adre

    Joined:
    Mar 28, 2014
    Posts:
    37
    Hi @AndrewRH,
    there's a problem with IMGUI and UGUI Mediaplayers.

    When i play a video ( fullhd, 25fps ) the video is very low fps. If i switch to another window and then go back to the app playing the video, the fps are fine.

    I'm streaming from permanent data folder, on Android. Not tested on iOS.

    Any help?
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Thanks adre, could you provide more details about your setup so we can replicate the bug? Eg:

    1) AVPro Video version number
    2) Unity version number
    3) Android device model
    4) Android OS version number
    5) A copy of your video file

    Feel free to email us at unitysupport@renderheads.com

    Thanks,
     
  14. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    Hi,

    No we have not been able to get it working on the emulator. It keeps giving an "Access violation".
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    If you could provide more information it would help us replicate the issue. Thanks,
     
  16. thomasbiddulph

    thomasbiddulph

    Joined:
    Oct 27, 2016
    Posts:
    4
    I'm working on the same project as LaylaBm, we're using Unity 5.5.0f3. I added the player to an already existing project, got it set up as per the instructions and had it working in the Unity Editor.

    These are the settings I used to build the Unity project and create the UWP one



    Deploying the app with the player in on both the Emulator and Device causes it to crash and exit on start with this error



    We've also tried creating a new unity application and only including the media player, it works in the Unity editor but has the same problem as above.


    I'm currently installing Unity 5.4.0f3 to see if It works with that version.
     
    Last edited: Dec 7, 2016
  17. praagmatic

    praagmatic

    Joined:
    Mar 23, 2014
    Posts:
    5
    Is there a way to set the start/end times for a given video?

    For example lets say a video is 5.0 seconds long and I want it to start at 1.0 and end at 4.0. Or a video is 100 frames long and I want to restict playback to between frames 30-60.

    Is this possible? I looked through the documentation but didnt see a function to set start/end frames/times (sorry if its there and I missed it).

    (using the asset on a work Unity account)
     
  18. SunriseRH

    SunriseRH

    Joined:
    Aug 5, 2016
    Posts:
    107
    Hi,

    I was able to replicate this issue using those build settings on the emulator. I did manage to get it to work by building for XAML instead of D3D however. I'm not knowledgeable about the hololens, so I'm not entirely sure of the exact ramifications of switching to XAML, although after some reading, it does seem that there is no big performance impact. We will continue investigating this issue in the meantime.
     
  19. SunriseRH

    SunriseRH

    Joined:
    Aug 5, 2016
    Posts:
    107
    One more thing, when building a project without AVProVideo for hololens using Unity 5.5, does the scene render? I am currently doing some testing with D3D builds that do not include AVPro Video, and, although the build doesn't crash, I don't seem to be able to get anything to work.
     
  20. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    Hi,

    We have tried this within our own project and within a new project on its own and we can't get it to build on the HoloLens or the emulator when building XAML rather than D3D either. It is giving the same access violation message. Was there anything else you changed to get it working on the emulator?
     
  21. thomasbiddulph

    thomasbiddulph

    Joined:
    Oct 27, 2016
    Posts:
    4
    The project I'm working on is built with unity 5.5, both Xaml and D3D builds work in the emulator and on the hololens. Including the AvPro plugin in the project causes the access violation even if there is no Media player in the scene.
     
  22. Undercat

    Undercat

    Joined:
    Oct 1, 2016
    Posts:
    4
    Hello,

    I have a bug report for you.

    We were using your media player in a project with Vuforia and found that videos would not render at all once the AR camera had been activated—even after loading a different scene using the Cardboard camera instead of the Vuforia AR camera. Your frame server was obviously running because the "end" event was delivered after the appropriate delay; however, nothing whatsoever was painted to the scene.

    It turns out, after much investigation, that Vuforia's AR camera was allocating a large number of GLES textures starting at the rather comical descriptor value of 4,010,111,200. The 40-some textures Vuforia created were never removed from the GLES state, so they persisted across scene changes.

    Aside from the video memory leakage, this creates problems when using AVPro because it treats Android texture handles as signed ints, even though Unity is quite explicit about them being of GLuint type. When an AVPro instance is opened after the Vuforia AR camera has created these lingering high-descriptor-value textures, it winds up with a texture ID above 4 billion and treats it as a negative number, causing it to elide injection into the Unity scene graph, resulting in no texture display. The relevant code in AndroidMediaPlayer.cs is:

    Code (CSharp):
    1.   int textureHandle = m_Video.Call<int>("GetTextureHandle");
    2.   if (textureHandle > 0 && textureHandle != m_TextureHandle ) { ... }
    I tried changing the return value to uint and checking for values less than 4.2 billion, but it still does not work. Probably the compiled module itself is filtering "negative" values and simply returning an error.

    I have reported the texture leak to Vuforia separately, but the handling of otherwise-valid large descriptor values is definitely a bug in AVPro. It should not mingle error reporting with the texture handle because all GLuint descriptor values are potentially valid.

    Ironically, the only Unity media player plug-in that appears to get this right is EMT, but it has a legion of other issues that would be inappropriate to articulate here.
     
  23. SunriseRH

    SunriseRH

    Joined:
    Aug 5, 2016
    Posts:
    107
    Other than the other settings required to get a hololens app working (spatial perception, internet client etc.) I haven't changed anything. One thing I did realise with the XAML build after I posted is that the app still terminates, but for some reason I'm able to run it regardless, just no longer connected to the debugger. I'm using the latest update if that helps (update 3)

    I'll have to look into this a bit more, maybe see what calls in the dll may be causing this crash.
     
  24. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    Thanks, we are having no luck and seem to have exhausted all options. It appears it may be a problem with the x86 UnityPlayer assembly as when debugging this throwing an exception. It works fine when debugging in x64. I will raise it with Unity to see if it's an issue with the 5.5 build.
     
  25. DavidChuang

    DavidChuang

    Joined:
    Nov 28, 2016
    Posts:
    3
    Thanks for your suggestions.If the metadata can be removed,can you add this function in plugin?
    I think it can be easily,if we want to control stereo format.:)
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    The metadata removal would have to happen on your side, before the video file gets to our plugin.
    Thanks,
     
  27. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi, thanks for get detailed analysis. We have looked into this issue with Vuforia before and I'm afraid we don't have a solution. If you initialise our plugin first before Vuforia then it works fine, but if you do it afterwards then it doesn't work. For some reason when we allocate a GL texture it returns an invalid texture handle - it's very strange! I would say that this is an issue with Vuforia....it must be doing sometihng very strange..You're right that the value returned by glGenTextures should be valid, however the values we get after Vuforia is initalised are really wild and when i call glIsTexture(handle) it return FALSE, so clearly it is invalid... If you find out anything from Vuforia please let us know :)
    Thanks,
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    We don't provide this functionality out of the box, but it should be possible to add it yourself. The TextureProducer field in MediaPlayer has a number of methods which you could hook into. The GetTexture() method returns the current texture and the GetTextureTimeStamp() method returns the time (in HNS units) of that texture frame. So you could make your app not display the texture, until GetTextureTimeStamp() is within the range of your frames, and use Seek() to get to the start point of your video. That should work :) We're looking into adding this functionality in the future.
    Thanks,
     
  29. brendachen

    brendachen

    Joined:
    Dec 9, 2016
    Posts:
    1
    Hi! Just wondering but does AVPro support video textures for skinned mesh renderers for animated models? If not will this feature be implemented anytime soon? Thanks!
     
  30. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    @AndrewRH
    Is there a way to check if the video on a url exists (wont fail to play giving "[AVProVideo] Error: LoadFailed"
    error) before playing it.
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yes, it shouldn't have any problem with skinned mesh renderers. AVPro Video simply produces a standard Unity texture, which can be used in a standard Unity material and applied to any meshes as usual. We have a component called "ApplyToMesh" which does exactly this. I've just checked though, and ApplyToMesh uses a MeshRenderer, so I will change it in the next release to simple use a Renderer component - this way it will work for with MeshRenderer and SkinnedMeshRenderer. The release will be out later today.
    Thanks,
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    I'm afraid that this would be beyond the scope of the plugin. You should be able to check if the URL exists by using the WWW class in Unity.
    Thanks,
     
  33. Undercat

    Undercat

    Joined:
    Oct 1, 2016
    Posts:
    4
    In my post I told you exactly why your plug-in fails when used with Vuforia.

    You are not treating the GLES texture IDs as unsigned integers. You are treating them as signed integers and using negative values to indicate failure when returning from function calls, like the one in your AndroidMediaPlayer.cs script I quoted above.

    Vuforia, for whatever reason, allocates some textures at VERY high descriptor values---greater than 4 billion. When a number that large is treated as an integer, it "magically" becomes a negative value, and your code views that as an error. But it is not an error: it is a perfectly valid texture ID. It may happen to be an unusually large texture ID---one that you will seldom see because most applications are incapable of allocating more than 2 billion textures---but it is valid nonetheless.

    You need to rewrite your functions to pass error information through a separate variable. You cannot use the texture handle to pass "negative numbers" as errors because it actually has an unsigned type and there are no negative values: all of its values are potentially valid. Because you treat some of its values (half of them, actually) as invalid, your code fails in cases where the texture ID is perfectly legal and you should otherwise be able to render.
     
  34. Undercat

    Undercat

    Joined:
    Oct 1, 2016
    Posts:
    4
    I should add, with respect to this part of your reply specifically, that you cannot query the texture after it is generated without binding it. And I can see in the GL call trace that the texture you generate never gets bound. The relevant documentation for this is here: https://www.khronos.org/opengles/sdk/docs/man/xhtml/glIsTexture.xml

    Specifically, "A name returned by glGenTextures, but not yet associated with a texture by calling glBindTexture, is not the name of a texture."
     
    Last edited: Dec 9, 2016
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Okay, thanks for pushing this again :) I'm pretty sure we did try to use the "negative" texture ID, but it still failed...We will look into this again - hopefully we missed something the first time around. Any idea how Vuforia is "generating" such large texture IDs? I was under the impression that only glGenTextures() could generate the IDs and usually it produces sequential / low values?
    Thanks,
     
  36. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi All,

    AVPro Video version 1.5.10 has just been released!

    You can find the updated version on the Asset Store and the free trial version / demos on our website.

    Changes include:

    macOS
    • Fixed issue where OpenVideoFromFile() called multiple times quickly would cause a crash
    • Removed PLIST modification from the PostProcess build script
    iOS
    • Fixed issue where OpenVideoFromFile() called multiple times quickly would cause a crash
    • Fixed issue with Unity 5.5.x which caused XCode project not to run due to missing Metal symbol (only affects watermarked trial version)
    tvOS
    • Fixed issue where OpenVideoFromFile() called multiple times quickly would cause a crash
    • Fixed issue with Unity 5.5.x which caused XCode project not to run due to missing Metal symbol (only affects watermarked trial version)
    Android
    • Fixed issue with Unity 5.4.2 and above where changing the TextureQuality level in the QualitySettings would cause the texture to go black
    Windows
    • Fixed issue with Unity 5.4.2 and above where changing the TextureQuality level in the QualitySettings would cause the texture to go black
    General
    • Added support to uGUI shaders for RectMask2D
    • ApplyToMesh component now works with other renderer components (eg Skinned Mesh)
    • Updated documentation and FAQs
    Please note that the WSA and Hololens issue (related) that happens with Unity 5.5 is not fixed. We're currently investigating this issue. WSA apps seem to work when you use 64-bit builds, but not 32-bit. Hololens is only 32-bit, and seems to have the same issue. As soon as we have an update on this we'll let you know.

    Thanks,
     
    Last edited: Dec 12, 2016
  37. Undercat

    Undercat

    Joined:
    Oct 1, 2016
    Posts:
    4
    That is a very good question. I wonder the same thing myself. The only thing I can think of is, because they are using the camera to capture the virtual screen position of a token in the "real world," perhaps the camera is doing some sort of automatic texture injection from the upper-level Android system, and maybe that is creating the very large value.

    I do note that in the list of textures, the very first one that has a high ID is the picture of the token, as scanned by the camera. Why the system is able to create such a high value for this texture, I cannot say. Subsequent texture ID allocations see that high value and start sequentially allocating descriptors after it, despite there being a large number of "empty" descriptors under it.

    The problem seems especially prone to occur on systems with the Mali GPU. No idea why.
     
  38. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    @AndrewRH

    There is a problem with 360 sphere video play. If we use same sphere and player to play different videos. Last played video's texture stays on sphere instead of default texture while it loads new video. I am using ApplyToMaterial component on sphere. Tried different work around like disabling component while video is not playing. and setting material's mainTexture to null. But nothing worked on Android Build.
    Please advise on this.
     
  39. cleoag

    cleoag

    Joined:
    Apr 20, 2013
    Posts:
    10
    always getting bad picture from 4k hls streaming



    i'm on AVPro Video (script v1.5.6 plugin v1.5.6) on NVIDIA GeForce GTX 1080/Direct3D 11.0 [level 11.0] (MT True)
    and on windows10 64 bit with all default codecs. no anything additional installed.

    tested on several others pc's. and several others streams. results always the same.

    Den
     
  40. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    @AndrewRH
    We are still using previous version of AvPro. And just faced this exception while running on Android:

    And screen goes black after this.
    Just wanted to know that the following fix in latest version is referring to our problem and updating the plugin would solve it:
    Thanks
     
  41. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    We have found the same, 64-bit builds work fine but not 32-bit. Any idea when a fix will be released for this? I appreciate it may be hard to estimate timescales.
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    We have a fix and will be releasing it in the next few hours!
    The Unity 5.5 crash issue with WSA / UWP / Hololens has been fixed!

    Thanks,
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hi All,

    AVPro Video version 1.5.12 has just been released! (pending Asset Store review process)

    You can find the updated version on the Asset Store and the free trial version / demos on our website.

    Changes include:

    WSA / UWP / Hololens
    • Fixed crash issue when using Unity 5.5
    Thanks,
     
  44. teunververs

    teunververs

    Joined:
    May 22, 2015
    Posts:
    10
    Hey Andrew,

    We're using the plugin in one of our products to display videos, but users running it on Windows Vista are reporting troubles.

    I've tried debugging our application on a clean (downloaded the iso and installed it on a machine we had laying around) vista machine, and it gave me an error that the plugin's .dll file could not be loaded.
    To verify if the problem was within the plugin, I downloaded and ran the demo build and that didn't function either!
    When I start the demo, I see the floating shapes but no video in the background and the "next" button just brings me to a black screen.

    Again, this is on a clean machine, all I did was install Vista SP2, video drivers and ran our app and your demo...

    Can you help me?
     

    Attached Files:

  45. mkneib

    mkneib

    Joined:
    Aug 3, 2016
    Posts:
    6
    Hello,

    i am trying to build an app for Hololens.
    I have tried Apply to Mesh and Apply to Material.
    I can hear the audio from the video, but the mesh shows only material color or the default texture. This happens on the device and in the Emulator. In the Unity IDE, the video works as expected.
    I am using the AVProVideo/Unlit/Opaque (texture+color+fog+stereo support) Shader.


    Any suggestions?

    Greets
    Micha
     
  46. LaylaBM

    LaylaBM

    Joined:
    Dec 7, 2016
    Posts:
    6
    Thank you! Will download it this evening :)
     
  47. xpansivevr

    xpansivevr

    Joined:
    Jun 22, 2016
    Posts:
    27
    Hello, can anyone advise if a monoscopic 360 video at 3840x1920 30fps will playback with AVPro on an iPhone 6 and a Samsung S5

    Cheers - Nick
     
  48. thomasbiddulph

    thomasbiddulph

    Joined:
    Oct 27, 2016
    Posts:
    4
    I've Tested on a HoloLens and it's working correctly now. Thanks.
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Fabulous :) Thanks for confirming this! Cheers,
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    I've never had an S5 to test on, but it certainly works on an S6...The iPhone 6 should also handle it I'm pretty sure. Thanks,