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
    Not easily..our plugin wasn't designed for this. It would require a substantial effort. It'd probably be faster to write a custom solution...
     
  2. eloperaGSN

    eloperaGSN

    Joined:
    Nov 27, 2017
    Posts:
    3
    Hi!

    We are using AvPro for iOS and we are having these reports on old devices and iOs Versions (iOS equals or older than 10.3.3, iPad3 and older and iPhone 5 and older)

    OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range
    at
    RenderHeads.Media.AVProVideo. OSXMediaPlayer:Update()
    RenderHeads.Media.AVProVideo.MediaPlayer:Update()

    it seems to be at the line 795 of the OSXMediaPlayer.cs when launching the issuepluginEvent.

    These errors were reported with plugin version 1.7.2 on Unity 5.6.4

    We have up to 5 player instances playing small mp4s of size 256x174 at 24fps

    Any suggestion how to solve the problem??

    Thanks.
     
  3. morpheux74

    morpheux74

    Joined:
    Feb 16, 2018
    Posts:
    8
    Well, this is what I call a plain/monoscopic video (this is what I have):

    And a stereo video (what I don't have):

    This, is what I expect :
    upload_2018-3-20_11-36-46.png
    This is what I get (when I select Debug tinting):
    upload_2018-3-20_11-39-14.png
     

    Attached Files:

  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks, that's clear.

    So what is it that you are changing between the screenshot of what you want, and what you get?
    It is just that you're using a mono video instead of stereo?
    I don't understand how that can make that cardboard UI disappear??
     
  5. AndrewRH

    AndrewRH

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

    Thanks for reporting this.

    We've had a look into it and we get the same error sometimes, but it looks like it's coming from the Unity runtime itself, but it seems harmless.

    Is it actually causing a problem, like is the app crashing or freezing or something? Please let us know what the problem is besides the error logs.

    Thanks,
     
  6. eloperaGSN

    eloperaGSN

    Joined:
    Nov 27, 2017
    Posts:
    3
    Hi.

    At this very moment it seems that there is no people complaining about app crashes or freezes, so it appear to be harmless. We are in our way to find and old device and try to reproduce it. When we had more news about the issue we'll tell you.

    Thanks.
     
    Last edited: Mar 20, 2018
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks! Let us know.

    Also, I have shared a screenshot here showing where the GL errors come from, and as you can see it happens during the initialization of Unity. It seems to be code related to testing if a texture format is valid - so I guess that's why the failure doesn't break anything.

    Cheers,
     

    Attached Files:

  8. morpheux74

    morpheux74

    Joined:
    Feb 16, 2018
    Posts:
    8
    I don't get the "what I want" screen, that's the problem, that's not a screenshot made with AVPro. I need to know how to get it with AVPro, I've tested many configurations and I cannot get that cardboard UI appear
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Have you tried deploying to an Android device? It cardboard is selected in the Player Settings then it will show the stereo view on the Android device, but Unity doesn't show this in the Editor.
     
  10. morpheux74

    morpheux74

    Joined:
    Feb 16, 2018
    Posts:
    8
    Yes I've tried, same result.
    Do you imply that I should just need to load 08_Demo_360SphereVideo.unity and select Cardboard in Player Settings to get it work ? It doesn't
     
  11. xpansivevr

    xpansivevr

    Joined:
    Jun 22, 2016
    Posts:
    27
    Any news on this as its still an issue in AVP 1.8?
     
  12. dj-fiorex

    dj-fiorex

    Joined:
    Nov 28, 2017
    Posts:
    4
    Hi, i'm trying to make a 360 video player with your plugin, starting with trial i want to play a video (look at the image) but i can't archive this. Which settings is good for this video on the plugin? Thanks video.PNG
     
  13. RWatling

    RWatling

    Joined:
    Mar 21, 2018
    Posts:
    9
  14. eloperaGSN

    eloperaGSN

    Joined:
    Nov 27, 2017
    Posts:
    3
    Thanks for the info. But is there any way to get rid of these errors?

    Cheers.
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    This isn't a stardard equirectangular 360 format, or even a cubemap format....If you could let me know more about the layout format of this then we can look at supporting it.

    Thanks,
     
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    No there isn't a way to get rid of them. It is part of Unity as far as I know. Where do you see them, aren't they invisible to the user? Perhaps they have fixed it in a newer version of Unity?
     
  17. AndrewRH

    AndrewRH

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

    The standard questions: Which platform is this on? Which version of AVPro Video?

    The second URL is just invalid, and the first one doesn't play in any player so it must be invalid too. Not all platforms support RTSP.

    Here are some example URLS:

    http://downloads.renderheads.com/2016/BigBuckBunny_360p30_Streaming.mp4
    http://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov/playlist.m3u8

    There are more example URLs listed in our PDF documentation.

    Let me know if you have any issues.

    Thanks,
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes that should work. I can't understand why you're having issues. Please could you send us your project files?

    Thanks,
     
  19. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Sorry, that didn't make it into this version. We're still looking into it.

    Thanks,
     
  20. IikkaDevelopingThings

    IikkaDevelopingThings

    Joined:
    Sep 8, 2017
    Posts:
    7
    Alrighty, then I'll have to implement downloading in another way.

    As for the second question, I'm using AVPro 1.8.2 and Unity 2017.3.1f1. The format of the videos is mp4. I currently don't have the time to find exact ways of reproducing the bug, but I'll come back at it later if it persists in the builds as well. I'm not sure if I can share the project, but I'll look into it.

    Anyway, sorry but I've got yet another question...

    I'm currently streaming videos from URLs and they work fine in the editor, but as I try to make a WebGL build, the streaming suddenly doesn't work anymore. I don't have the WebGL build hosted anywhere, I'm running it locally. I've got a firefox plugin that enables Cross-origin resource sharing, before the plugin I got an error because of the different origin, but now with the plugin it's just the plain "Error: video not supported (errorcode=4) color:red; message...
     

    Attached Files:

  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks. Yes even if you can replicate it with a new minimal project, or even using our demo scenes.

    Could you share the URL so we can test it? Also please let us know which version of Firefox you're using.

    Thanks,
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I've looked into this a little bit now. The stretching is indeed happening for 180 degree videos.

    As far as I can tell, we need to modify our shader to add some scaling and offset features. The problem is that not all 180 degree videos seem equal. It seems that they're all using different lenses, which have a different FOV, and so this needs to be taken into account. We will continue looking into this, but I think you can expect an update to the shader so that it has 1) a more sensible default, 2) some options to set the FOV of the lens

    Thanks,
     
  23. IikkaDevelopingThings

    IikkaDevelopingThings

    Joined:
    Sep 8, 2017
    Posts:
    7
    Gotcha. I'll make a simpler scene showing the issue if I keep having problems with it. Basically what I'm doing in the scene is browsing through a menu, and each menu element tells the AVPro to start loading a video from a URL attached to the menu element. After browsing it for a while the videos stop loading completely and won't start loading until I completely restard Unity.

    Sorry, the URL was visible in the screenshot and I apparently forgot to mention it. The test was done with the bunny video from your documentation, so the URL is: https://rh-downloads.s3-eu-west-1.amazonaws.com/2016/BigBuckBunny_360p30_Streaming.mp4

    I'm currently on a different computer so I'm unable to check the firefox version.
     
  24. AndrewRH

    AndrewRH

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

    AVPro Video version 1.8.4 has just been released!

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

    Changes include:

    macOS, iOS, tvOS
    • Fixed crash bug introduced in 1.8.0 related to seekableTimeRanges in HLS streams
    Android
    • Added OES shader support for the GUI component
    Please report any issues here on the forum, or to our customer support email.

    Thanks,
     
  25. Virtimed

    Virtimed

    Joined:
    Nov 1, 2017
    Posts:
    29
    Hi,

    Was just looking at the events for buffering and was trying to test on my machine by just turning my internet on/off (this is in editor on Windows).

    When doing this however, I end up getting an error regarding the codec: [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.

    So I'm a bit confused how I'm meant to handle stalling? Does AVPro try to resume as and when an internet connection is restored or am I meant to do that?

    Thanks,
     
  26. AndrewRH

    AndrewRH

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

    Which version of AVPro Video is this with? With the latest versions (1.8.2 and above) it has better support for the Stalled event in Windows. Also, what kind of stream are you connecting to: HLS, a progressive MP4, or something else?

    It should try to reconnect yes, but after some time it is possible that it will throw an error.

    Thanks,
     
  27. Virtimed

    Virtimed

    Joined:
    Nov 1, 2017
    Posts:
    29
    This was with 1.8.4. At the moment it is just using MP4.

    So if it does disconnect and throw the error, what's the best way of resetting and resuming the video (from the timestamp it stopped at) when the connection is restored? At the moment, I'm having to take the timestamp, run a coroutine to identify when the connection is restored and then reload the media player and immeditately seek to the previously stored time but wondered if there was a better way.

    Thanks,
     
  28. hifarmnet

    hifarmnet

    Joined:
    Mar 22, 2013
    Posts:
    6
    Hi, I am using AVPro media for fullscreen 4K video, on Windows 10.
    Basically this assets works good, but sometimes displaying strange line(triangle?).
    Please look at this image. Yellow circle is the problem.

    share_avpro.jpg


    Please give me advice.
     
  29. Casanova87xx

    Casanova87xx

    Joined:
    Oct 15, 2014
    Posts:
    4
    Hi, just two questions:

    Can AVPro play videos at 60 fps? I think they are playing correctly in the Editor but seems to be playing at 30 fps on Android.

    By the way... can I see these fps while the video is playing? (not the info about the video that I know is 60 fps, I mean the fps the video is playing).

    Greetings,
    Marcos.
     
  30. hifarmnet

    hifarmnet

    Joined:
    Mar 22, 2013
    Posts:
    6
    Thanks for quick reply.
    I played 29.97fps video file... Is it better to change framerate to 30 or 60 fps?
     
  31. hifarmnet

    hifarmnet

    Joined:
    Mar 22, 2013
    Posts:
    6
    And I will check your question!
     
  32. AndrewRH

    AndrewRH

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

    Yes you can play 60fps videos with AVPro Video and on Android platform, as long as your video isn't too high resolution. To get the best performance on Android, we recommend using OES rendering path (in MediaPlayer > Platform Specific > Android), and you can also configure some performance options in Unity's Player Settings for Android.

    You can display the FPS by enabling the Debug GUI (in the MediaPlayer > General options).

    Thanks,
     
  33. AndrewRH

    AndrewRH

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

    This is strange. Which version of AVPro Video and Unity are you using?

    Are you using MediaFoundation or DirectShow video API (in MediaPlayer > Platform Specific > Windows > Video API)?

    Is VSync enabled in your project? (Quality Settings)

    Thanks,
     
  34. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    What kind of stream is it? HLS, HLS Live, progressive MP4 or something else?

    Your approach for resuming the video sounds good. I guess on the GUI you would need to show a stored time value, so that it doesn't just jump to zero... We have made that HLS live streaming disconnect work well, but if you're using another approach then we can look at improving this too.

    Thanks,
     
  35. IikkaDevelopingThings

    IikkaDevelopingThings

    Joined:
    Sep 8, 2017
    Posts:
    7

    Turns out the issue was with the FirstFrameReady event which I was using for starting playback. Seems like it has problems in Firefox as well. If I'm getting it correctly, it's not calling the event when the video has loaded, but instead when I actually start playback. The video loads into the videosphere, but FirstFrameReady is only called when I press play.

    I had made logic where the videosphere doesn't show and the video doesn't play before the FirstFrameReady gets called, which means I was stuck there with no video, thinking it didn't load. And those generic errors in Firefox console didn't really help :D

    Do you have any plans adjusting how FirstFrameReady works in WebGL or would it be better to build my functionality completely without using it for anything critical?
     
  36. Virtimed

    Virtimed

    Joined:
    Nov 1, 2017
    Posts:
    29
    Literally just an mp4 file hosted on a server so it's probably not that complicated.

    If HLS is meant to work better, we are meant to be migrating to that anyway so maybe I'll revisit this if I notice this to be an issue when using that.

    Thanks,
     
  37. hifarmnet

    hifarmnet

    Joined:
    Mar 22, 2013
    Posts:
    6
    Thanks.

    I use Unity 2018.1.0b11, AVPro Video 1.8.0(scripts v1.8.0), and
    Directshow (check Hardware Decoding, uncheck Use low latency, Audio mode=Unity),

    VSync is enabled (Every V Blank).
     
  38. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    32
    Good Morning! We are using the excellent AVPro in our company to develop players for VR. But now I'm trying to generate thumbnails in real time from my list of videos, but I’m not getting it to work. Would you help me? Follow the current code:

    Code (CSharp):
    1. private IEnumerator GenerateThumbnails(VideoMedia videos)
    2. {
    3.    foreach (var video in videos)
    4.    {
    5.       mediaPlayer.OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, video.path, false);
    6.       while (!mediaPlayer.VideoOpened)
    7.          yield return null;
    8.    
    9.       var texture = new Texture2D(800, 600);
    10.       texture = mediaPlayer.ExtractFrame(texture, 10f);
    11.       video.thumbnail = texture;
    12.    }
    13. }
    14.  
    15. public class VideoMedia
    16. {
    17.    public readonly string name;
    18.    public readonly string path;
    19.    public Texture2D thumbnail;
    20.  
    21.    public VideoMedia(string path)
    22.    {
    23.       name = Path.GetFileNameWithoutExtension(path);
    24.       this.path = path;
    25.    }
    26. }
     
  39. MagianMediaStudio

    MagianMediaStudio

    Joined:
    Jul 1, 2016
    Posts:
    1
    Do you have any plan for Linux?
     
  40. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    288
    I've been trying to change the playback speed in Android untill I realize that it can't be done in this platform (according to the documentatiuon). Is there any way to bypass this by code?
    Edit: I'm using the last demo trial you provided (v1.8.4) in your web page to see if fits in my project.
     
    Last edited: Mar 30, 2018
  41. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    How can you know when video restarted in a loop?
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes in WebGL we don't actually know when a frame arrives, so this is why FirstFrameReady event is not triggered until you call Play.

    I would keep your existing logic and make a special case for WebGL. In WebGL you could perhaps wait for the event MetaDataReady.

    Thanks,
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Okay, I'm not sure why you're using DirectShow - I would use Media Foundation instead if possible. That rendering artifact looks like a GPU issue. Are you doing anything unusual like scrubbing (seeking) through the video very quickly, or just playing it normally?

    It would also be an issue with the beta Unity version....

    Thanks,
     
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm afraid not... We don't have enough interest to warrant this :(
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Playback speed can be changed on Android, but it requires either:

    1) Your device needs to be running minimum Android version 6.0 (Marshmallow)
    2) Use the ExoPlayer API (switch in MediaPlayer > Platform Specific > Android > Video API)

    thanks,
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I believe this was handled via email - thanks.
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You can monitor the current playback head time value and see when it becomes smaller. Something like:

    Code (CSharp):
    1.             if (_mediaPlayer.Control != null)
    2.             {
    3.                 if (_mediaPlayer.Control.GetCurrentTimeMs() < _lastCurrentTimeMs)
    4.                 {
    5.                     _loopCount++;
    6.                 }
    7.                 _lastCurrentTimeMs = _mediaPlayer.Control.GetCurrentTimeMs();
    8.             }
     
    dienat likes this.
  48. morpheux74

    morpheux74

    Joined:
    Feb 16, 2018
    Posts:
    8
    Hi Andrew,
    Sorry for the delay, here is the project : https://drive.google.com/file/d/1iX5NuhEDub-MOY9aXrqvr70zwe7jobX4/view?usp=sharing
    It's just AVPro with the 360° demo and Cardboard selected in the player settings. Push it on an android, you'll see that it doesn't play in VR.
     
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    So the issue is a Unity bug. Basically you need to change to use a different version of Unity as they have broken Cardboard support in some recent versions of Unity. See these threads:

    https://forum.unity.com/threads/for...e-your-google-vr-sdk-to-1-12-or-later.520986/

    https://answers.unity.com/questions/1456999/google-vr-had-a-fatal-issue-while-loading.html

    Thanks,