Search Unity

[Released] AVPro Video - complete video playback solution

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

  1. ADVS

    ADVS

    Joined:
    Aug 11, 2013
    Posts:
    5
    Hi. I just tried to GetTextureTimeStamp at android, but function not work correctly. At windows all works fine. Please help.
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    45 videos :) Well, if you have a decent PC that shouldn't really be a problem, especially if you build as a 64-bit application. Keep the video loaded but not playing until you need them. You may also be able to combine videos together (mega videos?) and then just seek and play a region of them when needed. Loading 45 videos at once might be slow and staggering the loading can help speed that up. For this you'll need to write a little script to load videos in sequence. I Hope that helps.
     
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm looking into this now and will get back to you soon. It's been a while since we used the OBB split application option. Thanks,
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    It should work - the behaviour is just a bit different. On Windows it returns an absolute timestamp value, relative to the start of the video (at timestamp 0). On Android it is a relative timestamp so when you start the video it will show some timestamp value and then all other timestamp values are relative to that one. So you could take the timestamp of the first frame that comes though, and then subtract all subsequent timestamps from that one. Thanks,
     
  5. Niller007

    Niller007

    Joined:
    Dec 3, 2014
    Posts:
    14
    Any news on the release date for the new version? We need the browser issue fix pretty urgently.
     
  6. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22

    Hi, anything new about this issue ?

    ..Hi, my problem is, that videos which are captured horizontal upside down, or in portrait mode, will not be rotated correctly by AVPro within an iOS device...

    Or is thery any variable, i can check within iOS to recognize a rotated video ?

    Thanks,
    Ulf
    Meshed.Space Company
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Ulf,
    We are ready with the new code to support iOS videos with rotation, but are still busy making the next release. If you need to very urgently please email unitysupport@renderheads.com with your invoice number/PDF and I can get you an early version. It is coded though, and will be in the next release which I'm hoping will be out early next week. Thanks,
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes this is done for the next release of the plugin (early next week). If you need these fixes urgently before then please email unitysupport@renderheads.com Thanks
     
  9. blevok

    blevok

    Joined:
    Feb 16, 2017
    Posts:
    75
    Hello again. I'm down to probably the last 5-10% of work on my windows phone 8.1 app, but I seem to have hit another issue with loading videos. In addition to loading user inputted network video streams (working perfectly), i also need to open files from local device storage and SD cards. Any way i try to load the result of the windows file picker causes either a loading error, or it completely freezes the app.

    I've realized that the mediaplayer basically wants a file path and nothing else. Or at least that's what it looks like to me. But windows phone doesn't allow this, apps cannot directly access files outside the apps' directory. What is the right way to load local files on windows phone from the native file picker?

    Thanks
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Interesting...what is the result of the file picker? What class / data structure does it return? Also, do you have an example of the path format it returns?

    With this information we can look into it.

    Thanks,
     
  11. blevok

    blevok

    Joined:
    Feb 16, 2017
    Posts:
    75

    Here's an MSDN article explaining the situation:
    https://blogs.msdn.microsoft.com/wsdevsol/2012/12/04/skip-the-path-stick-to-the-storagefile/

    I'm using the unity plugin 'Windows Store Native' for the windows stuff that isn't available from UnityEngine.Windows
    https://www.assetstore.unity3d.com/en/#!/content/54715

    Here is their documentation:http://www.claytoninds.com/#wsanative

    The picker returns an object with the following properties and methods:
    DateCreated
    DisplayName
    DisplayType
    Equals
    FileType
    GetHashCode
    GetType
    IsAvailable
    Name
    Path
    ReadBytes
    ReadText
    ToString
    WriteBytes
    WriteText

    However the WSNative dev says to access the result in one of these ways:
    Code (CSharp):
    1. byte[] fileBytes = result.ReadBytes();
    2. string fileString = result.ReadText();
    But since intellisense offers path, i tried:

    Code (CSharp):
    1. newVideo = result.Path;
    like this:

    Code (CSharp):
    1.     // open file button
    2.     public void openFile()
    3.     {
    4.  
    5. //#if NETFX_CORE
    6.         WSANativeFilePicker.PickSingleFile("Select", WSAPickerViewMode.Thumbnail, WSAPickerLocationId.VideosLibrary, new[] { ".mp4", ".mpg", ".mpeg", ".wmv", ".asf", ".mkv", ".avi", ".ts", ".vob", ".ogg" }, (result) =>
    7.         {
    8.             if (result != null)
    9.             {
    10.  
    11.                 newVideo = result.Path;
    12.                 mp.CloseVideo();
    13.                 mp.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, newVideo, true);
    14.  
    15.             }
    16.         });
    17.  
    18. //#else
    19.         // put android file picker here if we decide to release for android as well
    20. //#endif
    21.  
    22.     }
    This results in this log:
    [AVProVideo] Opening C:\Data\Users\Public\Videos\BigBuckBunny_720p30.mp4 (offset 0)
    [AVProVideo] Error: Loading failed. Possible codec not supported, video resolution too high or insufficient system resources.


    Just for kicks i tried:

    Code (CSharp):
    1. string newVideo = result.ReadText();
    But i think that actually reads the contents of the file into a string, and it caused the app to freeze, and the log was empty.


    So then i tried:

    Code (CSharp):
    1. byte[] newVideo = result.ReadBytes();
    But that resulted in 'cannot convert byte[] to string', and going .ToString(); didn't work of course.


    I also tried:

    Code (CSharp):
    1. newVideo = result.Name;
    2. mp.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, "file:///C:/data/Users/Public/Videos/" + newVideo, true);
    But that resulted in the same:

    [AVProVideo] Opening C:\Data\Users\Public\Videos\BigBuckBunny_720p30.mp4 (offset 0)
    [AVProVideo] Error: Loading failed. Possible codec not supported, video resolution too high or insufficient system resources.


    And actually, i've found that the same error is thrown for a lot of causes, even if i deliberately direct it to a path where the file doesn't even exist.


    For reference, i set one of the sample videos in streaming assets to play when the app starts, and that works just fine, and here is the log:
    [AVProVideo] Opening C:/data/Programs/WindowsApps/9477f26c-e88b-478e-ab1b-b3f047230e5d_1.0.0.0_arm__pzq3xp76mxafg/Data/StreamingAssets\AVProVideoSamples/BigBuckBunny_720p30.mp4 (offset 0)
    [AVProVideo] Using playback path: MF-MediaEngine-Hardware (1280x720@30.00)

    But then using the picker throws the error. And note that this is the same file that i saved to device storage for testing, so i don't believe that the error is stating the real problem. The article that i linked in the beginning of this post pretty much says that it just won't work using a path.
     
  12. DongLiwei

    DongLiwei

    Joined:
    May 7, 2014
    Posts:
    2
    We were having trouble playing video use https, iOS 10.2

    Code (CSharp):
    1. Player 532: failed to load value for key "playable", error: resource unavailable
    2.  
    3. [AVProVideo] Error: Loading failed.  Possible codec not supported, video resolution too high or insufficient system resources.
    4.  
    5. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    6.  
    7. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    8.  
    9. UnityEngine.Debug:LogException(Exception)
    10.  
    11. UnityEngine.Logger:Log(LogType, Object)
    12.  
    13. System.Collections.ObjectModel.Collection`1:Remove(T)
    14.  
    15. UnityEngine.Debug:LogError(Object)
    16.  
    17. RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors()
    18.  
    19. RenderHeads.Media.AVProVideo.MediaPlayer:Update()
     
  13. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    i just face a weird problem. In my iPad, my script can play all movies except one, and we tried different format and compression setting. When my app try to play that movie, Control.IsPlaying return true, it get correct resolution/length/fps, but it stuck at first frame. And it can play the movies when i create another independent app to play it. Do any people face this problem too?

    *Edit*
    if i jump out from the main app, launch the test app, go back to main app, the movies can play
     
    Last edited: Mar 13, 2017
  14. aurelien

    aurelien

    Joined:
    Aug 27, 2012
    Posts:
    4
    Hello

    GetBufferedTimeRange () work fine on MAC but not on Android?

    It will be available soon?
     
  15. kevincfy

    kevincfy

    Joined:
    Oct 12, 2012
    Posts:
    16
    Hi there,

    We're having some quite severe crashing issues when seeking high res (3840x2160 - supposedly the safe maximum) H265 videos on Android compiled for GoogleVR. The screen freezes momentarily before the device reboots itself.

    By lowering the resolution/framerate we've found we can seek the video twice maximum before causing another device crash. H264 seems fine but obviously the filesizes are much larger.

    Is this a hardware issue? Any workarounds we could use? Obviously we'd like the highest quality at the smallest filesize but we don't know what the theoretical sweet spot is.

    K.
     
  16. amore159443

    amore159443

    Joined:
    Mar 13, 2017
    Posts:
    1
    Is there a 360 Video player compatibility? Especially on iOS?
     
  17. 265lutab

    265lutab

    Joined:
    Sep 15, 2014
    Posts:
    155
    I'm making an app that plays a video on android and it is dropping a lot of frames. The video is large.What are generally the maximum video sizes for android using this player?
     
  18. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    It's quite funny. The problem got extremely random and cross app. And then i restart my device. And the problem disappeared. FYI, I am using iPad Air 2 iOS 10.0.2 AVPro version 1.5.6
     
  19. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    This release (1.5.26) is being released today - 14th March. Thanks,
     
  20. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    This release (1.5.26) is being released today - 14th March. Thanks,
     
  21. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    Thanks for providing all of this information. We're going to work on this feature for the next release (after 1.5.26). Thanks!
     
    blevok likes this.
  22. NathanRH

    NathanRH

    Joined:
    Oct 24, 2012
    Posts:
    447
    What was your URL? Is the HTTPS certificate valid? You can email unitysupport@renderheads.com if you would like to supply more details. Thanks,
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hmmm, it sounds like a memory issue. How much RAM does your iPad have? If you are playing high resolution videos and only have 1GB of RAM then memory may be the problem....
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, this function unfortunately isn't supported on Android. There is currently no way for us to implement this without massive changes to the plugin - so sorry no support coming any time soon.

    Thanks,
     
  25. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm not completely sure what this could be, but I suspect that it is related to decoder complexity. We did some tests with H.265 and H.264 with high resolution videos for VR and found that if gave the decoder too much to do (via high frame-rate, or a lot of motion in the frame coupled with high bit-rate) and using all of the available encoder features (eg CABAC, too many reference frames, B-frames, deblocking etc) then the video would stutter then freeze and ultimate just block the application. So it could be something similar? You may get a clue if you look at the ADB logcat messages coming from the device - it may be throwing log messages about the decoder resources or that the video time is lagging behind.

    Find the sweet spot is hard and it will depend on the contents of your video. Getting the balance of resolution, frame-rate, bit-rate and encoder features takes a lot of trial and error if you're aiming for great quality.
     
  26. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yup, 360 video playback is supported on all supported platforms by AVPro Video. There are demo scenes included in the package that show you how to do this - it's very straightforward.

    Thanks,
     
  27. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    It totally depends on the devices you're targeting and also on the contents of the video (related to bit-rate and encoder complexity). I would say 3840x1920@30 with H.265 is best for devices like Samsung Galaxy S6 and above. If you need 60fps then you should stay at around 2160x2160 as a maximum...

    In terms of file size, I'm sure the limit of Android MediaPlayer is quite high, but I don't know exactly what the limits are. The largest video file I've tried to play on Andorid was a 7GB H.264 video. With good compression there shouldn't be a need for insane bit-rates. Use something like a 2-pass encoder to get a good balance of quality and maximum bit-rate.
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, it's here now in latest version (1.5.26) thanks!
     
  29. AndrewRH

    AndrewRH

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

    AVPro Video version 1.5.26 has just been released!

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

    Changes include:

    Android
    • Added support for passing custom HTTP header fields
    • Fixed minor bug when calling SetPlaybackRate too early
    • Android API 15 (4.0.4 Ice Cream Sandwich) is now supported, previously API 16 (4.1 Jelly Bean) was required
    • Added plugin files for the arm64-v8a platform (currently disabled in the inspector, but simply enable it once Unity has added support for this architecture)
    macOS / iOS / tvOS
    • Added support for passing custom HTTP header fields
    • Added support for videos containing orientation data. The orientation transform is now retrievable and the uGUI display component correctly displays the video
    WebGL
    • Fixed bug in Internet Explorer and Firefox where video would not display
    • Added support for displaying multiple ranges of buffered time
    Windows / WSA / Hololens
    • Fixed FinishedPlaying event rarely not firing on Media Foundation
    General
    • DisplayUGUI component no longer generates any garbage when vertices are dirtied. Also some minor optimisations
    • ApplyToMesh component no longer generates any per-frame garbage
    • ApplyToMesh component has improved interface
    • Improved time display in the editor to be millisecond accurate, and also fixed time rounding error bug
    • Changed EnableSubtitles() to return true while it is loading in a coroutine
    • Added new example script VideoTrigger that shows how to trigger videos when entering/exiting collider volumes, including audio fading
    • Added more streaming video URLs to documentation
    Thanks,
     
  30. DongLiwei

    DongLiwei

    Joined:
    May 7, 2014
    Posts:
    2
  31. Niller007

    Niller007

    Joined:
    Dec 3, 2014
    Posts:
    14
    Hi,
    We updated to the latest version, and now the video works in Firefox, but it's still not working in Internet Explorer, and it stopped working in Safari :/ Is this an issue on our end, or can you confirm the issue?
    We need it working by the end of this week, so it's pretty critical :/
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Which versions of IE and Safari, and which platform?
    Is there anything in the developer / console log?
    Also, which graphics API are you using?
    Which version of Unity are you using?
    Have you tried the samples here:
    http://www.renderheads.com/content/2017/AVProVideoDemoWebGL/

    Thanks,
     
  33. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi , thanks for the last version - now the issue in iOS with rotated videos works fine !
    One problem just exists - using ExtractFrame gives me the unrotated picture.

    Can i use

    Code (CSharp):
    1.  Matrix4x4 m = Helper.GetMatrixForOrientation(Helper.GetOrientation(info.GetTextureTransform()));
    to rotate the texture to the right position ? If yes, please could you describe me (short code snippet) how to rotate the texture with this parameters ?

    Thanks a lot - Ulf from MESHEDTeam
     
  34. Niller007

    Niller007

    Joined:
    Dec 3, 2014
    Posts:
    14
    The sample behaves in the same way, i.e. the video doesn't show up (but audio plays) in IE and Safari.
    We're using the latest versions of the browsers, and the mac used for testing in Safari has macOS Sierra 10.12.3.

    There's nothing in the console.

    We're using Unity 5.5.0f3 (but since the sample isn't working either, it shouldn't have anything to do with our Unity setup, right?)
     
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, we've tested your URL and it works fine for us on iOS.
    Which version of AVPro Video are you using? If it is an old one you might want to upgrade to the latest (1.5.26). Have you enabled internet option for iOS in the Unity Player Settings? What is your device model?
    We tested using our "04_Demo_uGui" demo scene and it worked fine.

    Thanks,
     
  36. jasonVRC

    jasonVRC

    Joined:
    Jan 26, 2017
    Posts:
    1
    Hi!

    I'm currently using AVPro for Android and have been using the video offset feature to play a video from within a file. Does an equivalent feature exist for Windows? If not, what other features does the player have that is similar in functionality? Thanks!
     
  37. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    We've made some modifications to the webgl plugin and attached it here. It should now have better Safari support. Please replace the existing file in /Assets/Plugins/WebGL with this one (unzipped).

    Internet Explorer is not supported as it doesn't support uploading video frames to GL textures. Microsoft recommend using their Edge browser which is supported.

    Thanks,
     

    Attached Files:

  38. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Currently the file offset feature is only available for Android. We have it on the list to investigate extending this to other platforms but there are a number of feature requests way ahead of that that we'll implement first. For Windows there currently isn't anything similar...

    Thanks,
     
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes the supply for video orientation on iOS isn't yet throughout the plugin. The easiest way to achieve this would be to create a RenderTexture of the right dimensions and then use a shader to rotate the source texture based on this matrix. I will try to create a snippet for you and post it shortly.

    Thanks,
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Ulf,
    I've attached a ZIP package with 3 modified scripts so that ExtractFrame now support orientated videos.
    Thanks,
     

    Attached Files:

  41. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi Andrew, thanks !!! Works like a charm now !
    Thank you for the very fast and professional support - we love your product !

    Best regards,
    Ulf from MESHED Team
     
  42. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi Andrew, just one thing does not work smoothly - if i record portrait within ios the ExtractFrame rotates the picture, but it is cutted and wrong positioned, everthing else works fine.

    thanks, ulf
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi Ulf, I'm glad to hear that it's mostly working. do you know whether the recording is portrait, or portrait flipped? :)
    Also, could you post a screenshot of what you're seeing? I don't have access to iOS hardware at the moment so anything you can provide will help.

    Thanks,
     
  44. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi Andrew, here are screenshots of the frog recorded an kept in the center of the picture. 0° and 180° are complete ok , but 90° and 270° delivers the same shifted material. It is not flipped - just the location of the picture is wrong and the aspect ratio of the texture is not rotated.

    upload_2017-3-18_18-15-49.png
    Thanks, Ulf
     
  45. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi Andrew - i think just rotate the texture size will solve the problem:
    first pic is the recorded one, second the texture from ExtractFrame:


    upload_2017-3-18_20-40-7.png



    upload_2017-3-18_20-38-10.png
     

    Attached Files:

  46. AndrewRH

    AndrewRH

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

    Thanks for the very useful diagrams. Did you update all 3 script files I sent? Did you try using the FrameExtract demo? If not, see if that works.
    If you're trying to extract frames yourself, then please reference that FrameExtract demo code as it includes some changes that you might need - see the OnNewMediaReady() method, line 81 on FrameExtract.cs

    I hope this helps you. Thanks,
     
  47. MESHED-space

    MESHED-space

    Joined:
    Nov 11, 2015
    Posts:
    22
    Hi Andrew, i solved it now by switching the texture dimension as you suggested (like the OnNewMediaReady() method) with

    Code (CSharp):
    1.         IMediaInfo info = _mediaPlayer.Info;
    2.         Orientation ori = Helper.GetOrientation(info.GetTextureTransform());
    3. #if UNITY_IOS
    4.         if (ori == Orientation.Portrait || ori == Orientation.PortraitFlipped)
    5.             _texture.Resize(info.GetVideoHeight(), info.GetVideoWidth());
    6.         else
    7.             _texture.Resize(info.GetVideoWidth(), info.GetVideoHeight());
    8. #else
    9.          _texture.Resize(info.GetVideoWidth(), info.GetVideoHeight());
    10. #endif
    11.         _texture = _mediaPlayer.ExtractFrame(_texture, _timeSeconds, _accurateSeek, _timeoutMs);


    Thanks,
    Ulf
     
    Last edited: Mar 20, 2017
  48. Niller007

    Niller007

    Joined:
    Dec 3, 2014
    Posts:
    14
    Excellent, it works now. Thanks a lot! :)
     
  49. Plamen-Yoan

    Plamen-Yoan

    Joined:
    Mar 22, 2017
    Posts:
    1
    Hi, I've got a problem when trying to load a 4k or 2k or any larger video from a URL. It works for let's say 1280x720 videos. The URL is https.

    I will attach links to the videos that I am testing with:
    https://drive.google.com/uc?export=download&id=0ByC-hRFFs6oaS2l1bnFMQzBzaUU - Works

    https://drive.google.com/uc?export=download&id=0ByC-hRFFs6oaVlUtdFBhMmlyM2c - Does NOT work
    https://drive.google.com/uc?export=download&id=0ByC-hRFFs6oac05QQ0xLY0pIaHM - Does NOT work

    Screen Shot 2017-03-22 at 4.55.46 PM.png

    Player 932: failed to load value for key "playable", error: Operation Stopped
    UnityEngine.Debug:LogError(Object)
    RenderHeads.Media.AVProVideo_OSXMediaPlayer:DebugLogCallback(Int32, Int32, String) (at Assets/AVProVideo/Scripts/Internal/OSXMediaPlayer.cs:222)

    [AVProVideo] Error: Loading failed. Possible codec not supported, video resolution too high or insufficient system resources.
    UnityEngine.Debug:LogError(Object)
    RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:1279)
    RenderHeads.Media.AVProVideo.MediaPlayer:Update() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:749)

    I am using Unity 5.3.5 / also tried on 5.4.3.
    MacMini 2011 on MacOS 10.11

    Just tried Unity 5.5
    Windows 10

    Got only the 2nd error about Loading failed
     
    Last edited: Mar 22, 2017
  50. alaa-mohamed

    alaa-mohamed

    Joined:
    Sep 7, 2014
    Posts:
    6
    Last edited: Mar 22, 2017