Search Unity

[Released] AVPro Video - complete video playback solution

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

  1. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    Does AVPro for Windows work with 5.6 and Vulkan? I just updated my 5.5 project to 5.6 and the video plays in editor but when I build no video shows up. This is for a Vive experience I'm working on. Thanks.
     
  2. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    So, i did what you suggested, but no result. When i click play in scene it shows that video is playing. but in game tab it's only black screen. Also, I tried to build and run, but it shows only default texture. It seems like video not starting to play, but "autoplay" switched on. Please, help me. I am using last version of unity (5.5.2f1) and Oculus rift cv1
     
  3. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    additionally, thing that i found is that when oculus runtime is deinstalled it works fine, but when installed it again it shows white screen while running
     
  4. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi, this issue sounds strange. If you just run the 360 Sphere demo scene does it work correctly? The fact that part of the sphere is correct and part incorrect makes me think it could be related to a disabled depth buffer (in Player Settings), or something else that's drawing into the scene and somehow affecting it.

    Is it possible to see a video of the flickering region and the working region?

    Thanks,
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks for the stacktrace. IT looks like the crash is happening in "dc_demux_mp4_ds" which is a MainConcept codec. I recommend uninstalling 3rd party codecs. If you do need one (to play high resolution videos on Win7, then I recommend LAV Filters - it's very stable). IF you need the MainConcept codecs perhaps there is a newer version with some bugs fixed.
    Thanks,
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    No we don't support Vulcan yet. For the Vive we currently support D3D9 and D3D11. We are scheduled to add Vulcan support at some point but it's still a pretty new and "edge case" feature.

    Thanks,
     
  7. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Oh sorry, I thought you just meant the screen went while while the video was loading...
    I have a CV1 here and everything is working fine.

    Does it show the video in the Unity Editor (in the MediaPlayer preview panel)?
    Have you tried updating your Oculus version? Also try updating GPU drivers...
    If you just unplug the Rift headset from the PC (with the drivers installed still) does it work then?

    I'm really curious to solve this issue and find out the cause.

    Thanks,
     
  8. chlolist

    chlolist

    Joined:
    Dec 11, 2012
    Posts:
    2
    Thanks for the reply! I tried running the 360 Sphere demo scene and it does work correctly, as well as replacing the video in my scene with the demo video and disabling the top bottom stereo packing, which also worked. I also tested out replacing the video in the demo scene with mine (and enabling stereo packing), which worked too.

    There are a few differences between the scenes that I can see - I'm using the Oculus OVRCameraRig for head tracking and the only other things I have drawing in the scene are a couple World Space Canvases that I use for a pause menu and transitioning between scenes. Could either of those be causing the issue?

    I'll go ahead and try recording a video - I don't think I should post clips of my client's film on a public forum though, do you have an email I could send that to?
     
  9. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    unitysupport@renderheads.com

    I'm surprised that OVRCameraRig is needed - doesn't Unity have Rift support built-in and already handles the tracking of the main camera?

    Yes I guess the world space canvas could have affecting it - perhaps just try disabling them to see if it makes any difference. Divide and conquer until you find the culprit.

    Thanks,
     
  10. culteum

    culteum

    Joined:
    Nov 19, 2013
    Posts:
    1
    Hello!
    I am working with 360° footage from Nokia Ozo and purchased AVPro for Windows and Unity. I am combining the footage with the EEG measurement device Neurosky (Mindwave) and I encounter a problematic dropping in the framerate I don't know how to solve. I tried to solve it from the EEG device but it didn't help, so I would like to know what to do in AVPro to improve the performance...As an output device I target Oculus Rift, but there is not difference if the application is running in the editor or it is already built. Size and format of the media file doesn't matter as well... :(
     
  11. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    120
    **Edit**
    Don't worry about it. I tested that the number was less than a very large number and that seemed to work fine. I've left the message though so if anyone else comes across it it might help.

    Hi I've a quick question. I'm trying to stream a video but the duration returns Infinity. As I'm loading in the duration then doing maths on it I get an error. Is there a way to test for Infinity so I don't do the maths.

    Here is the test stream I'm loading.
    http://yt-dash-mse-test.commondatastorage.googleapis.com/media/car-20120827-85.mp4
     
    Last edited: Apr 3, 2017
  12. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Happy to help. Could you please provide more details? Eg:
    1) Unity version
    2) AVPro Video version
    3) Supply us a copy of your Ozo video so we can test the encoding
    4) Which GPU are you running on?
    5) Is it just the video playback framerate that is low, or the whole Unity app? What are the framerate numbers?
    6) Could you provide a screenshot of the Unity profiler?
    7) Have you tried loading your video in one of our sample demo scenes (eg 01_Demo_BackgroundShader)?

    feel free to reply here, or email us at unitysupport@renderheads.com

    Thanks,
     
  13. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Interesting that it is reporting infinity duration. We'll check it out. Thanks,
     
  14. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    So I'm trying to modify the standard shader in Unity 5.5 to apply gamma but I've run into issues. I've managed on modifying the Editor GUI and exposing a toggle for Apply Gamma but I can't figure out where is the best place to put the code to correct the gamma. Any guidance would be greatly appreciated. Thanks.
     
  15. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hi,
    Well, our components like ApplyToMesh should handle this for you. This script will check if the material has a certain property, and if it does it will (if needed) enable the keyword in the shader. So as long as you build the shader in the same way that we have, it should all work.
    Let me know if you need more help with this.
    Thanks,
     
  16. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    Basically I'm using the Apply To Material script to target the _DetailAlbedoMap property as I'm using the main texture for a repeating circle mask to simulate pixels on a stage display. I need to figure out where to put:
    #if APPLY_GAMMA
    col.rgb = GammaToLinear(col.rgb);
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    You would need to put that code right after the _DetailAlbedoMap texture is sampled in the shader. So the line will llook something like float4 detailAlbedo = texture2d(_DetailAlbedoMap, i.uv); < put it after that in this to alter the .rgb vallues of the detailAlbedo variable. I haven't looked up these names so I'm just guessing, but it should look something like this.
     
  18. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    Hi , Andrew!
    I am using latest Oculus setup (got from here https://www3.oculus.com/en-us/setup/), should i use Oculus run time?
    GPU is Nvidia geforce gt1080, updating drivers has no effect
    It works fine when i unplug my oculus rift.
    So, i attached screenshot which was taken when i play in unity editor(Black screen), but in scene tab it's working. Also, when running build of this project showing white screen.
    Additionally, using OVR camera has no effect(
    thanks, i hope you can help me
     

    Attached Files:

  19. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks, we did a teamviewer session and the problem seems to be the Unity is running on the Intel 630 "gpu" while the Rift headset is plugged into the Nvidia card. A workaround to the black screen was to change the Stereo mode to "Single pass". He's going to try running everything from the Nvidia card to see if that fixes it.
     
  20. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    This is the most amazing asset in the entire asset store period.
     
    AndrewRH likes this.
  21. contempt

    contempt

    Joined:
    Jul 31, 2012
    Posts:
    88
    Just wanted to follow-up that I was successful modifying the Standard shader, I thought I'd pass on how I did it to help anyone else looking for a solution in the near future.

    After downloading the builtin shaders from Unity for my version (5.5.f3) I duplicated the Standard.shader file and renamed it AVProStandard.shader.

    At top changed shader name to "AVProVideo/AVProStandard" and put both the new shader and UnityStandardInput.cginc file into AVPRoVideo > Resources > Shaders folder.

    Edited UnityStandardInput.cginc (I'm targeting Detail albedo map) and added in "detailAlbedo.rgb = GammaToLinear(detailAlbedo.rgb);" after line (97) "half3 detailAlbedo = tex2D (_DetailAlbedoMap, texcoords.zw).rgb;"

    Edit: Forgot to add that at top of UnityStandardInput.cginc add ' #include "AVProVideo.cginc" '
     
    AndrewRH likes this.
  22. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    Hello,
    I am currently evaluating AVPro for windows.
    So far your plugin is great, it solves many issues present with the regular video playing capabilities of Unity: No need to convert videos, better formats support, audio is sync with video, etc...
    But I have glitches when running it in a VR project, the engine seems to pretty often disconnect for a moment, like if the frame rate was dropping too low just for a second or two.
    Profiling seems to say that it's GPU related...
    My project is fairly simple, not a very big scene. I am using your plugin to play multiple videos triggered at different times during the experience. The vids are used for previz of the Character`s facial animation.
    I've downsized the vids and their audio to very low resolutions to see if that was the problem, but no luck.
    I'm currently using Vegas Pro to produce the vids, using settings like this:
    - MainConcept AVC/AAC Internet 720p portrait preset.
    - downsized video resolution to 90x160 NTSC
    - audio at 16khz, 128kbits/s
    I'm not sure I'm using the best technique to do my video switching... I basically have 5 vids, setup in 5 Media Players. And I use a Apply to Material component to play them on a 3D Plane. Then a script switches the Media Player property of the Apply To Material comp.

    Thanks for any help on this!

    Manuel
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Try disabling the hardware decoding option (in Platform Specific > Windows in the MediaPlayer component). You'll need to do this on all of your MediaPlayers. If your videos are small like this then it's better to use the software decoder. It should give you smoother transitioning when playing switching between multiple videos.

    Thanks,
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Why thank you! Your game Subterrain looks pretty awesome too! :)
     
  25. Posticsfir

    Posticsfir

    Joined:
    Apr 6, 2017
    Posts:
    1
    amazing, i just want such a solution;)some days ago, i wanna solve android playback issues because my avi videos cannot be supported by my huawei phone, although i installed an avi on android, but i think this software is not strong enough to convert iso:( i love the production you recommend, i will try it:p
     
  26. divdanila

    divdanila

    Joined:
    Apr 23, 2015
    Posts:
    3
    Как воспроизвести файл на Androide который лежит по пути /sdcard/primer.mp4 ? Так не получается.
    MediaPleer.GetComponent<MediaPlayer>()
    .OpenVideoFromFile(MediaPlayer.FileLocation.AbsolutePathOrURL, "sdcard/primer.mp4");
    MediaPleer.GetComponent<MediaPlayer>().Start();
    MediaPleer.GetComponent<MediaPlayer>().Play();
     
  27. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Hey Andrew. Maybe you have an idea what's wrong.

    I have an app that plays a video that has been setup on the phone's card. I have an absolute path something like:
    /storage/emulated/0/Movies/MyMovie/MyMovie.mp4

    For me on a Samsung S7 it works. For another person on S6 it does not work. We checked and his file seem to be in the correct position! He can still use an older version of the app that was doing the same thing... and it works.

    So, this is what I'm doing:

    1. App starts with another 360 video playing:
    The Sphere has this setting:

    And the Video-Title (MediaPlayer) this:

    2. When I press the Back button I do this:

    I basically replace the Sphere's video to another MediaPlayer called "Video", then I STOP the old video from playing. Not sure if it's required, but I wanted to be sure it doesn't eat up resources or something... the Video-Title is not applyed to any Sphere anyway.

    3. Then once I swapped the MediaPlayer on the Sphere, I do this:

    This is the Video (MediaPlayer):

    I checked that Absolute Path many times... as I have said, on my phone it works. We even changed the folders & the video name, to "start over" ... and again, for me it works for the other phone ... nope.

    At one point I even tried to use this:

    And it worked... but then on this small app, again... it didn't... for the S6, but it worked for me.


    Am I doing something wrong? Can you spot like a mistake or something? I really really have no idea what's wrong. I'm on Android 7 on my S7.

    Thanks
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I'm not sure which product I recommended for you? :) Anyway, why do you need to use AVI? MP4 file container is much better supported...I recommend Handbrake or ffmpeg as tools to convert video files.
     
  29. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Priveet! You need to specify the full file location. If you go to the "file manager / browser" in your phone, you can find the file and select "details" to show the full path. It is usually something like /storage/emulated/0/primer.mp4 But it varies between phones.

    You can read more about the other possiblities here:
    https://android.stackexchange.com/q...d-by-the-many-locations-of-the-virtual-sdcard

    Thanks,
     
  30. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Hmm it's quite hard to know what the issue could be.

    So is it loading the first video (from StreamingAssets) fine on both S6 and S7, but only the second video (from absoluate path) isn't displaying on S6, but it is working on S7? Did I understand the problem right?

    Can you check the adb logcat from the S6 to see what errors are being generated?
     
  31. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Yes you are right. Not really sure what adb logcat is ... :( Down side is that I also don't have access to that S6.

    EDIT: I also tried it at an S6 at work, also doesn't work.



    Should I build for something special? I think I might have changed some settings or something.

    EDIT2:
    I have 2 apps. One that downloads (to the local app folder ... Persistent Data Path or smth like that). That app works! It downloads the file, then it Plays it. I use the same "settings" to play this. My other app, the one that looks for a local file, it doesn't work on the S6.

    EDIT3: I replaced the Titlescreen, that works... with my "local file". It doesn't work. So the "switching of the MediaPlayer" is not the issue.
     
    Last edited: Apr 6, 2017
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    hmm, it could be that the S6 device has the file at different location? I think it can vary between Android verisions and also whether a real sdcard is installed. See here:
    https://android.stackexchange.com/q...d-by-the-many-locations-of-the-virtual-sdcard

    The only way to know for sure is to use the file browser on the device to browse to the file, then select "details" to see the full path.
     
  33. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Yea I am using a file browser... I'm I'm 100% sure that my file is in that location. I manually placed it there ... myself ... then also myself... checked the Unity path...

    I use Total Commander app for Android. I'm manualy inside:
    /storage/emulated/0/Movies/MyVideo/myvideo.mp4

    ... exact same path as in Unity ... WTF



    Do you spot anything wrong here?

    P.S. As I said... it used to work in an older version... but not sure what I changed there in the meantime. Maybe some settings or something.

    EDIT:
    I hear the Audio from the video... but I don't see it!!!
    The video that I'm using right now for testing is 2304x2304.
    I'm trying with other resolutions... so it's not from that.
    But I do hear the audio, so that means:
    1. Path Location is Correct
    2. My MediaPlayer change on the Sphere Works
     
    Last edited: Apr 6, 2017
  34. AndrewRH

    AndrewRH

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

    Exciting news for anyone targeting low-end iOS device with only 1GB of RAM (iPhone 5+, iPhone 6+ etc). Our Apple guru Morris has made some nice improvements to the iOS video player to claw back a ton of some memory.

    This will be especially interesting for anyone wanting to play back 4K videos on these devices.

    Check the before and after images (see the memory used by "Other Processes"). There's an extra 140MB free RAM using the new method:

    iOS-before.gif
    iOS-after.gif
    These changes and more coming soon in the next update.

    Thanks,
     
    Last edited: Apr 6, 2017
    GamerPET likes this.
  35. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    I can't spot anything there - it looks fine.

    It might be a resolution / encoding thing if you're hearing audio. You should try H.265 - in my experience with GearVR it works the best. Also if you're encoding H.264 videos try to minimise the number of reference frames you use during encoding - you actually have to be very careful with which encoding settings you use when trying to target a range of hardware. The hardware is all so picky :(
     
  36. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Yea but that's what's strange. The same video plays fine if I use my other app that also downloads the file. Problem with that other app is that I can't download files larger than 200mb because the system hangs at 100% while it writes the file to disk from memory.

    That's why I have another version that just plays a file that has already been copied to the phone.

    I will try tomorrow to create the same system in a new project that only has the required files. Something very basic with a Sphere... and 1 MediaPlayer.

    This is really really strange because it used to work before with the same video even!

    Anyway, thanks for the help. I will post here my findings just in case someone else has this problem.
     
  37. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    Currently running a video of 640x400 on a Samsung Tab A (2016) with 1280x800 resolution and getting a mixture of errors. Either the video is running with audio playing and no visual, or it's creating a glitchy mess like the below... Unity 5.5.2f1 using AVPro 1.5.5.

    Screenshot_2017-04-07-00-02-59.png

    If anybody has some advice for me on this, I'd really appreciate it!

    --Rev
     
  38. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    So, guys, issue with black screen was solved by running Unity on GPU. Thanks, Andrew!
     
    AndrewRH likes this.
  39. tbbucs4755

    tbbucs4755

    Joined:
    Oct 30, 2012
    Posts:
    6
    Is there any way to decrease the verbosity or turn of logging of the script. We have an app that switches videos quite often and we are ending up with very bloated logs showing videos being loaded and unloaded? Thanks!
     
  40. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Look in the Global Settings panel - there's an option there :)
     
  41. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    В начале нужно использовать один из подходящих демо сцен, дальше в настройках плеера указать путь к файлу, пишите на английском чтобы Andrew Вам ответил
     
  42. Intellection

    Intellection

    Joined:
    Mar 25, 2017
    Posts:
    9
    Hi, Andrew!
    where i can find FAQ tips? in documentation it said see FAQ in order to get high resolution video playback. By the way, i am going to play 8k video.
    thanks)))
     
  43. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Hello @AndrewRH ,

    regarding my problem. The "new" app I made is playing the video from the SD card... so I will slowly start to add fetures & tests to see when it breaks again :D

    Anyway...

    Is there a way to "receive a message" or something... for when the video is loaded & started playing?

    Right now when I get to my Play state, I start the video but I also start the audio which is Ambisonic... but because the video starts a bit slower, the audio & video are out of sync.

    Thanks <3
     
  44. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Thanks for getting in touch. That certainly looks strange. Could you please give more details, specifically about how you're loading the videos, how many videos are loaded at once, how you app spawns MediaPlayers.

    Also, could you try updating to the latest version of AVPro Video (version 1.6.0) as a number of improvements have been made to the Android player since version 1.5.5.

    Could you also share some of the videos with us so we can check if there is anything strange with the encoding.

    I presume you've loading all 10 videos into one of our demo scenes to see if they behave? The 03_Demo_VideoControls demo scene lets you specify a list of videos to load.
     
  45. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, there is an event system. You can subscribe for events for when the video is ready to play.

    Code (CSharp):
    1.  
    2.         void Start()
    3.         {
    4.             _mediaPlayer.Events.AddListener(OnMediaPlayerEvent);
    5.         }
    6.  
    7.         // Callback function to handle events
    8.         public void OnMediaPlayerEvent(MediaPlayer mp, MediaPlayerEvent.EventType et, ErrorCode errorCode)
    9.         {
    10.             switch (et)
    11.             {
    12.                 case MediaPlayerEvent.EventType.ReadyToPlay:
    13.                     break;
    14.                 case MediaPlayerEvent.EventType.Started:
    15.                     break;
    16.                 case MediaPlayerEvent.EventType.FirstFrameReady:
    17.                     break;
    18.                 case MediaPlayerEvent.EventType.MetaDataReady:
    19.                     GatherProperties();
    20.                     break;
    21.                 case MediaPlayerEvent.EventType.FinishedPlaying:
    22.                     break;
    23.             }
    24.  
    25.             AddEvent(et);
    26.         }
     
  46. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Sorry I don't understand :( Is this a question?
     
  47. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Yes, the FAQ is in the PDF documentation :)
    For 8K playback I would recommend H.265(HEVC) on Windows 10 using an Nvidia pascal based 10XX series card. You could also try Hap codec if H.265 doesn't suit.
     
    Intellection likes this.
  48. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    Where exactly do I put this? I'm trying to think how can I also use this with playmaker.

    THanks
     
  49. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    102
    Hi Intellection, On top of that make sure you have at least an Intel Skylake based CPU and <b>don't</b> install any extra codec packs, make sure you build your exe as x64 and Windows will natively play 8K HEVC.
     
    Intellection likes this.
  50. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    370
    So back to my old problem. I added a 2nd Game Object that has a MediaPlayer ... the switch of the videos stopped working.

    Meaning that I see my TitleScreen when the app loads, this TitleScreen is inside the apk... I do a swap to the Media player on the Sphere... and it doesn't load the video on the SD.

    This only happens on the S6. Weird...

    --------------------
    EDIT:
    I think I maybe ... maaaaaybe made it work.

    I tried a couple of things ... so the way it works right now it's still a bit messy.
    Meaning that I'm activating a sphere, deactivating another sphere ... but both spheres have the same Media Player. I will remove this process and hopefully I woun't Jinx it.

    But basically what I did was changing the path of the same Media Player. I'm not having 2 media players anymore.

    I'm not closing the old video & I'm not changing the "Apply To Mesh" media.

    When I'm getting to the Play state all that I'm doing is this:


    This somehow seems to work on the S6... but as I said, I hope I didn't jinxed it :D
    It's very weird that it worked on PC & it worked on the S7, but on the S6 you need to do it this way.

    Hopefully this was useful to someone.
     
    Last edited: Apr 11, 2017