Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] AVPro Video - complete video playback solution

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

  1. Duoliang

    Duoliang

    Joined:
    Jul 26, 2016
    Posts:
    5
    OK, I see the direction, that really helps, thanks a lot!!
     
  2. AndrewRH

    AndrewRH

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

    Here is a sneak peek at some of the features coming soon in AVPro Video version 1.4.0:
    • Full Hap codec support on macOS
    • New multi-threaded Metal rendering path for macOS
    • Major improvements to iOS rendering paths
    • WebGL support
    • Multiple audio track support (great for supporting multiple languages)
    • Android playback rate adjustment support (Android 6.0+ only)
    • Packed (top-bottom / left-right) transparency support with demos
    Of course there are other changes but those are some highlights :)

    Thanks,
     
  3. Mandelboxed

    Mandelboxed

    Joined:
    Apr 17, 2015
    Posts:
    50
    I was hoping to be able to use AVPro for an application that can stream video and for the most part AVPro works great, but in testing with the trial version I noticed that a few crucial functions were either missing or did not work properly (at least on Windows).

    Buffering progress: I would like to be able to display the percentage of the video that has been loaded but could not find any way to retrieve this information.

    Seeking: Seeking in a streamed video requires that the user wait until the video has loaded from the beginning to the sought point.

    Are you guys likely to release a new version will support either of these features any time soon?
     
  4. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Yes, could be best to control all parameters. For now I found a preset that works with h264 on Handbrake for W7.
     

    Attached Files:

  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes we are also adding buffering progress into version 1.4.0 :)
    Seeking - it very much depends on the streaming protocol that you're using. This is certainly true for HTTP streaming of a file - it must download it linearly from the beginning. If you use another type of streaming such as HLS then it should be able to skip to any party.

    Thanks,
     
  6. mkneib

    mkneib

    Joined:
    Aug 3, 2016
    Posts:
    8
    Hi Andrew, i have similar same problems with a Cardboard App (0.8.1).
    The video stutters, freezes and the app crashes on IOS.




    Newest Unity (5.4.0f3, appears also on 5.3.6f1p)
    Newest AVPro (1.3.9, appears also on previous Version)
    Cardboard 0.8.1
    Iphone 5S and 6 with iOS9.3.3

    I try to reproduce the errors with a simple unity-project, started from the ground up.
    The stuttering already appears, without cardboard. But no crashes so far.

    Video:
    H.264, 1920 × 1080, 16,7 Mill. 30fps
    It's your SampleSphere.mp4 video.

    The project is just your Demo_360SphereVideo scene, exported as iOS App.


    Any ideas?

    greets
    Micha


    Edit: switched back to 5.3.6f1, the stuttering disappears!!
    I'll import cardboard now and see what happens.
     
    Last edited: Aug 3, 2016
  7. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @mkneib I reported the stuttering on Unity 5.4 (iOS) during the Unity beta period. I heard there was an internal workaround in case it was needed. Apparently it wasn't submitted yet.

    The funny part is that the stuttering also occurs with other video-to-texture plugins on Unity 5.4.
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, I believe it is due to the introduction of multi-threaded Metal rendering path in Unity. It's quite tricky to support. That said, we have v1.4.0 almost ready for release now and it contains a fix for this. I'll announce the release on this thread soon.
     
  9. mcspross

    mcspross

    Joined:
    Dec 13, 2012
    Posts:
    2
    I am having an issue with a large hap-codec video not working in a build on Windows. The video plays and works fine while in the Unity Editor on Windows but once you build it does not work at all.
    In the standalone build's output_log file I have the following error.

    [AVProVideo] Failed to open C:/Users/Steve/Desktop/OuterWallVideo/videoTest_Data/StreamingAssets\WideVideo_AdobeHap.avi​

    I have tested smaller hap encoded videos using the same workflow and they work in the standalone windows build without any problems. I am sure that Force DirectShow is checked.
    A few details. The video is 3.87 GB. It is an unusual and large resolution of 6480 x 1920. It was encoded using the latest version of Adobe Media Encoder CC.
    Software: I am using Windows 10 Pro (64-bit), Unity 3.4.0f3, and AVPro Video 1.3.9.

    Hardware:
    Intel Core i7-5960X @ 3.00 GHz
    64 GB Ram
    SSD with over 100 gigs free
    2x GeForce GTX 980 Ti

    Do you have any suggestions on how to solve this problem?
     
  10. mcspross

    mcspross

    Joined:
    Dec 13, 2012
    Posts:
    2
    Tried re-encoding as an .mov using hap instead of .avi. It works now.
     
  11. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Hey there. I have a small problem.

    I am triggering the video manually when I get to a point. Basically the Video (Media Player Script) & my Quad (that id going to display the video) are disabled in the hierarchy. When I want to display the video I enable their game objects. Normally it works fine, but in this case, I have a 1 second freeze.



    So I did a couple of tests and I don't think it likes the fact that I'm enabling the video game object. If I leave the video open and the "Auto-Start" disabled, it seems ok... however, how do I make a video to play?

    Keep in mind that I use PlayMaker. Is there a Method that I can call in order to stat a video? I tried to "enable the Auto Play" checkbox but it doesn't work... :p



    Those are the stuff that I can call with the Method.

    Thanks

    EDIT:
    I like Murphy's Laws sometimes ... I just posted this... and I immediately found the answer :D I just wrote "Play" in the Method Name ... and it works :D

    EDIT:
    Ok let's try this again :D
    Is there a way to know when a video has ended... that way I can go back to m "Wait" state?
    I think this one is a bit harder because somehow PlayMaker needs to "listen" for this so it will execute an Event.

    ---
    Yea. There is FinishedPlaying ... but as I said, I think that someone needs to make a PlayMaker action... that action can actually play the video itself, and then have a "Finish Event"... then you use PlayMaker to specify what event to trigger when "FinishedPlaying" happens.

    Any chance for a PlayMaker integration? :D
     
    Last edited: Aug 5, 2016
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Glad to hear you have this working! Yes I think AVI doesn't have as high resolution support as MOV does. Best of luck.
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    PlayMaker - good idea. Feel free to email me an example PlayMaker action script...I should then be able to build a bunch of those if you're happy to test them. Let me know which actions you want. email: unitysupport@renderheads.com

    Thanks!
     
    GamerPET likes this.
  14. ExcellencyHong

    ExcellencyHong

    Joined:
    Aug 9, 2016
    Posts:
    33
    i love to use AV Pro.it is a fantastic Plugin :)

    now, I'm trying to find out one solution how to play movies seamlessly. i try to play several movies and when the next movie play start, the AV Pro is show up the black blank frame for 1~2 frame time, in My Galaxy S6.


    how to make it play seamless?
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi!
    This gap happens because when the next video loads the previous texture becomes invalid for a frame or two. There are a few things you do to to get around this:

    1) Fade to black between video loads
    2) Make a copy of the texture to a RenderTexture and display that until the second video has a valid texture
    3) Use two MediaPlayer components and flip-flop between them when they have a valid texture.

    We will try to build this behaviour into a future version of the plugin.

    Thanks,
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    AVPro Video 1.4.0 has just been released!

    Download it now at the Asset Store, or get the free trial version from our website.

    Changes include:
    • WebGL - WebGL is now supported!
    • macOS - Now supports Metal rendering path
    • Hap codec - Now fully supported on macOS
    • iOS/tvOS - Many improvements to the rendering performance
    • Android - Ability to adjust the playback rate (Android 6.0 and above only)
    • Windows - Fixed audio device override not working in builds

    • General
      • Added support for video files containing multiple audio tracks
      • Video frame rate is now available via Info.GetVideoFrameRate()
      • Fixed some issues with events firing at the wrong time
      • Streaming videos can now query IsBuffering() and GetBufferingProgress()
      • Improved errors reporting
      • Renamed Info.GetVideoPlaybackRate() to GetVideoDisplayRate() to avoid confusion
      • New “scriptlets” have been added to the /Demos/Scripts folder which give mini examples of how to do simple scripting
    • VR
      • Fixed bug in stereo section of VR sphere shader which caused eyes to flip on some platforms
      • Fixed a bug in Windows where the audio override wasn’t being passed through for VR headphone device name
    • Workflow
      • Added new “SA” button for shortcut to StreamingAssets folder
      • Improved editor inspector performance
    • Upgrade notes

      • Demos scenes have been renamed so you should delete the old .unity files in the /Demos folder otherwise you will have duplicate files.
      • The sample video files in StreamingAssets have been moved into a subfolder within StreamingAssets/AVProVideoDemos/ so make sure to delete the old ones.
    Thanks,
     
  17. luispedrofonseca

    luispedrofonseca

    Joined:
    Aug 29, 2012
    Posts:
    938
    @AndrewRH Does this version address the stuttering issue on Unity 5.4 iOS?
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes it should fix the stuttering on iOS :)
     
    luispedrofonseca likes this.
  19. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    @AndrewRH

    Hi, I'm getting this error with the demo package from your site.

    EntryPointNotFoundException: AVPPlayerGetLastError
    RenderHeads.Media.AVProVideo_OSXMediaPlayer.Update () (at Assets/AVProVideo/Scripts/Internal/OSXMediaPlayer.cs:537)
    RenderHeads.Media.AVProVideo.MediaPlayer.Update () (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:413)
     
  20. Hanoble

    Hanoble

    Joined:
    Apr 18, 2013
    Posts:
    28
    I am currently using a different plugin to play a movie on two different spheres for a 3D 360 video (left eye and right eye), but we are seeing some performance issues and are looking to make a change. This is a GearVR/Cardboard app, where performance is really a big deal.

    Does this plugin support the ability to play the video onto two different spheres at once, or is that something that would need to be modified in order to work? I have just pulled down the sample package and am not seeing anything like that, but am worried about having to play multiple video players in a single scene.

    UPDATE : Going over the documentation included now, and this looks like it is built-in to the player.
     
    Last edited: Aug 11, 2016
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Woops! It seems like we may have included an old plugin file for OSX in the trial! We will look into this right away. In the meantime you can probably just comment out that line, eg:

    //_lastError = AVPPlayerGetLastError(_player); /// line 537

    Thanks for reporting this,
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Yes, AVPro Video supports any number of videos at the same time (hardware dependent). I wouldn't recommend more than one 4K video on Android. In our experience it doesn't have the memory or GPU decoding ability to do this. This is why most 4K videos have stereo packed either top-bottom or left-right.
    We include a shader called InsideSphere which already has stereo support, so you don't need to have two of them in your scene. It supports the stereo top-bottom and left-right packing formats and automatically detects which eye is rendering.

    I hope that helps.
     
  23. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    @AndrewRH

    No worries!

    But commenting out line 537 throws this error:
    EntryPointNotFoundException: AVPPlayerGetTexture
    RenderHeads.Media.AVProVideo_OSXMediaPlayer.UpdateTexture () (at Assets/AVProVideo/Scripts/Internal/OSXMediaPlayer.cs:515)

    I wanted to test v1.4.0 as in 1.3.9 changing the playback rate of a video to over 2.0 or under -2.0 resulted in very stuttery playback - is this fixed in 1.4.0?

    Thanks.

    EDIT: Using Unity 5.4
     
  24. AndrewRH

    AndrewRH

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

    I wonder if perhaps the upgrade didn't work correctly....In the console/log does it correctly report both version numbers as 1.4.0? Or perhaps you could try the unitypackage in the fresh project? Sometimes if you import a new Unity package after you've run the scene, Unity will lock the plugin file which will prevent that file from being updated... Please let me know :) Keen to fix it!

    I'm not sure if this is "fixed" in 1.4.0. The results of playback rate adjustment is highly dependent on how the source video is encoded. The more key-frames and the fewer reference and B frames you have, the better it will work. The sample video BigBuckBunny_720p30.mp4 is encoded with many key-frames, so I would recommend you use this as an example/test for chaning the playback rate. I know we did a lot of work fixing up the Metal graphics API to improve performance and reduce some flickering bugs, so it may well be improved.

    Please let me know about the above.
     
  25. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    I just updated the Android Plugin to latest version and noticed that in 360SphereVideo default texture won't go even I can see the video being played in inspector of AVPro Video Media Player Object. @AndrewRH can you please tell how to fix this. I would be grateful to get some pointer. And If you briefly tell me what methods should I call to play and stop a video. because I can see Stop() / CloseVideo() and OpenVideoFromFile() / Play(). Not sure what order should I call them. I don't want to use code from demos, so a simple code sample as following would be helpful.

    Code (CSharp):
    1.     class VideoPlayer : MonoBehaviour
    2.     {
    3.         public MediaPlayer _player;
    4.  
    5.         public void PlayVideo()
    6.         {
    7.             // what methods of _player should I call here to play
    8.         }
    9.  
    10.         public void StopVideo()
    11.         {
    12.             // what methods of _player should I call here to stop
    13.         }
    14.  
    15.     }
    16.  
     
  26. AndrewRH

    AndrewRH

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

    Could you give more details about the "360SphereVideo default texture won't go" issue? Is this using the included demo scene "08_Demo_360SphereVideo.unity"?

    Here is some code:

    Code (CSharp):
    1.         public void PlayVideo()
    2.         {
    3.             _player.Play();
    4.         }
    5.  
    6.         public void StopVideo()
    7.         {
    8.             _player.Stop();
    9.         }
    Quite simply :) Perhaps i've misunderstood what you're trying to do...Let me know if you need more information. Also please get back to me about the above question - if it's an issue with the demo we need to fix it so that other people don't have the same issue.

    Thanks,
     
  27. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
    Thanks a lot for quick reply. I figured it out now. Previous prefab was using "Apply to Material" Component where as new one uses "Apply to Mesh". I had some specific implementation which was causing the issue. Regarding sample code how can I try to play a different video. When I set video path it still plays the video which I played for first time. Here is code that I am using:
    Code (CSharp):
    1.   public void PlayVideo(string videoPath)
    2.         {
    3.           _player.m_VideoPath = videoPath;
    4.           _player.Play();
    5.         }
    6.         public void StopVideo()
    7.         {
    8.             _player.Stop();
    9.         }
     
  28. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    1.4.0 works in a fresh project!

    Still having problems changing the playback rate above or below 2 though, very smooth playback up till you hit 2.0 then everything above is jerky, happens with the BigBuckBunny_720p30.mp4 and my own mp4's- I'll post a video of the behaviour.
     
  29. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163

    Bit hard to see how jerky it gets but note the framerate drop in the preview section of the inspector.
     
  30. ewtwer5522

    ewtwer5522

    Joined:
    Aug 12, 2016
    Posts:
    2
    When is playlist like AVPro Windows Media Demo mounted?
     
  31. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks for reporting this. Our macOS/iOS guru will look at this next week. What happens if you set it to another whole number such as 3 or 4? Anyway, we'll look into this and see if something can be done. Cheers,
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi! I don't know if I understand correctly but I think you're asking when we will include a playlist component? This is something we're looking at - hopefully for the next release :)
     
  33. Duoliang

    Duoliang

    Joined:
    Jul 26, 2016
    Posts:
    5
    Hi! I just find out that if a video that has sound in it is played with a video without sound at the same time(auto open, use button to start), the one with sound will play some frames later, so if you want to let two movies play at exactly same time you'd better set another player to play the sound then there will be no lag and you can use wav file to get better sound quality.
    Hope this is helpful~
     
  34. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Duoliang,

    Interesting observation! Thanks for sharing. I guess you could also perhaps also encode the second video with a silent audio track, or set it's volume to zero. I wonder if that might work too.

    Thanks,
     
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    I spoke with our iOS/macOS guy and he says that this playback rate behaviour is beyond our control and is just how Apple have implemented it. He also says that if you use a video with only I-frames (no P or B frames) then it might play back smoother and at the expected rate. It's worth a try certainly!
     
  36. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    If you set the path then you need to tell it to load the video from the path. Do you need to add this:

    _player.OpenVideoFromFile(MediaPlayer.FileLocation.RelativeToStreamingAssetsFolder, videoPath, true);

    Hope that helps!
     
  37. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    163
    Ah that's a shame, thanks for looking into it though, I'll check the I-Frame thing when I get a moment.
     
  38. infinite360VR

    infinite360VR

    Joined:
    Apr 19, 2016
    Posts:
    23
  39. glardon

    glardon

    Joined:
    Apr 8, 2015
    Posts:
    14
    Hi,

    About this point in the 1.4 release :
    ■ Fixed bug in stereo section of VR sphere shader which caused eyes to flip on some platforms

    I was happy to see this issue fixed, but the it is still there when using the ApplyToMaterial behaviour.
    When using ApplyToMesh it's ok, well working.

    So i'm not blocked, i just switched to ApplyToMesh, but maybe you should have a look at ApplyToMaterial issue ;)

    Thanks,

    Grégory
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks Grégory, I'll see if we can do something about that for the next release :)
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Everyone,

    We'll be releasing a new update to the AVPro Video plugin soon (any day now).

    I just wanted to let you know what to expect. There are two main features in this update:

    1) Packed transparency support for all platforms

    Now you'll be able to load your top-bottom or left-right videos with alpha channel packed in. AVPro Video will navitely support these packed formats and render them as transparent videos!

    2) Huge speed improvement for Windows video playback

    Anyone using the "Force DirectShow" software playback path will now benefit from massive optimisations. This will help especially for those large 4K video files used in VR. This optimisations result a 150% reduction in bus bandwidth use = faster and smoother video playback with lower CPU usage

    We also have other things like minor optimisations, support for HapQ in Windows etc...

    Thanks,
     
  42. HarryE22

    HarryE22

    Joined:
    May 20, 2013
    Posts:
    12
    I'm getting this bug in my project. Any idea on what to do about it?
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    In WebGL?
     
  44. HarryE22

    HarryE22

    Joined:
    May 20, 2013
    Posts:
    12
    Yup. None of my other Unity 5.3.6 WebGL builds have this issue. :/
     
  45. AllonVR

    AllonVR

    Joined:
    Jul 16, 2012
    Posts:
    28
    Hi there,
    I'm testing the 1.4 trial version for a stereoscopic video project and the top-bottom detection does not seem to work.
    I have tested this both in 5.3.6 and in 5.4.0, but none of the InsideSphere StereoMode settings appear to have an affect. It will not play a top/bottom video in stereo. This also happens when I play 08_Demo_360SphereVideo with the AlphaTopBottom video. I am on Windows 10 BTW.
    Is there another setting I need to adjust?
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Okay we'll look into this. It still sounds like a Unity bug though.
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Did you set the top-bottom mode in the "Media Properties" panel of the MediaPlayer component?
     
    ColinNorthway likes this.
  48. AllonVR

    AllonVR

    Joined:
    Jul 16, 2012
    Posts:
    28
    Wonderful, that did the trick! I assumed that I should only adjust the material. Thanks!
     
  49. JoRouss

    JoRouss

    Joined:
    Apr 1, 2014
    Posts:
    53
    Hi, I'm trying to port a standalone build to UWP.

    I have some trouble with the DLLs :

    I tryed adding the WSA Player to the platform settings of these 4 files
    I tryed with the "Don't process" ticked and also without it.


    This is what I get in VS :



    "The item {...} does not exist in the current directory"


    I don't know what to do, thanks for the help!
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Good news! We found the bug in WebGL causing the flipped text. The fix should be released before Monday. Thanks!