Search Unity

[Released] AVPro Windows Media

Discussion in 'Assets and Asset Store' started by AndrewRH, Jul 4, 2012.

  1. momay

    momay

    Joined:
    Jul 7, 2013
    Posts:
    9
    could you please let me know the steps to play back a movie with alpha = transparency.

    I have my own movie so I need to convert it with ffmpeg.
    And then load it in unity3d.
    Can you please lay out each step for me?

    Thank you, really like your software!
     
  2. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Is this plugin working with unity 4.6?
     
  3. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    122
    I have been using this plugin with unity 4.6 beta 17 without any problems as far as I have noticed.
     
  4. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Thank you :)
     
  5. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    I would like to use the AVWindowsMediaMaterialApply script with Unity's new UI system. My video material is visible on objects that have a mesh filter and renderer, but on a UI RawImage that references that same material, it is not visible.

    Any suggestions on how I could modify this library to work with Unity's new RawImage UI component?
     
  6. bpolley

    bpolley

    Joined:
    Mar 18, 2014
    Posts:
    10
    Whenever I play my scene, I receive a pop-up with the following message:

    Plugin DLL not found. Unity needs the native plugin DLL files to be copied to the /Assets/Plugins folder. Would you like us to do that for you?

    If I click 'Yes, copy' or even if I move the files myself, the pop up persists every time I attempt to play my scene along with the error:

    DllNotFoundException: AVProWindowsMedia
    AVProWindowsMediaManager.Init () (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaManager.cs:114)

    Any suggestions on how to get the DLLs recognized?
     
  7. justinhdmeijer

    justinhdmeijer

    Joined:
    Oct 13, 2014
    Posts:
    8
    You should take a look at 7.3 and 7.4 in the documentation.
     
  8. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Any timeline on getting this to work with Unity 4.6 UI?

    Currently it always renders on top (depth does nothing). I would like to put some 4.6 UI elements on top of my video, without having to render the video on a mesh.
     
  9. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    There was a question earlier in the thread whether AVPro supports 4K video. The answer was that nobody knows and that it probably depends on the codec.

    Did anyone test this yet? If it works I'm ready to buy the asset!
     
  10. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    I was able to get this to play 4K videos using the Hap Codec.
     
  11. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    Thanks! One more question. Which has best performance using the Hap codec on Windows; AVPro Windows Media or AVPro Quicktime?

    EDIT: Without testing this, I would presume that AVPro Windows Media wins because it can run in 64 bit.
     
    Last edited: Oct 28, 2014
  12. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    How does one compress to a .avi file using the hap codec? Compressor on Mac does not seem to allow this, only to .mov files.
     
  13. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    261
    Hi there.

    Can AVPro Windows Media take pixel aspect ratios into account, and is there a way to correct for non-square pixels?
    For example, almost all PAL videos (=usually 720:576) will have non-square pixels and must be displayed at different resolutions (i.e., 768:576 for 4:3) to be undistorted. The problem gets even worse (and quite noticeable) for anamorphic videos (i.e., any DVD stream of a 16:9 video).

    Thanks a lot!
    Wolfram
     
  14. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    I don't believe you can compress to .avi on a mac. This plugin is the Windows Media version anyways, so I assume you should be on a Windows machine. There is a quicktime version of avpro though.
     
  15. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I found that the app MPEG Streamclip does the trick! =)
     
  16. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    862
    I keep getting the message "DllNotFoundException: AVProWindowsMedia-x64" although the DLLs are copied into the Plugins folder (Unity 4.6.0b20). The problem occurs when I import the Kinect v2 SDK assets and run a test scene. I need both plugins to run in the same project.

    Deleting the Library folder and reopening the project, like described in an earlier post, does not help. Copying the DLL's into repectable x86 and x86_64 folders inside the Plugins folder does not help either. If I switch the editor to 32bit, the message just changes to "DllNotFoundException: AVProWindowsMedia". In Unity 5 everything works, except that playback of Hap files (which unfortunately is what I need) crash Unity.

    I am stuck and it is urgent. Andrew, any hints?

    Error:
    DllNotFoundException: AVProWindowsMedia-x64
    AVProWindowsMediaManager.Init () (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaManager.cs:114)

    *UPDATE

    Adrew proposed to move the DLLs into x86 and x86_64 folders inside the Plugins folder. I guess it is a similar issue to this:
    https://developer.oculusvr.com/forums/viewtopic.php?f=37&t=9868

    It works now, sort of. Sometimes the editor complains about the missing DLL. Then I delete the Library folder and restart Unity.
     
    Last edited: Oct 30, 2014
  17. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Nice! Good to know.
     
  18. solarflare_s

    solarflare_s

    Joined:
    Feb 14, 2013
    Posts:
    10
    Hi we have the playback of a 4k mp4 file with a h264 codec working on one of our dev PCs, but when we shared the project to a different PC, whenever we play we get the following error.

    [AVProWindowsMedia] Movie failed to load
    UnityEngine.Debug:LogWarning(Object)
    AVProWindowsMedia:StartVideo(String, Boolean, Boolean, Boolean, Boolean, Boolean) (at Assets/AVProWindowsMedia/Scripts/Internal/AVProWindowsMedia.cs:165)
    AVProWindowsMediaMovie:LoadMovie(Boolean) (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovie.cs:73)
    AVProWindowsMediaMovie:Start() (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovie.cs:50)


    [AVProWindowsMedia] Couldn't load movie 04_Dubai_01_2k.mp4
    UnityEngine.Debug:LogWarning(Object)
    AVProWindowsMediaMovie:LoadMovie(Boolean) (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovie.cs:84)
    AVProWindowsMediaMovie:Start() (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovie.cs:50)


    Get the same for a 2K version, and a mov, all of which work on the first pc.
    The location of the files are the same, reinstalled quicktime to check codecs are up to date.
    Do you have any ideas?
    Thanks

    ***UPDATE***

    So although the video could play on both our PCs it seems the other PC didnt have the correct direct show codecs installed.
    So we installed the K Lite codec pack (standard) and its all working!
    Installed the mega pack first, and it stopped some of our builds playing! Which was very strange. So unistalled and used the standard pack!
     
    Last edited: Nov 7, 2014
  19. kylekaturn

    kylekaturn

    Joined:
    Feb 24, 2013
    Posts:
    20
    Is this plugin support UNITY3D 5.0 beta version?

    It seems plugin not workin with 5.0b
     
  20. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    Hello,

    I'm trying to play DVD video disk and get a lot of stuttering during play when loading .VOB files. Is there any tips for that?
     
    Last edited: Nov 17, 2014
  21. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    @vladk : I'm pretty sure you will not be able to directly read your file from a DVD disk as it will not be fast enought to stream datas to Unity.

    If you read it from a good HDD or SSD, did you install the LAV filter pack before attempting to play .VOB files as statted in AVProWindows doc (FAQ 14) ?

    Also playing .VOB files could be an expensive task on some hardware, did you try to play it in another player (like VLC) to see if the stuttering is prensent ?


    On my own way, I'm actually in trouble, trying to change the Playback Rate of video while it plays.
    I need to update the playback rate (clamped between x0.5 and x1.5) every seconds, according to user inputs and every time I send a SetPlaybackRate() to my player, I have a little stutter and it drops few frames before playing again normally.
    Thats a very anoying behavior as it breaks the experience.

    This issue appear while the file is directly streamed from disk.
    I'm using this to play video :
    Code (CSharp):
    1. void AutoPlay(string path) {
    2.             videoController.avProMovie._folder = "";
    3.             videoController.avProMovie._filename = path;
    4.             videoController.avProMovie._volume = 1.0f;
    5.             videoController.avProMovie._loop = true;
    6.             videoController.avProMovie.LoadMovie(true);
    7.     }
    8.  
    9. public void SetPlaybackSpeed(float playbackSpeed) {
    10.         avProMovie.MovieInstance.PlaybackRate = playbackSpeed;
    11.     }
    I give a try loading the file in RAM but once I try to change playback rate, video stop playing.
    Code (CSharp):
    1. void AutoPlayMemory(string path) {
    2.             if (File.Exists(path))
    3.             {
    4.                 byte[] bytes = System.IO.File.ReadAllBytes(path);
    5.                 if (bytes.Length > 0)
    6.                 {
    7.                     _bytesHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
    8.                     _moviePtr = _bytesHandle.AddrOfPinnedObject();
    9.                     _movieLength = (uint)bytes.Length;
    10.                     videoController.avProMovie.LoadMovieFromMemory(true,  movieName, _moviePtr, _movieLength);
    11.                 }
    12.             }
    13.         }
    Video file used is 4K resolution encoded with h264 codec in Handbrake.
    Any hint ?
     
    Last edited: Nov 18, 2014
  22. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    Thanks for the tip, but it didn't help at all :( As far as I understand what I'm experiencing is the "scrambling" that encrypted DVD shows if trying to play video directly form the VOB file. And Installing LAV Filters didn't make it any better or different. Is there any special configuration for the LAV filters should be made to make them work correctly?
     
  23. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Did it appends in VLC too ? If not, could be related to codecs. I didn't have any experience with VOB files but it works right out of the box for h264 files using Software Decoder option at installation for me.

    If it's related to scrambling, then I didn't see any other option than riping the video from DVD to a compressed format. AVProWindows cannot proceed to any unencryption as far as I know.
     
  24. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    @Exsight: I didn't understand what "Did it appends in VLC too ?" means. Could you please explain further?
     
  25. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Can you play your VOB files in VLC or another compatible player without any stuttering or glitch effect ? If it's ok then problem is not comming from data encryption.
     
  26. vladk

    vladk

    Joined:
    Jul 10, 2008
    Posts:
    167
    nope, the VLC and Pot players both show distorted picture and sound stuttering. The only thing about VOB files in the AVPro help docs - is to install LAV Filters, which I did and it didn't help :(

    I wonder how I can contact with the developers - they don't answer any emails and they aren't in the forums, the plugin is quite expensive and it's strange that we can't get any help from the developers of the plugin :(
     
  27. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Did someone could help me about Playback Rate issue ?
    I did some tests with more iFrames (or ReFrames) in video file and CBR bitrate encoding but this didn't help...

    Perhaps something wrong with h264 codec ?
    @AndrewRH are you still there o_O
     
  28. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Is this plugin compatible with Unity 5 (beta) and Oculus Rift? Would love to know :)
     
  29. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Some errors on trying to build standalone windows, see photo. Thank you!

    https://www.dropbox.com/s/q9po2e8og55qdor/Untitled 49.jpg?dl=0

    Basically they are all complaining about:
    Can't open include file "AVProWindowsMedia_Shared.cginc"


    Using Unity 4.6 p1
    Windows 8.1
    Nvidia GPU


    Any ideas?

    Edit: Fixed it! I had my AVPro folder in a subfolder. I like to keep my plugins in a separate folder. Moved it to the root of Assets and no longer receiving the error. It's strange that I don't have the same problem on my AMD GPU machine though...
     
    Last edited: Dec 5, 2014
  30. justinhdmeijer

    justinhdmeijer

    Joined:
    Oct 13, 2014
    Posts:
    8
    I'm using this with the Oculus Rift and it works for me. I only use it to show a video on a screen, so nothing advanced. I don't know about Unity 5.
     
  31. g__b

    g__b

    Joined:
    Sep 17, 2014
    Posts:
    39
    I am posting this here since I had no answer via email

    I could play succesfully an avi ARGB file 1366x720 encoded in Lagarith Lossless, using the script AVPro Windows Media Movie, and loading from desktop.
    Now I'm trying to load from Resource folder (using the script AVPro Windows Media Movie From Resource, after importing the video with ".bytes" at the end of the name), but the video doesn't show up, even if it is loaded.
    First time I try to load from resource I have OutOfMemoryException. Then it loads fine, but no play.

    [AVProWindowsMedia] Loaded video 'ARGB_TEMPLARE_1366x720.avi' (1366x720 @ 25.00 fps) 2906 frames, 116.24 seconds - format: RAW_BGRA32
    UnityEngine.Debug:Log(Object)
    AVProWindowsMedia:CompleteVideoLoad(Boolean) (at Assets/AVProWindowsMedia/Scripts/Internal/AVProWindowsMedia.cs:222)
    AVProWindowsMedia:StartVideoFromMemory(String, IntPtr, UInt32, Boolean, Boolean, Boolean, Boolean, Boolean) (at Assets/AVProWindowsMedia/Scripts/Internal/AVProWindowsMedia.cs:192)
    AVProWindowsMediaMovie:LoadMovieFromMemory(Boolean, String, IntPtr, UInt32) (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovie.cs:101)
    AVProWindowsMediaMovieFromResource:LoadMovieFromResource(Boolean, String) (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovieFromResource.cs:40)
    AVProWindowsMediaMovieFromResource:Start() (at Assets/AVProWindowsMedia/Scripts/Components/AVProWindowsMediaMovieFromResource.cs:24)

    How can I export an app that has this video inside it?
     
  32. Thomas-Pasieka

    Thomas-Pasieka

    Joined:
    Sep 19, 2005
    Posts:
    2,174
    Well I guess the lack of response speaks for itself then...
     
  33. MaxDesRoches

    MaxDesRoches

    Joined:
    Nov 5, 2014
    Posts:
    7
    I fixed the Plugin DLL not found. Unity needs the native plugin DLL files to be copied to the /Assets/Plugins folder. Would you like us to do that for you? error by moving the AVProWindowsMedia.dll file in Assets/Plugins/x86 and AVProWindowsMedia-x64.dll in Assets/Plugins/x86_x64 folders.
     
  34. linruigongzi

    linruigongzi

    Joined:
    Dec 19, 2014
    Posts:
    1
    Can some one help me ?
    I am trying to apply the movie to a panel use AVProMedia in unity, and i want to shake the panel with the same frequency of the movie's to remove the movie's shake, but I notice that when I pick the player's position seconds in that panel's update method in Unity, the player's image doesn't change synchronize with the player's position seconds,so does the position frames. (The order will be "the position seconds","the player's image","the player image" in three update).
    I wanna know exactly when does the player's image changed and in which method. so can I synchronize it myself.
    Thanks.
     
  35. virtualreal

    virtualreal

    Joined:
    Dec 19, 2014
    Posts:
    3
    Hello, I have bought the Unity plugin AV PRO WINDOWS MEDIA and I have a problem when I try to watch videos with more than 30fps. With a previous version of Unity, the videos run flawlessly, but when I compile with the latest Unity 4.6.1f1, the videos run sumbling, it seems that the videos doesn't run at 50fps actually.

    I tried to create a new project from the bones only with the plugin and compiling the PlayDemoVideo scene and the problem persists.

    If I execute my previous compilation there is no problem with the watching.
    It seems to be something related to the latests version of Unity, do you know something about this problem?

    Thank you very much.
     
  36. AndrewRH

    AndrewRH

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

    Sorry for the lack of replies, I haven't had enough time lately! We're still supporting the plugins and will continue to make updates. We're gathering all the latest user feedback and will be making some new releases shortly!

    Thanks,
     
  37. pajamajama

    pajamajama

    Joined:
    Oct 22, 2012
    Posts:
    66
    Trying to play a video using the GUIDisplay script. It loads fine and I can hear the audio, but no visuals. I have this error:

    Shader error in 'Hidden/AVProWindowsMedia/CompositeYUY2709_2_RGBA': failed to open source file: 'AVProWindowsMedia_Shared.cginc' at line 23

    I'm on Windows 8.1 with Unity 4.6
     
  38. AndrewRH

    AndrewRH

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

    That's a very strange error. I've just tested in 4.6 and it works fine. Can you verify that the 'AVProWindowsMedia_Shared.cginc' file exists in your project? Also can you check that the #include line in the shader wasn't modified? It should simply read: #include "AVProWindowsMedia_Shared.cginc"

    Thanks,
     
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi virtualreal - what codec and resolution are your 50fps videos? What's the CPU usage like during playback?
    Have you tried using the DisplaySync feature?

    I'll schedule some time for testing high frame rate videos in Unity 4.6.1

    Thanks,
     
  40. AndrewRH

    AndrewRH

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

    The position in seconds/frame that you set can take a few frames to actually be applied especially if your video doesn't have many key-frames.

    You can use the DisplayFrame property to detect when the actual frame has changed as this property is the actual frame number of the frame in OutputTexture property.

    I hope that helps you,
     
  41. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes that's right, the newer versions of Unity now have these 2 folders. We are updating the plugin to support them in the next release.

    Cheers,
     
  42. AndrewRH

    AndrewRH

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

    Very large videos aren't suitable for playing from resources/memory. This is something we will add to the documentation in the upcoming release. Using .Net with *very* large arrays of bytes forces the memory to not be collected by the GC and can make apps quickly run out of memory. This may be somewhat alleviated if you make a 64-bit build. For now the only option is to use a codec that will produce smaller files or to play directly from files on the disk.

    Thanks,
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    We plan to add some proper Rift support in the near future. It's not something we officially support yet but we have heard of people using it. Our plugins have free trial versions on the website so naturally you can try before you buy.
     
  44. AndrewRH

    AndrewRH

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

    We plan to add some proper Rift support in the near future. It's not something we officially support yet but we have heard of people using it. Our plugins have free trial versions on the website so naturally you can try before you buy. Unity 5 should be supported to some extent. We are working on adding 4.6 uGUI support for the next release and will make sure to test it in the Unity 5 beta as well.

    Thanks,
     
  45. AndrewRH

    AndrewRH

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

    If traditional media players can't play the DVD source then there's no chance of our plugin being able to :(

    Perhaps you could post a screenshot of what it looks like? It certainly sounds like an encryption artifact....

    Thanks,
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Exsight, sorry about the late reply to this!

    Yes, changing the playback rate constantly isn't something that works very well, even under the best circumstances.

    h264 isn't a format that is well suited for constant rate change so I would first attempt this with a Hap encoded stream.

    If possible it might actually work better if you simply paused the video and scrubbed the frames yourself, changing the rate of frame change based on the user input.

    The Micrsoft DirectShow technology that this plugin is based on isn't the best for scrubbing or rate change, and we have found in the past that QuickTime is much better. Our other plugin AVPro QuickTime is actually what we tend to use for fast video scrubbing / playback rate changing. It has it's own pros and cons over this plugin though.

    Thanks,
     
  47. AndrewRH

    AndrewRH

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

    Yes it should have some support for Unity 5 beta... We're going to be making sure of this in the next update though. If it's not working could you explain what happens?

    Thanks,
     
  48. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    122
    Glad to see you're active on the forum again. Thought I'd offer a couple of suggestions that I would find really useful beyond such things as speed increases and gpu decoding.
     
  49. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    122
    My replay was being blocked so I've had to split it up.

    Retrieving meta data from the video files if available.

    Fade between videos.

    positional audio for surround sound so if a video has a 5.1 Mix you can use it with headphone and still get the 5.1 playback depending on where you look. I'm working on an Oculus video player so a way to switch between headphone and speaker would be great.

    Just a few ideas to get the ball rolling on suggestions for the next version.

    Love the plugin and look forward to seeing whats next.

    Phil
     
  50. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    122
    The one that was being blocked.

    Play videos located on a url. One step further would be to have it except a standard youtube or vimeo link. You can obtain the direct url but both youtube and vimeo have a token system that means you only have a short period of time to watch the video. I think vlc retrieve the token to allow you to play video.