Search Unity

[Released] AVPro Video - complete video playback solution

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

  1. AndrewRH

    AndrewRH

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

    That sounds very strange. If the key-frame interval is not the issue then I don't know what it could be besides a bug in the decoder in the operating system.

    Feel free to send us your video so that we can investigate. (email us at the Unity Support address at http://www.renderheads.com/contact/)

    Also see if selecting the MediaPlayer or ExoPlayer video API makes a difference (in MediaPlayer > Platform Specific > Android)

    Thanks,
     
    silverfire330 likes this.
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    From your plugin and script version numbers it looks like the upgrade didn't work correctly. This is probably because Unity had a lock on the plugin DLL File. Please close Unity then restart it and immediately (without running the scene or clicking on any AVPro Video components) upgrade to the latest version of AVPro Video.

    RTSP In general though isn't very well supported in AVPro Video. If you need support in Windows then you will have to install a codec (LAV Filters) and switch the video api (in MediaPlayer > Platform Specific > Windows) to DirectShow. On Android RTSP is supported when using the MediaPlayer video api, but not on ExoPlayer (but I hear it is coming soon).

    Thanks,
     
  3. AndrewRH

    AndrewRH

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

    AVPro Video version 1.8.9 has just been released!

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

    Changes include:

    Android
    • Upgraded ExoPlayer to version 2.8.2 from 2.8.1
    • Fixed audio glitches on Oculus Go when using Facebook Audio 360 by increasing the default spatial buffer size
    • Reduced garbage generation by caching frequently used methods
    Windows UWP / Hololens
    • Fixed an issue where non-debug builds would crash on some versions of Unity
    WebGL
    • Added notes to AVProVideo.jslib on how to integrate dash.js
    General
    • Reduced some garbage generation in various components
    • Improved shader support for multi-view stereo rendering
    Please report any issues here on the forum, or to our customer support email.

    Thanks,
     
    bhtruong93 likes this.
  4. silverfire330

    silverfire330

    Joined:
    Jul 17, 2015
    Posts:
    7
    That was indeed it, thank you very much! I felt like the issues were symptomatic of using MediaPlayer rather than ExoPlayer, as the former has always given me a lot of headaches in native apps as well. It was also having problems with buffering, etc. Relieved that AVPro can also use ExoPlayer, though it'd have been nice for it to be the default.
     
  5. bhtruong93

    bhtruong93

    Joined:
    Jul 12, 2017
    Posts:
    7
    Ahh thanks for the quick reply. Yup, I'm using ApplyToMaterial and unfortunately don't know if the video comes in as landscape or portrait. Any workarounds you can think of?
     
  6. AE0715

    AE0715

    Joined:
    Jul 9, 2018
    Posts:
    2
    I can't use the AVPro plugin on my phone to play the video in the screenshot below. However, this video can be played directly from the player that comes with the phone.
    What is the cause of this?
     

    Attached Files:

    Last edited: Jul 10, 2018
  7. Pitrees

    Pitrees

    Joined:
    Apr 30, 2018
    Posts:
    1
    How to track video frame count, use to countdown duration of video before it end?

    Wish to know percentage of video played based on the (watched duration/total video duration)
    or (current frame/total frame).
    Want to make a scrollbar like youtube where drag to jump and watch specific part of video.
     
  8. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    2,869
    You can use a slider for that.
    You get the current slider value by using this code.
    Code (CSharp):
    1. progress.normalizedValue = Mathf.InverseLerp(0, mediaplayer.Info.GetDurationMs(), mediaplayer.Control.GetCurrentTimeMs());
     
  9. sharjahtourism

    sharjahtourism

    Joined:
    May 19, 2017
    Posts:
    20
    Hi Andrew I have got follow errors on android. It works well on iOS. How can I resolve that issue?

    07-11 15:55:50.164: E/Unity(2276): Unable to find AVProLocal
    07-11 15:55:50.164: W/dalvikvm(2276): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/RenderHeads/AVProVideo/AVProMobileVideo;
    07-11 15:55:50.224: E/Unity(2276): AndroidJavaException: java.lang.ClassNotFoundException: com.RenderHeads.AVProVideo.AVProMobileVideo
    07-11 15:55:50.224: E/Unity(2276): java.lang.ClassNotFoundException: com.RenderHeads.AVProVideo.AVProMobileVideo
    07-11 15:55:50.224: E/Unity(2276): at java.lang.Class.classForName(Native Method)
    07-11 15:55:50.224: E/Unity(2276): at java.lang.Class.forName(Class.java:251)
    07-11 15:55:50.224: E/Unity(2276): at java.lang.Class.forName(Class.java:216)
    07-11 15:55:50.224: E/Unity(2276): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
    07-11 15:55:50.224: E/Unity(2276): at com.unity3d.player.UnityPlayer.c(Unknown Source)
    07-11 15:55:50.224: E/Unity(2276): at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
    07-11 15:55:50.224: E/Unity(2276): at android.os.MessageQueue.next(MessageQueue.java:207)
    07-11 15:55:50.224: E/Unity(2276): at android.os.Looper.loop(Looper.java:123)
    07-11 15:55:50.224: E/Unity(2276): at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
    07-11 15:55:50.224: E/Unity(2276): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load AVProLocal from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.the4thleaf.countdownthegame-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.the4thleaf.countdownthegame-1, /system/lib]]]: findLibrary returned null
    07-11 15:55:50.224: E/Unity(2276): at java.lang.Runtime.loadLibrary(Runtime.java:358)
    07-11 15:55:50.224: E/Unity(2276): at java.lang.Syste
     
  10. AndrewRH

    AndrewRH

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

    Which version of AVPro Video? Which version of Unity?
    The error message indicates that it can't load the native plugin file...could you check that you have it there in the folder: /Assets/Plugins/libs/armeabi-v7a
    Also check the arm64-v8a and x86 subfolders.
    And also click on those files and make sure they are assigned the correct platform and cpu architecture in the Inspector window.

    Thanks,
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    You would have to modify the shader to add support for rotation, or rotate your mesh.
    You can detect what the orientation is by using the helper methods:

    Code (CSharp):
    1. Orientation ori = Helper.GetOrientation(mediaPlayer.Info.GetTextureTransform());
    and you can then get the matrix for the transform by:

    Code (CSharp):
    1. Matrix4x4 mat = Helper.GetMatrixForOrientation(ori);
    You would then have to pass that matrix into the material, setting a new float4x4 field in the shader. Or you could just detect the type of orientation and rotate the whole mesh.

    I hope that helps.

    Thanks,
     
  12. AndrewRH

    AndrewRH

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

    A few questions:
    1) Which player is it that you're using on the phone?
    2) Unity version?
    3) AVPro Video version?
    4) Are you using ExoPlayer or MediaPlayer API (you can toggle these in MediaPlayer > Platform Specific > Android)
    5) What is the Android device you're testing on?

    Hopefully with the above information we can help to answer your question. Sometimes though device manufacturers are able to push their devices more than 3rd party developers, as they have intimate knowledge of their hardware.

    Thanks,
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    We have included various demo scenes in the plugin with progress bar functionality. You can look to see how these demos work in Unity and in the included demo scripts.

    Thanks,
     
  14. AE0715

    AE0715

    Joined:
    Jul 9, 2018
    Posts:
    2
    Hi,

    1)I have used two kinds of players, one is the mobile phone native player(On HUAWEI Mate 10), the other is MxPlayer(On Galaxy s8 PLUS).MxPlayer does not play the video smoothly on Galaxy s8 plus.
    2)2017.3.0f3(64bit)
    3)v1.8.7
    4)Both players have tried and can't play.
    5)One is HUAWEI Mate 10(native player),One is Galaxy s8 plus(MxPlayer)

    After testing, I found that when using the AVPRO plugin, 3840*2160 resolution video can be played, but 3840*3840 can't.
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yeah...3840x2160 is widely supported. Going beyond that is risky unless you're targeting a specific device and know its limitations. I suspect that these players are either 1) using some inside knowledge to help decode larger videos or 2) using software decoding which is very slow (probably what MXPlayer is doing).

    There are a few things you can try:
    1) Try enabling software decoding in the MediaPlayer component (in Android options). This will probably be far too slow though.
    2) Try using OES rendering mode - enable this in MediaPlayer in Android options. You will need to use a shader that is compatible with OES if you're using the ApplyToMesh or ApplyToMaterial components.

    Oculus Go is reported to handle 3840x3840 at 60fps.

    Unfortunately I don't have access to either of your phone models so I can't test with them.

    Cheers,
     
  16. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    779
    @AndrewRH Hey. Could you guys look into Android support in 2018.1 / 2018.2 with IL2CPP as the scripting backend? There are errors with it stripping out your codebase I believe and on Android it cannot load your native code.
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yes we can look into this! Could you tell us what errors you're seeing?
     
  18. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    779
    I have not got the errors in front of me, but it basically cannot find any native libraries you may be using (DLL's, etc). Vuforia is having the same issue right now with IL2CPP on Android. I have had to switch back to Mono on an older version for now.
     
  19. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    It appears that stereo 180º videos are getting stretched vertically on Android – I've tried every setting I can find on the player and the available shaders. 360º videos are working as expected.
     
  20. mitchtbh

    mitchtbh

    Joined:
    Dec 8, 2013
    Posts:
    65
    Creating an app which will contain a large amount of video. Am I somehow able to download the videos at runtime before playing them?

    Just trying to avoid a mass initial download for the app - while not relying on streaming or always having a solid internet connection. So the user downloads the video - and once downloaded can view the video anytime they open the app.

    I've dealt with downloading and spawning assetbundles/prefabs at runtime, but not sure how to accomplish this with video.

    Any help would be much appreciated!
     
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Okay we'll be looking into this today. Which version of AVPro Video are you using?

    Thanks,
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Okay thanks for reporting this. We'll test this today and get back to you.

    Which version of Unity and AVPro Video are you using?

    Also - are you selecting the 180 layout mode in the MediaPlayer component? There is also a demo scene for 180 videos....

    Thanks,
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    AVPro Video doesn't include any facility to download or cache videos. You would have to do this yourself - perhaps using some like WWW class, or the newer Unity download classes. You would write these files into your Application.persistantDataPath and then use AVPro Video to play the media from there.

    Thanks,
     
  24. Peter12331

    Peter12331

    Joined:
    Mar 2, 2014
    Posts:
    4
    Is it possible to play multiple live streamings with AVPro in the same UI? What is the recommended maximum number?

    Thanks
     
  25. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    I'm using 1.8.8. The demo video is a little tough to tell but I think it is vertically stretching. I've tried using the 180 layout on the MediaPlayer, on the shaders directly (even though MediaPlayer overrides most settings), I've tried the HalfSphere mesh, the Sphere mesh, the OctahedronSphere mesh. I've tried 2:1 2048x1024 (stereo 180 side by side) and 3840x2160 (stereo 180 side by side, stretched image to maximize rez).

    This test file demonstrates the vertical stretch nicely: https://www.dropbox.com/s/v6bwq2ustjp1ltl/stereo180_test_grid_v001.mp4?dl=0
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yes you can play multiple. The amount depends on your platform, your stream resolution, and your system resources.

    For example you'll be able to play more streams on a desktop platform (PC / macOS), compared to mobile.

    Mobile hardware only has limited resources for decoding video streams so you can usually decode a single 4K video, or 4 1080p videos (if you're lucky), or a bunch of 360p videos. PC GPUs have the same resource limitations, but they'll generally switch to a software decoder when the GPU decoder is not available.

    If you can give me more specifics then I can give you a clearer answer.

    In general though I wouldn't try to stream more than a 3 1080p videos, or one 4K video...

    Thanks,
     
  27. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Thanks that's a very handy test video.

    So I deployed the video on my Android device and it displayed perfectly. The grid was equally spaced squares..

    All I did was open the "12_Demo_180SphereVideo" sample scene. Set the Stereo-Packing mode to Left-Right and the Layout mode to EquiRectangular 180. Deployed it and it worked.

    I hope this helps you. Let me know if you're still having problems.

    Thanks,
     
  28. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    Did
    Did you build and push to a GearVR or other Android VR headset? It looks fine in Unity, but it's stretching once you build and push. I'm starting an empty project and setting it all up to deploy and will test but I anticipate an identical result as it's been stretching since I first deployed my current project.
     
  29. Peter12331

    Peter12331

    Joined:
    Mar 2, 2014
    Posts:
    4
    Thanks very much for your quick answer.

    I am considering whether it is possible to playback CCTV videos (at least 6 cameras). One with high resolution such as 1920x1080 but others are 640x480.

    What is the best protocols to use between client and servers for videos. HLS may have too big latency?

    Buy the way, what is enterprise license? What is the difference?

    Thanks.
     
  30. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    It's something to do with OES and/or Exo Player – my new project is stretching horizontally, while the pervious project is stretching vertically (in builds on the GearVR) when I enable OES, Exo Player, and use the "Android OES ONLY" shader. I guess I'll abandon OES unless you have a solution? It did improve playback noticeably so I'll be sad to see it go :(
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    If you're looking for a low latency solution then you would need to use some protocol like RTSP. AVPro Video doesn't have wide support for this protocol though. Only really on Windows, and only when you select the DirectShow playback path and install LAV Filters to your system...

    Enterprise license is for large companies with multiple sites/locations who need a license that covers multiple sites. Functionality is the same.

    Thanks,
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Ahh.. there is probably a bug in our OES shader... I will take a look. Thanks,
     
  33. Peter12331

    Peter12331

    Joined:
    Mar 2, 2014
    Posts:
    4
    Hello,

    It seems that some test Streams URLs on the doc stop working.
    Would you mind share a few new links which I can play with?
    Especially for HTTP streaming and HLS :)

    best Regards
    Peter

    I am using VLC as server. It works.

    Thanks
     
    Last edited: Jul 20, 2018
  34. fffMalzbier

    fffMalzbier

    Joined:
    Jun 14, 2011
    Posts:
    2,869
    @AndrewRH : Is the a option with the build in shades to have 2 videos to feed into one 360 sphere. On Video for the left eye and one for the right.
    Another option would be to render separate spheres for each eye, is there a way (without completely rewriting the shader) to select with the shader to what eye the video / material is shown?

    Greetings Malzbier
     
  35. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    @AndrewRH – have you looked into making a Timeline Playable for AVPro? I've been trying to find the most efficient way to combine a few different realtime effects with 360 / 180 video and I keep running up against issues that would be nicely solved in Timeline but the native Video Player in Unity is nowhere near as feature-rich as AVPro. I'm poking at it now, but before I head down yet another rabbit hole I wanted to ask if you've done any work with Timeline or know of any reasons that it would be a bad idea? I just don't want to spend the time making it work if there's a definite reason that it is not worthwhile...
     
  36. Peter12331

    Peter12331

    Joined:
    Mar 2, 2014
    Posts:
    4
    Can I use this plugin for commercial and non-gaming project?
    Is there any open source related IP issue?

    thanks very much!
     
  37. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Yes you can use it for commercial projects. There shouldn't be any open source issues. We don't really use many 3rd party libraries, but these are all listed in the PDF documentation in the plugin.

    Thanks,
     
  38. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hmm, RTSP isn't something we support natively on Windows 7. You would need to install LAV Filters.

    Thanks,
     
  39. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    779
    It was the latest version at the time of posting.
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Okay so I tried IL2CPP with Android, and I think I found the problem. First, here are my settings in Unity 2018.1.6 and using the Android NDK r13b:

    upload_2018-7-22_15-13-20.png

    I think the problem you may be having is because of the new ARM64 feature in Unity... We have a plugin for this, but you currently have to explicitly assign it to the platform. This means you must go to /Plugins/Android/libs/arm64-v8a and select all of the files in there. Then in the Inspector window, enable Android and apply. Then select each file in that folder and assign the ARM64 profile:

    upload_2018-7-22_15-15-36.png

    I hope that helps you.

    Thanks,
     
  41. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    779
    Brilliant thanks for the help. Will this be automated in future versions?
     
  42. avclubvids

    avclubvids

    Joined:
    Jan 6, 2015
    Posts:
    11
    @AndrewRH is there a reason for using NDK r13b vs. 17b? Just wondering if that is a specific recommendation to use with AVPro or if that is just the version you have currently installed.
     
  43. MUbRecoS

    MUbRecoS

    Joined:
    Jun 22, 2018
    Posts:
    2
    Hi,

    I am considering implementing HLS live streaming.

    I am able to play HLS streams with AVPro easily.
    However, the video will freeze due to streaming lags (etc) and I am having trouble with what to do after that happens.
    AVPro plays the video from where the video left off before freezing.

    This would be correct if we were playing pre-recorded videos, however, I would like to stream live broadcasts.
    I want the stream to always display the newest images from the broadcast.

    What should I do in order to accomplish this?
     
    Last edited: Jul 26, 2018
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    The shaders don't support inputs from 2 different Media Players.
    There is however in the UpdateStereoMaterial a enum field where you can select which eye it renders, so you could try to use this and two spheres as you said. Having 2 video feeds isn't ideal though because they won't keep in sync. I hope this information helps you.

    Thanks,
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    We haven't looked yet at the Timeline or Playables yet just due to lack of time...
    If you make any progress on this I would love to hear about it!

    Thanks,
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    No reason in particular. I think this was just what Unity asked for, or what I had installed...I'm not totally sure.

    Thanks,
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,611
    Hmm...well if it stalls you could perhaps try seeking the video to the start/end?
    Which platform is this on?

    Thanks,
     
  48. Baradov

    Baradov

    Joined:
    Sep 18, 2017
    Posts:
    1
    Hello, i try to run video in Unity (on sphere) with AVPro on Intel® HD Graphics 405 (UDOO x86 Ultra) on Windows 10 and it runs slow. But at the same time this video runs in VLC player with good performance. Hardware decoding enabled. What i do wrong?
     

    Attached Files:

  49. MUbRecoS

    MUbRecoS

    Joined:
    Jun 22, 2018
    Posts:
    2
    Thank you for your response.
    The platforms we're using are iOS and Android.
    I've tried using the process below to seek the video.
    Code (CSharp):
    1. mediaPlayer.Control.SeekFast(0);
    When I did this in the editor, it did something close to what I wanted to do, but on Anroid there was an error.

    [AVProVideo] Error: Decode failed. Possible codec not supported, video resolution too high or insufficient system resources. On Android this is generally due to the hardware not having enough resources to decode the video. Most Android devices can only handle a maximum of one 4K video at once.

    What should I do to seek the video on iOS and Andoid?
     
  50. wz673744509

    wz673744509

    Joined:
    Jul 1, 2013
    Posts:
    1
    Hello!
    v1.8.9
    win10
    I shot video on my cell iPhone6s(1920*1080@60fps)
    use preferred video api media foundaction play is frame drop
    the playback shows carton
    use directshow is ok
     

    Attached Files: