Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

[Released] AVPro Video - complete video playback solution

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

  1. Rutty03153

    Rutty03153

    Joined:
    Nov 21, 2013
    Posts:
    5
    New version seems like a great fix for the issues I've had, no issues from what I've seen so far.

    Thank you guys for the quick support there!
     
    AndrewRH likes this.
  2. gtk2k

    gtk2k

    Joined:
    Aug 13, 2014
    Posts:
    14
    I tried to play RTMP using LAV Filter, but only still images are displayed.
    (Display Rate 0.00)
     
  3. mikkotikkanen

    mikkotikkanen

    Joined:
    Jan 18, 2018
    Posts:
    2
    Unity 2017.3.1f1, AVPro is on the previous release. Device is Samsung S7+Gear VR with Android 8.0.0

    Tried toggling Android settings, unfortunately with no change. Also, tried with freshly booted device and still no change, it just stays in the low bitrate source.

    I also tried more recent Unity version with no change in behavior. :/
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    And if you try another m3u8 source does that work?

    Perhaps you could share your link with us for testing?

    Thanks,
     
  5. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Error: video not supported (errorcode=4) color:red;

    Hello, I'm using AVPRO and it work fine in Editor.
    My problem is that when I build for WebGl when the video is loaded I get the error "Error: video not supported (errorcode=4) color:red;"

    It's quite weird because my video is a standard .mp4 file, on Editor it load without any errors, and on Google Chrome it load, I have the 1st frame, I can play etc., but it's not called the Event "OnFirstFrameReady".

    What's going on?
    Many thanks
     
  6. RedCartel

    RedCartel

    Joined:
    Mar 6, 2014
    Posts:
    1
    We need some help too :) The Demo scene is currently not working when we import it?
     
  7. remy_rm

    remy_rm

    Joined:
    Jan 16, 2017
    Posts:
    17
    Does AVPro 1.9.14 now officially support unity 2019?
     
  8. ludum_mubul

    ludum_mubul

    Joined:
    Dec 9, 2016
    Posts:
    21
    Is it possible to render video in skybox, using your asset or receive light to see reflections on mesh inside video sphere?
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    :( Sorry about that...we've had some users reporting positive results... It's not something we've tried ourselves. I don't really have any more insight to give you.
     
  10. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Yes, OnFirstFrameReady is probably not called in WebGL since that platform has no way of reporting when frames are delivered.

    But you also say that you're getting an error that the video doesn't load? I'm confused. Is that in a different Browser?
     
  11. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Could you give more details? Platform, Unity version, in what way isn't it working?

    Thanks,
     
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Yes AVPro Video now supports Unity 2019
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Yes, you should be able to do this - but it's not a feature that we include with the plugin. The MediaPlayer generates a Texture though, so it should be easy to apply this to a SkyBox. On some platforms the texture does need flipping/processing though, so you may need to convert the texture to a new RenderTexture via a shader first before applying it to the skybox material. This is something we hope to include native support for in the future.

    Thanks,
     
  14. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    It's not in a different Browser, the error message is in the same Browser, and it's quite weird because despite the error message the video play fine. Anyway I've ended up using "OnReadyToPlay" instead of "OnFirstFrameReady" and now it work.
     
  15. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Hello, I'm trying to play 4K videos from http.
    To do so I'm actually using Vimeo sdk for Unity (https://github.com/vimeo/vimeo-unity-sdk), that can use standard Unity VideoPlayer as well as AVPRo for playback.
    Despite Vimeo platform, the 4K videos stall many times for a few seconds during playback.
    The same videos play fine from Vimeo, so I have idea that it's due to buffering (indeed Vimeo take quite a long time to buffer the video before to start the playback).
    So, how can I have a "reasonable" buffer before to start the playback of the video with AVPro, and keep buffering it during the playback so to have a smooth 4K playback like with Vimeo?
    The built-in AVPro buffering seem not to be enough to play smoothly my video, so I should at least increase its size, or to do something like that.
    P.S. I've seen "AddChunkToVideoBuffer", maybe it could do the trick, but I really don't know how to use it.
    Thank-you for your help!
     
    Last edited: May 14, 2019
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Ahh yes, I have seen browsers throwing that error, but then it just works fine, so I don't understand why they're showing an error.. Perhaps it's just some internal logging.

    Glad to hear that it's working better with OnReadyToPlay :)
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    AddChunkToVideoBuffer is only for the UWP platform.

    If the automatic buffering algorithm isn't waiting long enough then you could pause playback until there is enough buffered. You can use the methods to determine how much has buffered:

    Code (CSharp):
    1.         float    GetBufferingProgress();
    2.         int        GetBufferedTimeRangeCount();
    3.         bool    GetBufferedTimeRange(int index, ref float startTimeMs, ref float endTimeMs);
    Those methods are accessible via: mediaPlayer.Control.

    Thanks,
     
  18. JC_Amtote

    JC_Amtote

    Joined:
    Nov 8, 2016
    Posts:
    2
    @AndrewRH ,

    Do you have any insight into this issue?

    My team is working on a project where we load multiple .wmvs / .mp4 video files using the AVProVideo plugin.

    We have observed that videos fail to load after the first one when using the Media Foundation video API and running in Windows 10. The Direct Show video api works, but we have situations with projects using Media Foundation which cannot be rebuilt and are now being fielded on Windows 10 hardware.

    Unity version is 5.6.

    Any help would be greatly appreciated :)
     
  19. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    I've continued this thread via email.
     
  20. jason_yak

    jason_yak

    Joined:
    Aug 25, 2016
    Posts:
    312
    Thanks so much for the update released... I can confirm this fixed our issues, and good to see you guys back on the case.. we were all a little worried for a bit there haha. Glad to have you back on board, thanks :)
     
    AndrewRH likes this.
  21. George_Milroy

    George_Milroy

    Joined:
    Aug 17, 2018
    Posts:
    3
    Does this have a preloader?
     
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    What's a preloader?
     
  23. George_Milroy

    George_Milroy

    Joined:
    Aug 17, 2018
    Posts:
    3
    There's a few seconds delay before the video starts to play when you load a new Scene with the media player. Is it possible to have some kind of loading animation or a progress bar that will appear until the video starts to play?
     
  24. Nicolas_Begin

    Nicolas_Begin

    Joined:
    Oct 26, 2018
    Posts:
    3
    Hi Andrew,
    You have made a really good plugin. Congrats !

    My application is mostly used on Windows and I need to use custom HTTP headers for a new tool. Do you have planned something for that feature ?
    Or is there an other way to use them on Windows ?

    Thanks.
     
  25. RenderHeadsSte

    RenderHeadsSte

    Joined:
    May 17, 2019
    Posts:
    65
    We have tested this with a 7 track video (1 video, 6 AAC audio) and there are 6 audio tracks reported. I can also select any of the audio tracks and they play back as expected. Maybe you could supply a sample video that is not working for you so we can investigate further?
     
  26. FrozenLazer

    FrozenLazer

    Joined:
    Jan 10, 2018
    Posts:
    8
    Is it possible to enforce playing at a certain resolution as well as preloading (buffering the video to a certain amount before playing it)?
     
    wanorde23 likes this.
  27. unity_l9qK46KFod-YXg

    unity_l9qK46KFod-YXg

    Joined:
    May 2, 2019
    Posts:
    3
    I have emailed regarding this and also filed an issue on GitHub. When playing any video in Windows 10, the last half second of audio is cut off, sometimes more, sometimes less. I attached a sample video.
     

    Attached Files:

    • cut.zip
      File size:
      171.5 KB
      Views:
      43
  28. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Hello,
    I'm trying to play, with WebGl, on Apple devices a video from Vimeo,
    through the public url
    https://player.vimeo.com/external/336457143.hd.m3u8?s=....

    I'm actually using your demo scene "360SphereVideo".
    My WebGl is hosted on HTTPS so I should have no CORS policy issues.

    1) Without any external Library:
    - On Macbook + Chrome the .m3u8 extension seem not to be directly supported, so when I open the file I get the console AVPRo error message "video not supported".
    - On Macbook + Safari I can open the video (I get the event message "First Frame Ready"), but it does not show the frame. When I play nothing happen (no console messages, no errors, nothing).
    - On iPhone + Chrome does not work (I can't see the console from iPhone).
    - On iPhone + Safari does not work;

    2) Implementing the external library "hls.min.js":
    - On Macbook + Chrome I can open and play the video.
    - On Macbook + Safari I can open the video and the frame is showed, but when I play nothing happen again (no console messages, no errors, nothing).
    - On iPhone + Chrome does not work;
    - On iPhone + Safari does not work;

    3) On Windows + Edge / Chrome, and on Android + Chrome I can smoothly play the same video with ".mp4" extension, instead of ".m3u8",
    and it's much less compressed.
    - On MacBook + Chrome it open and play.
    - On MacBook + Safari I get the console AVPRo error message "video not supported".
    - On iPhone + Chrome doesn't work;
    - On iPhone + Safari doesn't work;

    My 1st need should be to be able to play .m3u8 videos on Safari and Chrome, both on mobile and on desktop Apple devices.
    My 2nd need should be to play better videos (like with .mp4 format) both on Chrome and on Safari, both on mobile and on desktop Apple devices.

    Is it possible?
    Many thanks
     
    Last edited: May 18, 2019
  29. matze30

    matze30

    Joined:
    May 15, 2019
    Posts:
    3
    Hello AVPro Team,

    I am using AVPro Player to play several videos with alpha channel in one scene ( about 20 different videos) but not at the same time but one by one. Unfortunately the performance lowers with every video I start. I have 6 planes where the videos are played ( not simultaneously). I also delete the Media Players if they have finished but this does not increase the performance. Maybe I am wrong but should the resources which were effected by the Media Player not be available after closing the video/ destroy the Media Player? If you had any advices how to fix this I would be very happy.
    Thank you in advance.

    Best regards
    matze
     
  30. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Hello, I've read this on https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats
    "The MP4 container format with the H.264 video codec and the AAC audio codecis natively supported by desktop/mobile Internet Explorer, Safari and Chrome... ...".
    But it doesn't seem like that, at least with AVPro...
     
  31. ennio-ifvr

    ennio-ifvr

    Joined:
    May 17, 2019
    Posts:
    1
    Hello,

    I'm trying to use the feature for accessing a hidden file in a file from the documentation (page 31 I think).
    I have a file that has the mp4 I want to play hidden inside (done via the command shown at the documentation). The file is placed in a local folder of the Android device and I know exactly the offset (the size of the first video in bytes), so I put that via code.

    The problem is that no matter which number I put in the 'Offset' field, I always get the same video, the first one, not the hidden one. At the Log of AVPro via Logcat I can see that the offset is being applied properly.

    I hope you can help me with this problem, maybe I am missing something obvious, but I've tried several times. I'm assuming that the file with the hidden video is fine because the size is the result of dummy-video + real-video sizes.
     
  32. leoleoroy

    leoleoroy

    Joined:
    Jul 21, 2017
    Posts:
    5
    Hello,

    I want to add DRM to my Video.
    I try to use example command to my video:
    "copy /b DummyVideo.mp4 + %1 %~n1-hidden.mp4"

    For example I have FakeVideo.mp4 and RealVideo.mp4
    I use command: "copy/b FakeVideo.mp4 + %1 + %~n1- + RealVideo.mp4 OutVideo.mp4"

    The OutVideo's file size become the FakeVideo.mp4 + RealVideo.mp4
    But the content is same with FakeVideo in the AvproPlayer.(look like attachment)

    I don't know which step that I need to adjust.
    Thank you for your help!

    3.PNG
     
  33. YuriyVotintsev

    YuriyVotintsev

    Joined:
    Jun 11, 2013
    Posts:
    35
    Hi, is it possible to synchronize play time (frame num) of two separate video files with AVPro?
     
  34. frangagn

    frangagn

    Joined:
    Sep 20, 2018
    Posts:
    12
    I've used your asset to build my own version of a video player for MR and it works flawlessly. I'm working on porting it to Occulus and Vive platform. However, given the limited memory of these devices as compared to a PC, I'm looking to use streaming as part of the functionality. I must admit my total ignorance about this technology, although I'm a quite experienced developer. Could anyone point me to some pre-built assets that do this, or pre-built servers that I can use or to libraries that I can use to build my own server? Thanks.
     
    Last edited: May 20, 2019
  35. timscaffidi

    timscaffidi

    Joined:
    Mar 12, 2018
    Posts:
    2
    I posted a while back about color shift that is present using hardware accelerated playback. At the time I thought this issue was only affecting NVIDIA GPUs, however I've since done more investigation and come to realize that while there was an NVIDIA specific issue, there is also a slight color shift that occurs on all GPUs, AMD, NVIDIA and Intel. From my own testing with hardware accelerated media foundation, this issue appears to be an inaccurate conversion from the YUV color space to RGB.

    I was using an IMFSourceReader configured with a ID3D9DeviceManager to enable hardware acceleration, as I'me sure you are familiar. However, I've since upgraded my implementation to use D3D11 APIs and the color shift is eliminated on Intel and NVIDIA GPUs completely, while AMD GPUs are still affected. The move from D3D9 to D3D11 also fixed a few other issues I was having with AMD GPUs recieving black / incomplete frames while seeking the video.

    I just wanted to make the RenderHeads team aware of the issues with using the D3D9 acceleration API, and suggest that if you are still using D3D9 for HW Acceleration, to look into upgrading to D3D11. Not only did it fix several extremely hard to pin down issues in our codebase, but it also reduced the size of our implementation as D3D11 actually has less boilerplate required to set it all up than D3D9 does. I'm happy to provide example code on how to implement D3D11 acceleration with Media Foundation, as the Microsoft Documentation does not provide any coding samples on how to do so, but only high level instructions on what interfaces to use.

    Cheers!
     
  36. artgpDEV

    artgpDEV

    Joined:
    Mar 9, 2015
    Posts:
    2
    Hello,

    I have an mp4 video file, with 2 audio streams, but when i return the value of MediaPlayer.Info.GetAudioTrackCount(), i always get 1, so i can't switch the audioTrack. I tested the mp4 in VLC, and i can swicth the audio.

    Thank you for your help!
     
  37. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Which platform is this on?
     
  38. artgpDEV

    artgpDEV

    Joined:
    Mar 9, 2015
    Posts:
    2
    I'm testing in the editor, the target platform is Android
     
  39. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    173
    Hello,
    I'm sorry to write you again but we still can't play any video from Safari (neither .mp4, neither .m3u8, despite of the source: Vimeo or our ftp).
    to quickly test the issue we've created 2 different WebGl versions, one without Lib and another with "hls.min.js"
    https://vr.alicefit.com/WebPlayer_noLib/
    https://vr.alicefit.com/WebPlayer_HlsLib/

    As you will see, pressing the button "Load .m3u8 Vimeo", on Safari the Javascript Console show the AVPro message "First frame ready", but pressing "PLAY" nothing happen.

    We'd really like your help to understand if it's an AVPro issue, or maybe something else.
    Many thanks!
     
  40. frangagn

    frangagn

    Joined:
    Sep 20, 2018
    Posts:
    12
    Any clues about this?
     
  41. cclok922

    cclok922

    Joined:
    Sep 20, 2018
    Posts:
    1
    Hello Andrew,
    Does any example on android platform
    using exoplayer api input httpheader(json) play on avpro video?
    I can't find any reference on network, please help me. thx!!
    Device : htc vive
    Media (tell us about your videos - number of videos, resolution, codec, frame-rate, example URLs):
    {
    "name": "Viva kriptirana bento4",
    "uri": "http://toolbox.beenius.tv/HLS/enc/viva_multidrm/stream.mpd",
    "drm_scheme": "widevine",
    "drm_license_url": "https://lic.staging.drmtoday.com/license-proxy-widevine/cenc/",
    "drm_key_request_properties": {
    "x-dt-custom-data": "ewogICAgInVzZXJJZCI6ICJnb3JhbiIsCiAgICAic2Vzc2lvbklkIjogImFhc3NhYXNzYWEiLAogICAgIm1lcmNoYW50IjogImJlZW5pdXMiCn0K"
    }
     
  42. samizzo

    samizzo

    Joined:
    Sep 7, 2011
    Posts:
    482
    I'm using AVPro Video 1.9.14 for a project on iOS, on the latest iPad Pro. The app is divided into a bunch of sections which are turned on and off as you go between them. I play an intro video at the start of most of the sections. When the section is complete, the root GameObject is disabled and the next section is enabled.

    I've noticed that once the videos have finished playing and I'm in the next section, if I lock the device then unlock it some of the previous section videos will start playing (sometimes they start near the end of the video). I can't see anything rendering but I can hear the audio from it. I have logs enabled, but I don't get any messages from MediaPlayer.OnApplicationFocus or MediaPlayer.OnApplicationPause. I don't see anything else useful in the device logs either (which I've attached). I'm not using OnApplicationFocus/OnApplicationPause anywhere else.

    Any ideas?

    Thanks,
    Sam
     

    Attached Files:

    • log.txt
      File size:
      11.5 KB
      Views:
      301
  43. praagmatic

    praagmatic

    Joined:
    Mar 23, 2014
    Posts:
    5
    what is the status of the Lumin (Magic Leap) compatibility?
    At the moment AV Pro does not work with Lumin, is there any plans to add Lumin Dlls to AV Pro?
     
  44. tufeixp

    tufeixp

    Joined:
    Sep 6, 2015
    Posts:
    22
    The Same Problem, On updated version. I hope to use Media Foundation as the decoder other than direct show, there should be some Metadata bypass setting for Media Foundation.
     
  45. AlexisTB

    AlexisTB

    Joined:
    Jul 26, 2017
    Posts:
    14
    Hello Andrew,
    I am wondering if it's possible to have the video to continue buffering even when we are paused in WebGL (every time I start playing I get the start buffering event, in editor I'm only getting that event once).

    Another thing that i'm not sure if it's a normal behavior, but Info.GetVideoFrameRate() is always returning 0 in WebGL. (we are using it to have a more accurate backwards playback rate since negative playback is not supported on all platforms, right now we are using a flat 30 to replace the value).

    Unity 2019.1.3f1
    AVPro version 1.9.14
    Google Chrome Version 74.0.3729.169 (works the best, except for the issues mentionned above)
    Firefox Version 67.0 (Firefox seems to be able to seek, but not play normally, there are errors in the console)
    Safari Version 12.1.1 (Video doesn't load, haven't investigated this one too much yet)
     
    Last edited: May 29, 2019
  46. indie_mike

    indie_mike

    Joined:
    Nov 7, 2016
    Posts:
    29
    Hey Andrew,

    Just recently were having issues playing back videos. I dont really have an explanation as to why it stopped working, the only difference i can see is im getting "Stalled" event come up, and nothing after that.

    What does it mean? I couldn't really find any info in the documentation.

    Cheers!
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Ahh I see.. I think they call this "pre-roll". Currently we don't have anything like this.
    It depends on how the video is encoded. Some videos are heavily compressed, so the decoder has to actually decompress a lot of frames ahead in order to decode the early frames. So one solution is to encode the videos with less reference frames, more key-frames, and no B-frames.
     
  48. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Thanks! Well..we have custom HTTP header field support on Android, iOS and macOS currently. Sadly on Windows it is not yet possible to add. It's on the list of things to do....
     
    Nicolas_Begin likes this.
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    No you can't downscale the video....It will always play at the resolution it was encoded in. If you use an adaptive system like HLS then it will adapt and change texture resolution based on the available bandwidth.

    Custom pre-loading isn't supported. If you play the video and it needs to buffer more (for network streaming) then currently it will be in a stalled state (you'll get a Stalled event and calls to mediaPlayer.Info.IsPlaybackStalled() will return true). After enough has buffered it will start to play. So I guess if you wanted to control this yourself, you could load the video and play it immediately muted and hidden. Monitor the stalled state and when it starts to play (becomes unstalled) you could pause it, rewind and allow the user to play it.
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,637
    Thanks for this. So far we have replicated the problem, but it's proving quite tricky to fix. It doesn't indeed cut off the last 400 milliseconds or so of audio when you use the AudioOutput component...We will keep updating the issue on GitHub Issues.
     
unityunity