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,806
    Hi Everyone,

    We've realised that v1.3.8 of AVPro Video has a serious bug in the Android plugin that affects older Android devices. We'll be issuing a new version early tomorrow to fix this.

    Thanks,
     
  2. jlabroad

    jlabroad

    Joined:
    May 22, 2013
    Posts:
    3
    Do HAP videos work on the Hololens? Also what kind of performance can be expected on a Hololens application? I'm getting kind of choppy video myself with a noticeable drops in frames and occasional stuttering in a simple scene.
     
  3. AndrewRH

    AndrewRH

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

    Hap codec currently doesn't work on Hololens as Hap is only available with the "Force DirectShow" option which isn't available for UWP. We are aiming to add Hap support in the near future though.

    You should be able to get good performance with Hololens. You may want to enable GPU video decoding, by adding the following to your App.cs:

    m_AppCallbacks.AddCommandLineArg("-force-d3d11-no-singlethreaded");
    Thanks,
     
  4. jlabroad

    jlabroad

    Joined:
    May 22, 2013
    Posts:
    3
    That made a huge difference thanks!

    I don't see the watermark in the Hololens project using the demo plugin but it looks like the video occasionally has this strange effect where it pushes inward for a few seconds then pops back to normal. Is this the watermark & will it go away with the full version or do I have a different issue?
     
  5. jlabroad

    jlabroad

    Joined:
    May 22, 2013
    Posts:
    3
    Just read the documentation for AVPro and it mentions the video scaling for the watermark using GPU decoding which is what I'm seeing. :D Everything is working great now.
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes that's right :) for GPU decoding there is that scaling and offset effect as the 'watermark'. This will not be present in the full version.

    Thanks,
     
  7. AndrewRH

    AndrewRH

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

    Version 1.3.9 is currently uploading to the store. I will update with the list of changes shortly.

    Thanks,
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    AVPro Video 1.3.9 is now live!
    It can be downloaded from the Asset Store or you can grab the free trial version from our website.

    Changes include:
    • Android
      • Fixed bug for Unity versions < 5.2.0 that caused videos not to display
      • Fixed bug for Android versions < 6 that caused video pausing and other operations to break playback
      • Removed zip classes from plugin package to fix conflicts with other plugins using the same zip classes
    • General
      • Better error handling via new GetLastError() function and a new Error event type
      • NGUI support added via new component
      • TimeScale support feature now disabled by default and exposed in new Global Settings panel
      • ApplyToMesh/Material script improved with new scale and offset parameters
      • Added platform overrides for Windows Phone and Windows UWP
      • Improved documentation
    • Workflow
      • Added new Android warning for loading absolute path without external permission set in PlayerSettings
    • VR
      • Fixed VR audio output device not working
      • New high quality option for sphere shader to improve quality at the poles and general optimisations
      • Fixed issue with left/right eyes becoming swapped sometimes
      • Minor fixes to cube map script
     
  9. sam598

    sam598

    Joined:
    Sep 21, 2014
    Posts:
    60
    Would there be any way to add source framerate or total frames to the metadata or MediaPlay.Info? It would be extremely helpful when implementing frame-by-frame video processing.

    Thanks again! The plugin keeps getting better.
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Awesome suggestion! We'll add it to the list and see when we can get it in.
     
  11. JetBlackTsunami

    JetBlackTsunami

    Joined:
    Nov 23, 2013
    Posts:
    4
    Is there any way to select multiple audio streams to play for a souce .mov, our current format for MOV is 8 discrete audio channels ( 6 for 5.1 audio, and 2 for stereo output ), which I don't have a choice to change is there any way I can play atleast 2 of those audio streams at once. I assume at the moment it is just selecting stream 0.

    That being said, this product is amazing, I originally was using AV Quicktime and had to move to AVPro Video due to deprecation, but I am much happier with the speed and quality of this plugin.
     
  12. jeroenvdv

    jeroenvdv

    Joined:
    Oct 25, 2010
    Posts:
    52
    Maybe also make the current playback position available in Frames instead of seconds (like in AVProWindowsMedia & AVProQuicktime) . Also would love the Seek function with Frame parameter option..
     
  13. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Ok... I have some weird problem.

    1. I have a Quad attached to the camera where I play a .MOV file (it's transparent).

    This one works perfectly.

    Now I'm trying to add a new video & quad. I'm keeping the first Quad & video Disabled so i can test this stuff!!!

    Ok so.

    1. I create a quad
    2. I apply a meterial to that quad. It's the same material I use on the first video. It's just an UNLIT shader with a transparent texture. I tried it also with a normal unity shader.
    3. I make a new Media Player (Script) but I also tried it with the old transparent video.
    4. I use Apply To Material where I select my new Video & my material. I also tested this with a material that I use on a mesh.

    When I click play:


    Also... sometimes it just freezes. I can hear the sound in the background!

    Any ideas?
     
  14. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes it looks like the texture wrapping mode is set to clamp which is why you get the stretching, and the material scale/offset is making the texture coordinates go outside of the 0-1 range.

    First of all, if you haven't already then I recommend you upgrade to v1.3.9 of the plugin - it fixes a number of related issues. Next, a quick way to fix this is to change the texture wrapping mode to "repeat" which can be found in the "Media Properties" panel of MediaPlayer component. Next, you may want to use ApplyToMesh instead of ApplyToMaterial as it is safer since it doesn't modify the shared material but makes an instance of it.

    I hope that helps.

    Thanks,
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Frames are a tricky thing... Most video formats don't care about frames and can even have variable frame rates which really makes things difficult! For example you can have a video where it starts off at 30fps, but then turns into 1fps and then changes later on again. This means it's not possible to caluclate how many frames there are in the video without going through the whole video (which takes too long), and it's not possible to do frame accurate seeking without also going through the whole video and building an index. We had this frame seekign feature previously but we had so many issues with people using variable frame rate videos and then expecting accurate frame seeking etc, which just isn't possible. This is the reason we haven't added a frame display.

    It would be very nice though for videos that DO have a constant frame rate and simple intra-frame (key-frame) encoding... We just need a better way to determine whether a video is fixed or variable rate and then warn users automatically when they try to do frame accurate operations. I will add it to the list :)
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks! We're working on multiple audio track support now and it should be in the next release.
     
  17. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Hey Andrew, figured I should bug you on the forums instead of directly like I had been with the hololens stuff.

    I am trying to get seek to work. It works fine on hololens (uwp) but does not do anything in the editor. Not a big deal but thought you'd like to know.

    ProMediaPlayer.Control.Pause();
    ProMediaPlayer.Control.SeekFast( liveVideoPosition); // also tried Seek
    while(ProMediaPlayer.Control.IsSeeking())
    {
    Debug.Log("Seek");
    }

    Debug.Log("Seeked: " + ProMediaPlayer.Control.GetCurrentTimeMs());


    And then debug it shows:
    Seek to : 6939.999
    Seeked: 0
     
  18. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Well, with the latest patch I have some improvements. At least I see the video on the actual Material. But it doesn't play and it's a bit stretched?





    This is with apply to mesh. My screen is not yet on an sperate mesh :p buuuuut... as I said, it odes not play.


    This is applied to material.
    The other video looks like this:

     
  19. AndrewRH

    AndrewRH

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

    No idea why it doesn't play.. Does it play in our sample scenes?

    I think the stretching is due to the UV coordinates of the mesh. The UV coordinates specify which part of the texture to map. Edit mesh needs to be editing to have the correct UV's for what you want to map.

    Thanks,
     
  20. Ibukii

    Ibukii

    Joined:
    Jun 23, 2016
    Posts:
    45
    Hi,
    I've bought the AVPro Video like today thinking that it'll work right off the bat. All I need is a video playing on a sphere. It plays properly on the Unity Editor but just shows a white screen when built. Any idea why?
     
  21. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Don't know. Something is weird. I made a Quad. I placed Apply to Mesh. I selected tha Quad. I selected my old video which I know it works on another quad. I made a new video... it displays there, but it does not play:




    I tried various settings... and as I have said I even tried another Media Player which works on another Quad, but on this quad... no go.

    Dunno what is wrong.


    EDIT:
    I fixed that stretching... it was the UV's like you said. Usually I receive the 3D models correctly, but today... no.

    I still don't know why the videos stop at the first frame. The sound of the video works!! But the video itself is frozen.

    I tried Apply to Mesh & Apply to Material ... I tried loop... and other settings for hte Media Player. No idea.
     
    Last edited: Jul 21, 2016
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Which platform are you building to :) What format+resolution is your video? Did our sample sphere scene work with our sample media when you did a build?

    Thanks for providing more information,
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806

    Is this in the SCENE view or the GAME view? Sometimes if you only have the scene view visible then it won't update the visuals (I'm not 100% sure why, I think this is a Unity quirk). If you want, please package up a simply project demonstrating the issue and email it to us: unitysupport@renderheads.com so we can take a proper look. Also - which version of Unity are you using?

    Thanks,
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You're correct - there are some slight differences between the platforms. Thanks for bringing this to our attention - hopefully it'll be improved in the next version.
     
  25. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Jeeeeeeesssuuuus christ... yea it was the scene view.... now I moved that TV closer to my camera start so I woun't have to go to the scene view and .... it works.

    Well... today was a productive day! Time to go home...
     
  26. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Nice work for the new plugin. I was working with AvPro QuickTime and AvPro Windows few month ago and it's cool to see it now officialy support VR ! Great for the mobile support too !

    Now I have a nice one for you, I have an MP4 file that is converted from a .wmv with Handbrake using h264 codec.
    Baseline profile 3.1. VLC and WMP can read it but it's not working with your plugin (seems to load without error).
    But if I use Handbrake's MPEG-4 codec, all is working.

    I also tried to convert the video you provide with plugin with the same Hanbrake's preset and it works.
    Does it have to deal with .wmv format that breaks file header or something ?
    The converted video file is attached.
     

    Attached Files:

  27. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks, I'm not sure what the reason for this could be - will investigate.
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    I tested your file and it plays fine for me in Windows. I wonder if perhaps you have a codec pack installed (eg Haali Splitter / LAV Filters) that's interfering with it?

    Thanks,
     
  29. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    No codec pack on my Windows, AvProVideo logs that it's using player type DirectShow.
    Movie didn't start but sometimes the seekbar go from first frame to last quickly...
    Same problem with a fresh project with only the plugin in it.
    My config is a Windows 7 x64 SP1 on a GTX 560Ti card.

    Will test this behaviour on another computer to see.
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You are correct..I tested it some more and was able to get the same results. Busy looking into it now...
     
  31. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Ok thanks.
    A test with Freemake Video Converter give same results: using h264 codec break video in AvPro but using mpeg4 is fine.
     
  32. Duoliang

    Duoliang

    Joined:
    Jul 26, 2016
    Posts:
    5
    Hi, I purchased the android version and it is really really great. My question is that I want to make a movie player on android, and one function is to pop out a window and select one local video file from phone, then play it on a quad with AVPro Video, but I am not a programmer nor can I find any information or demo telling me how to do that...
    Can anyone give me some tips? Thanks a billion!!
     
  33. Ibukii

    Ibukii

    Joined:
    Jun 23, 2016
    Posts:
    45
    Hi, thanks for replying. I'm using it on PC, the video resolution is 2160 x 1200, runs for 5 minutes and is in .mov format. It shows that it's using DirectShow if it helps. Can confirm video is not playing as Debug GUI shows nothing. The sample sphere is not working using the video. However when I swap to another computer, the computer does not use DirectShow but MF-MediaEngine-Software and the video loads properly.

    Previously also, I transferred the working file from unity to the new PC and the new PC is not playing the video when the file is ran. The old PC uses Nvidia 940M Windows 10 while the new PC is using Nvidia GeForce GTX1070 Windows 7

    EDIT: It works now that I upgraded to windows10
     
    Last edited: Jul 27, 2016
  34. jinghua1988

    jinghua1988

    Joined:
    Jul 26, 2016
    Posts:
    7
    The function "SetPlaybackRate" is not supported on android? why? Is there any solution?
     
  35. xyzDave

    xyzDave

    Joined:
    Jun 19, 2014
    Posts:
    24
    Any ETA on the WebGl version - docs say v 1.4, and you've just release v 1.3.9 - is it soon or still some way off?
    Just integrated the demo version into our code then noticed WebGL is not yet there :(
    Thanks
    Dave
     
  36. Ibukii

    Ibukii

    Joined:
    Jun 23, 2016
    Posts:
    45
    Is there a way to grab the time the video ran for as a variable? Thanks in advanced
     
  37. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    You can use GetCurrentTimeMs() from IMediaControl interface to get a float of current time, or time past since playing if you didn't use seek functions. Alternatively you could set a unity timer running while IsPlaying() condition is true.

    If you look at the implementation of the AndroidMediaPlayer, SetPlaybackRate() is actually not implemented so you should wait as it seems there is no way to set a custom playback rate for Android right now.
     
  38. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    I have an issue playing my (light) videos on Android using StreamingAssetFolder.
    With a clear project, all seems to work fine but in my game project I get a "[AVProVideo] File not found: ..."
    I suspect the video wasn't unarchived from jar file when trying to access it...

    I see that when AndroidMediaPlayer is initialized, you have comented that it also unpack from jar to persistent data path, but even with a working project, I didn't see any of my videos in Android/data/com.mygame.test/files as expected.

    Also I didn't see any code about unarchiving process, does it's in library files ? Could you give more info on how you extract video file from jar so I can test if this process is complete.

    EDIT : It's finally working, my path to subfolder in StreamingAssets was broken... But I'm still interested in the copy method toward Persistent Data path.
     
    Last edited: Jul 28, 2016
  39. dreamade

    dreamade

    Joined:
    Feb 26, 2014
    Posts:
    5
    Hi,

    I bought the pro version but I have problem with playing 360 video on google cardboard with ios. It freezes and crushes.

    What could be the possible reason?
     
  40. Exsight

    Exsight

    Joined:
    Apr 10, 2014
    Posts:
    33
    Which API are you using, GLES 3.0, GLES2.0 or Metal ? If you try to play a huge file, iPhone / iPad could be too slow to decode video. It also depend on the method you use in Cardboard to duplicate view. Try with a low resolution video to see if problem persist.

    Another experience with that issue : I make a h264 mp4 video that works on mobile, WMP but not in AvPro Windows. Plugin says it use DirectShow, no error message but still no video and CPU is always stuck to 100%.

    Same configuration on Windows 10 works just fine.
    Video for this test attached.

    EDIT : seems video higher than width like 1200x1248 cause many issue, sometimes WMP says it cannot read it and it also cause AvPro being stuck on some platforms.
     

    Attached Files:

    Last edited: Jul 29, 2016
  41. f-win

    f-win

    Joined:
    Jul 28, 2016
    Posts:
    3
    Has anybody been able to stream in a UWP/HoloLens app?
    I tried the HTTP download which is working in a clean project but not working in my HoloLens project.
    I am getting
    Code (CSharp):
    1. [AVProVideo] Error: LoadFailed
    2. UnityEngine.Debug:LogError(Object)
    3. RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:815)
    4. RenderHeads.Media.AVProVideo.MediaPlayer:Update() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:397)
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, Yes PlaybackRate isn't supported on Android in 1.3.9. We are adding it in 1.4.0 which should be available next week.

    Thanks,
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hmm I'm not entirely sure...

    Are you using an actual Hololens or the software emulator?
    Did you set the app capabilities in Unity Player Settings to allow internet access?
    Also, what kind of stream are you trying to access?
     
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Could you possibly provide more details? Eg:

    1) Which version of AVPro Video were you using?
    2) Which version of Unity were you using?
    3) Which version of the Google Cardboard SDK were you using?
    4) Which iOS operating system version were you using?
    5) Which iOS device were you using?
    6) What was the format, resolution and file size of the video?
    7) Are you able to share your video / project with us for testing?

    Thanks,
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    WebGL support is coming in v1.4.0 which should be out next week :)

    Thanks,
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Glad to hear it's working. Yes with Windows 7 and below AVPro Vidoe always uses the DirectShow playback path. The Microsoft H.264 decoder for DirectShow has a limitation of 1920x1080 which is why you video didn't display. You can install the 3rd party H.264 decoder (such as LAV filter) to resolve this. For Windows 8 and above we use the Microsoft Media Foundation playback path, and the Microsoft H.264 deocder on that path has a limit of 4K which is why it is able to play your video. I hope that makes sense.
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    AVPro Video comes with several demos showing how to use Unity to create a video player. We don't include any examples on how to make a UI to browse the local file system as this is beyond the scope of the plugin.

    You would need to learn some basic scripting to achieve this. I'm not sure if Android supports discovering the file system using System.IO.Directory.GetFiles() function, but that is probably where I would start looking. If that doesn't work then you may need to write some Java functions (or find a plugin on the store to help) that retrieves the file and directory structure. You would then need to build a UI for the user to navigate that.

    I hope that helps!
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Have you tried ffmpeg the command-line tool? It's pretty amazing...
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Ahh, I see the problem! Basically your video is too tall! The H.264 decoder has a limit of 1920x1080 and your video is 1232 pixels high.

    In Windows 7 and below the DirectShow playback path is used (as opposed to the Media Foundation playback path that is used for Windows 8 and above). The Microsoft H.264 decoder in this case is limited to a resolution of 1920x1080. For Windows 8 and above the limit is 3840x2160 which is why it works on Windows 10.

    I hope that helps to explain it. Simply limit your video height to 1080 if you're targeting Windows 7 or below.

    Thanks,
     
  50. AndrewRH

    AndrewRH

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

    Here is a sneak preview of the upcoming v1.4.0 which has WebGL support!

    Try the WebGL demo HERE

    Things we know don't work:
    1) The frame extract demo

    Thanks,
     
    Last edited: Sep 29, 2016