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

[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,647
    3840x3840 is not a recommended format for the Oculus Go when playing back at 60fps.
    4320x2160 h.264 at 60 should work.
    Basically you have to decide if you want more resolution and a lower frame-rate, or high frame-rate and a lower resolution. It's all up to the limits of the hardware video decoder.

    Thanks,
     
  2. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Could you please prove more details:

    Which platform is this on?
    What operating system version is it running?
    Which version of Unity are you using?
    Which version of AVPro Video are you using?
    What are the specs of the videos (resolution, frame-rate, codec, file location)?
    How rapidly are you changing videos?

    Thanks,
     
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Yes that's right, the volume range is 0..1. If you want the volume to be louder you have to adjust it at the source when creating the video. Or you could allow the user to change the system volume levels.

    Thanks,
     
  4. Architree

    Architree

    Joined:
    Oct 29, 2012
    Posts:
    6

    For PC and Mac.
    PC: Window10. Mac: OS11.
    Unity version 2018.1.4f
    AVPro Video version 2 months ago... forgot what version.
    Video resolution width 4k, height 2k (might up to 8k for sharper graphic), 30fps, file location is fixed in streaming asset folder. Codec unknown...
    Around 2 to 3 sec changing one video but difference depend to presenter.

    This project is about products introduction and will be shown through projectors in a big show room.
    More videos will be added in final stage.
     
  5. Architree

    Architree

    Joined:
    Oct 29, 2012
    Posts:
    6
    From Unity Profiler, the high peak only appeared when change video, well, in a lot of chances, this application will changing 3 videos at the same time. This project's show room have 3 different projectors showing 3 different videos simultaneously.

    Currently, we try to add delay between change video (fake loading screen) to give more times for the videos to be loaded.

    We wish to hear and learn more methods of solving this problem from everyone.

    Please and thank you.
     
  6. digableMatt

    digableMatt

    Joined:
    Dec 7, 2016
    Posts:
    11
    Have you ever encountered an issue with iOS and using "transparent" or "fade" on a standard material with AVProVideo? Trying to fade a plane with the video on it in/out when needed, and can only do this when using a standard material set to fade or transparent. Unfortunately when doing so the video shows as tinted red (or whatever color the wheel is set to) even though the color is white and the alpha is being tweened.

    This works fine when previewing on the desktop (mac) but when deployed to an iPhone (7 plus) the video appears as tinted red. When using the AVProVideo/Lit/Diffuse (texture+color+fog+stereo support) the video shows up fine, but I cannot tween the alpha to fade it in/out.
     
  7. AndrewRH

    AndrewRH

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

    I won't go into all the technical details why iOS is different, but basically it looks like we made a typo in the Lit/Diffuse shader, so you can easily fix it.

    Open up the file AVProVideo-Lit-Diffuse.shader and change line 77 from

    fixed4 c = fixed4(Convert420YpCbCr8ToRGB(ypcbcr), 1.0);

    to

    fixed4 c = fixed4(Convert420YpCbCr8ToRGB(ypcbcr), 1.0) * _Color;

    The alpha value in the Color property should now be changable.

    We will fix that in the next release too.

    Thanks,
     
  8. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Please first try upgrading to the latest version of AVPro Video - there have been a few updates in the last couple of months.

    The video codec is important to know as it can affect performance. It's also important to know what GPU you're using as they have different decoding capabilities for different codecs.

    Changing videos is a complex operation and it does take time. There are a few things that can be done to reduce that time:

    1) Simply the video encoding. The more complex the video encoding, the longer it can take to start. You can make the encoding simpler by not having B frames, disabling CABAC, or just encoding using a "fastdecode" profile.

    2) Make sure you're using a fast SSD

    3) Make a RAM Disk containing the video files

    4) Instead of 3 videos, try merging them into one video - this will definitely load faster. Or stagger the video loading so that all 3 are not trying to load at the same time.

    5) Make sure you're using a GPU that has enough video decoding ability. If for example you're using a NVidia Geforce 10xx series, and you're trying to decode 3 4K videos, it will fail or play back very slowly as this is right on the limit of what it can do.

    6) Keep a handle on the garbage collector. Loading a video can generate some garbage so you want to try to make sure that a garbage collection doesn't happen while loading videos as it will cause an extra hitch.

    You mentioned that the application crashes when changing videos frequently. If you're still having this problem after upgrading to the latest version, perhaps you could send us a test scene, or tell us how to replicate the issue using one of our sample scenes.

    Thanks,
     
  9. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    664
    Problem description:
    Currently the "None" option in Stereo Packing is very misleading, as it seems to use
    the stereo packing option from the actual file, and not "None". This makes it impossible
    to actually force a stereo packed video to not be unpacked, but instead be full frame.
    The differentiation between "Auto" and "None" would solve that and also avoid unnecessary
    confusion.

    Device (which devices are you having the issue with - model, OS version number):
    Windows 10, both Editor and Build

    Media (tell us about your videos - number of videos, resolution, codec, frame-rate, example URLs):
    MP4 with VR and/or stereo flag set (e.g. with Media Encoder or https://github.com/google/spatial-media/releases/tag/v2.0)

    System Information:
    AVPro Video: plugin v1.9.3 scripts v1.9.4
    Target Platform: Standalone
    Unity: v2018.2.10f1 WindowsEditor
    OS: Desktop - Windows 10 (10.0.0) 64bit - English
    CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz - 8 threads - 65466KB
    GPU: NVIDIA GeForce GTX 1080 Ti - NVIDIA - Direct3D 11.0 [level 11.1] - 11127KB - 16384
     
  10. Otterremixchamp

    Otterremixchamp

    Joined:
    Nov 2, 2018
    Posts:
    1
    Hey Andrew! Loving AVpro. I'm trying to recreate an effect I've gotten working with the Unity Video Player, where I play a 360 video onto a cubemap render texture, and then assign that render texture to a reflection probe. I've tried Graphics.Blit() using the GetTexture() function, as well as then trying to also Graphics.CopyTexture() the problem is the Reflection Probe just shoots out a flat rendition of the 360 video to every angle, OR a flat rendition of the 360 video out one direction and black the other 5 directions. I've tried outputting to a material, and using a Custom render texture to pull from that material texture as well, with the same results. Any idea of how to output a 360 video to a Render Texture Cubemap, to then shoot out of a render probe? Any help or ideas is greatly appreciated! Thanks!
     

    Attached Files:

    • ref1.png
      ref1.png
      File size:
      642.5 KB
      Views:
      502
    • ref2.png
      ref2.png
      File size:
      40.5 KB
      Views:
      454
  11. dorukeker

    dorukeker

    Joined:
    Dec 6, 2016
    Posts:
    37
    [SOLVED see below]

    Hello All,
    Very happy with AVPro.
    I just upgraded an existing project to AVPro v1.9.4. And it started to give me an error on video open.
    I am running the 07_Demo_Mapping3d.unity
    Here is the error message:

    EntryPointNotFoundException: AVPPlayerSetKeyServerURL
    RenderHeads.Media.AVProVideo_OSXMediaPlayer.SetKeyServerURL (System.String url) (at Assets/AVProVideo/Scripts/Internal/OSXMediaPlayer.cs:649)
    RenderHeads.Media.AVProVideo.MediaPlayer.SetPlaybackOptions () (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:948)
    RenderHeads.Media.AVProVideo.MediaPlayer.OpenVideoFromFile () (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:887)
    RenderHeads.Media.AVProVideo.MediaPlayer.Start () (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:520)

    Below is the screen shot of my console.
    Screenshot 2018-11-05 at 12.08.20.png

    Can you help me out?
    Cheers,
    Doruk

    UPDATE: I see the script and plugin versions are not the same in the console message. How can I make the plugin version same as the script version. I tried to delete and re-import the Assets/Plugins folder. But it did not solve it. Any tips?

    UPDATE2: Apparently you need to restart Unity after you make the re-import of the plugins.
    Screenshot 2018-11-05 at 13.50.28.png
     
    Last edited: Nov 5, 2018
    s0phist and AndrewRH like this.
  12. JoRangers

    JoRangers

    Joined:
    Nov 7, 2017
    Posts:
    25
    Hi AndrewRH,

    Thank you for your answers.

    I did your 3 tests :

    1)
    For me the OES mode doesn't work on Oculus GO (all is black) even with the material changed.
    Then I don't have the time to investigate more this solution.

    2)
    The result is the same as exoplayer.

    3)
    This solution need more time to implement but it works.
    I check the option "Persistent" and manage the media player with my own scripts because I have several scenes with their own video.

    I also did some tests with your videos and samples scenes and I can reproduce the crash with them too.

    Best regards,
     
  13. jacknorrisuk

    jacknorrisuk

    Joined:
    Jun 17, 2014
    Posts:
    38
    Hi Renderheads,
    We've encountered an issue that we think is happening in AVPro.

    Strangely, we are getting stuttering videos on Lenovo Mirage headsets that have been updated to Daydream 1.18.180905016 . The devices we have with Daydream version 1.17.180716016 do not stutter and play the videos fine.
    All devices are running Android 8.0.0.

    The stuttering is intermittent, sometimes appearing as low frame rate for a couple of seconds, other times freezes for up to 3 seconds. When rotating head in VR during stuttering, there is a 'frame lock' effect - the edge of the rendered view can be seen before the next frame updates.
    A separate realtime 3D scene in the same app build runs fine.

    Any thoughts you might have would be greatly appreciated.
    Thanks!
     
  14. phileday

    phileday

    Joined:
    Feb 8, 2014
    Posts:
    89
    Hi
    Hopefully a quick question as you've addressed it before in some capacity.

    It's regarding video encoded with stereo enabled in what I think is the metadata. So on Media foundation they appear mono when they should be side by side. Directshow doesn't do this and shows the whole side by side image.

    As I'm aware you're working on a different video path route or something for this I'm not asking for you to offer a fix within AVPro. The question I have is, is there any way to strip the metadata for stereo from the file without re-encoding? I've been trying to do this with FFMPEG but to no avail. Regardless of the options I provide it I always get the same result. The most suggested option for stripping metadata which didn't or is:

    "D:\ffmpeg.exe" -i "test.mp4" -map_metadata -1 -c:v copy -c:a copy "MetaSctriped.mp4"

    Any help would be welcome and understandable if you can't help.

    All the best

    Phil
     
  15. Monarc

    Monarc

    Joined:
    Jun 20, 2016
    Posts:
    7
    Hi
    I sometimes experience the following exception on Android. Do you have any ideas to avoid this?
    The version number of my avpro is 1.9.2



    Thanks in advance.
     

    Attached Files:

    Last edited: Nov 6, 2018
  16. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Please try upgrading to 1.9.4 as I believe we fixed this issue there. Thanks,
     
  17. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    I haven't found a way to always strip the stereo metadata without reencoding the file :( The above does work on some files, but not on most. I think it depends whether the stereo metadata is encoded per frame using SEI, or just as a single ATOM in the MP4 file (easier to strip). But I'm not sure.... Perhaps a special tool could be written to do this.

    The other way is mentioned in the PDF documentation where we convert to a .nut file (lossless) and then encode that into the final video (lossy).

    The best thing is if you can get whatever is encoding at the source to not include stereo metadata.
     
  18. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Hi,
    It sounds like the video decoder is struggling to keep up. Some questions:

    1) What codec, resolution and frame-rate are your videos?
    2) What version of Unity and AVPro Vidoe are you using?
    3) Are you using the OES fast path option?

    Thanks,
     
  19. jacknorrisuk

    jacknorrisuk

    Joined:
    Jun 17, 2014
    Posts:
    38
    So, all of our films are in MKV containers for spatial audio, but the codecs vary, including MPEG-H Part2/HEVC, and H264 - MPEG-4 AVC. Resolution is generally around 4k, but again varies from film to film, including 4096x4096, and 3840x2178. Frame rate also varies - I have films with 30, 25 and 59.9 amongst others. This might seem strange but as I said, they all work perfectly on the previous Daydream version!

    Built in Unity 2018.1.1f1 64bit with AVPro ver: 1.9.1

    And no, we don't have OES fast path enabled.
    Thanks for your help.
     
  20. MaximePeloquin

    MaximePeloquin

    Joined:
    May 15, 2018
    Posts:
    6
    Hi,

    is there a way to pause the video on OnApplicationPause/OnApplicationFocus and not resume it when the app unpause/focuses? This is the behaviour that Youtube and Netflix have.

    I've tried to call MediaPlayer.Pause() manually on my own OnApplicationFocus, but it seems like the IsPlaying() is not updated until next frame.

    Thanks
     
  21. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    That's strange. I can't find any release notes so I have no idea what they changed between daydream versions. Any idea?

    Perhaps it is a bug in their upgrade... Are you able to see whether certain videos are affected more than others? That might try to narrow it down.

    All I can recommend is:
    1) Upgrade to the latest version of AVPro Video
    2) Try switching the video API between ExoPlayer and MediaPlayer (in MediaPlayer > Platform Specific > Android > Video API) to see whether that makes any difference
    3) Make sure that garbage collector is not kicking, causing a stall
    4) Try enabling the OES rendering path.

    Thanks,
     
    jacknorrisuk likes this.
  22. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Yes, you can find this option in the MediaPlayer components in the Events panel. It's called "Play media on app Unpause". Or you can access it via API using the PauseMediaOnAppPause property MediaPlayer.

    Thanks,
     
  23. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Okay, we're investigating....It sounds like it's a problem related to reloading the scene and not reloading the video....Hopefully we can find the problem and include a fix in the next AVPro Video release (version 1.9.5) Thanks,
     
  24. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
     
  25. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Okay, the problem is a known one, written about in our PDF documentation. If you build for other platforms then you shouldnt' have any problem, but on Windows this problem appears. It's all to do with stereo metadata.

    If the video file contains stereo metadata, then our Windows player isn't able to decode it as stereo, so only one eye is shown. So the video files shouldn't have the metadata embedded, or should have it stripped out. This is something we are working improving but it's quite tricky.
     
    fherbst likes this.
  26. coldstar

    coldstar

    Joined:
    Sep 20, 2014
    Posts:
    11
    Hello,
    Does AVPro support external timer/clock source?
    I want to synchronize multiple Video players running on different computers.
    Thanks.
     
    ECNUnity likes this.
  27. AndrewRH

    AndrewRH

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

    AVPro Video version 1.9.5 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 issue where videos would appear too bright when using Linear colorspace and YpCbCr mode
    • Improved support for different video colour transforms (Rec601, Rec709)
    Android
    • Fixed a crash and memory leak bug regression introduced in 1.9.3, caused videos not to release resources when a player is destroyed
    Windows
    • Fixed issue where using Low Latency option and Unity Audio would cause the application to lock up

    Thanks to everyone that reported bugs that were fixed in this release :)

    Please report any issues here on the forum, or to our customer support email

    Thanks,
     
  28. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    AVPro Video doesn't have any explicit support for an external clock, but internally we have written a network cased sync system using AVPro Video to sync videos across the network, so it should be possible to do.
     
  29. AndrewRH

    AndrewRH

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

    I hope you find the notes below useful:

    How do I use a video in a reflection probe?

    If you want a video to appear as part of a reflection in your scene, then you can add a reflection probe, set to update in real-time and refresh every frame.

    Then add geometry to your scene and use the ApplyToMesh component to apply the video to that geometry. If you are using a equirectangular video then you can apply the video to our OctahedronSphere mesh and use a material on it with the InsideSphere Unlit shader. Then as long as your reflection probe is inside this sphere, it should collect the video.

    If you don't want this geometry to appear in your scene, then you can either move the geometry and reflection probe to another area of your scene (you will then have to set the Anchor Override on your MeshRenderer ot make it use that reflection probe), or create a new Layer name and assign it to the geometry and reflection probe, also setting the Culling Mask of the reflection probe so it only renders that geometry. Then in your other cameras you will need to exclude that layer from the camera culling mask list.

    How do I use a video as a skybox?

    If you want the video to appear as the Skybox, create a new material that uses Skybox/Panoramic shader, then go to Lighting Settings and assign this material to the Skybox field. Then add a ApplyToMaterial component and assign it to this material and to the mediaplayer. The video should now render to the default skybox in your scene. You can also leave the Lighting Settings default Skybox field as default, and just add a Skybox component to your camera to override which skybox material it uses.

    Thanks,
     
  30. coldstar

    coldstar

    Joined:
    Sep 20, 2014
    Posts:
    11
    So how can I leverage the internal network sync system? Or will AVPro provide this feature in the future?
     
  31. dorukeker

    dorukeker

    Joined:
    Dec 6, 2016
    Posts:
    37
    Transparency problem with 1.9.5

    Hello,
    Today I upgraded to 1.9.5 (both scripts and plugins).
    There are transparent videos in the project. It is left-right clamp transparency.
    After the upgrade they started to show semi-transparent back ground on iOS.
    On Editor all looks good.

    Below is the actual video file and how they show on the screen.

    Do you have a solution or should I try to down grade to 1.9.4 for now?

    Cheers,
    Doruk

    Screenshot 2018-11-08 at 15.36.02.png IMG_C0CD19A69CAF-1.jpeg
     
  32. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Thanks for reporting this. It's probably due to some changes we made in the shader. Investigating now and will get back to you.
     
  33. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Please could you let me know:

    1) Are you running in Gamma or Linear colourspace mode (it's a setting in Player Settings)?
    2) Which component are you using to display the video: DisplayUGUI, ApplyToMesh, ApplyToMaterial etc?
    3) On the component/material do you have the color field set to full white with full alpha?
    4) If you are using a shader, do you know which one it is?

    If you could also send the video file over (the unitysupport email on http://www.renderheads.com/contact), that would really help us fix it ASAP.

    Thanks,
     
  34. dorukeker

    dorukeker

    Joined:
    Dec 6, 2016
    Posts:
    37
    Thank you for the prompt reply.
    Here are the answers:
    1) Are you running in Gamma or Linear colourspace mode (it's a setting in Player Settings)?
    Gamma
    2) Which component are you using to display the video: DisplayUGUI, ApplyToMesh, ApplyToMaterial etc?
    I have two videos having the same issue one is on DisplayUGUI and the other ApplyToMesh
    3) On the component/material do you have the color field set to full white with full alpha?
    For the DisplayUGUI there isnt a material. And the color is white and alpha 100%
    For the ApplyToMesh also color white and alpha 100%
    See attachements
    4) If you are using a shader, do you know which one it is?
    For the DisplayUGUI there isnt a material (so no shader), for mesh AVPro/Unlit/Transparent (texture+color+fog+packed alpha)

    I will send the video via email referring to this entry.
    Once again this happens on iOS; in editor it shows correct.

    Thanks,
    Doruk
     

    Attached Files:

  35. heric99

    heric99

    Joined:
    Aug 9, 2018
    Posts:
    1
    Hi!

    We have a problem. We have a big video that we want to show(1gb+) so we would like to keep it seperate from the apk. The flow is as followed, we add the video to the android, build the apk with the storage url and launch it on the phone, but all we see is a black screen and the error:

    [AVProVideo] Error: Loading failed. File not found, 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:1712)
    RenderHeads.Media.AVProVideo.MediaPlayer:Update() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:1082)

    upload_2018-11-8_20-28-58.png
    Do you have a checklist of the options that have to be activated to get this to work Or can you help us some other way?

    We are using a Android, Samsung S7 Edge, Unity 2018.2.2f1, AVPro 1.9.5
     
  36. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Did you try doing as the warning says and changing the Write Access option to External?

    Also, are you sure that is the correct path? Path structures vary between Android devices. You can find the true path by going through the File Manager on the phone and looking at the files extra information/properties.

    Also, I'm not sure whether this matters, but I'm sure the Storage is usually lowercase: /storage/emulated/0/video/bb.mp4 it might be worth double checking all of the case in your path.

    Another tip is that, since you're only using this path on Android, it might be best to add this path as an override for the Android platform (go to MediaPlayer > Platform Specific > Android). That way you can still point to the valid video file so you can play it in the editor.

    Thanks,
     
  37. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Thanks for all of that information! We have emailed you the fixed shaders and will include the fixes in the next release.
     
  38. DrMaxP

    DrMaxP

    Joined:
    Sep 18, 2018
    Posts:
    23
    I have a different challenge to my previous post about optimizing non integer playback speeds.

    I now wish to play back video on a Windows 10 machine at normal playback on a >=1060 GTX and >=i5 8th Gen. This source is a 4K video running at 30fps in Unity, being played by AVPro. There is no streaming as the files are on disc. The clients are extremely sensitive to dropped frames or stuttering in the video. Currently, playback is not good enough as they can see some evidence of stuttering in the playback. How can I re-encode the video to minimize the likelihood of frames being dropped without killing quality? In the past you suggested these settings (when I was interested in non integer playback speed).

    ffmpeg.exe -y -i myfile.mp4 -profile:v main -refs 2 -crf 20 -g 1 -tune fastdecode -movflags faststart

    Do I want to increase -crf to reduce the bitrate - i.e. to 28? Will that make it easier of harder for the GPU to decode and playback?
    Will increasing the number of keyframes (-g 1) make it easier of harder for the GPU to decode and playback?

    Is there anything I can change in Unity on the plug-in to improve performance and reduce the likelihood of stuttering?

    Many thanks,

    Max
     
  39. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Hi Max,

    The -g1 option generates the maximum number of keyframes (all frames are keyframes), which includes the bitrate as keyframes are huge. This is a good option when you need to seek through the video quickly, but probably most hardware decoders are expecting normal videos, so if you want to just play back I would recommend -g 30 (a keyframe every second) or -g 60 (2 seconds), or if you don't need to seek around the video at all, then just leave it up to the encoder to insert keyframes when needed (remove -g option).

    Increasing CRF value will reduce bitrate. A modern PC should be able to handle pretty high bitrates. As long as you don't go too crazy.

    So perhaps something like this is a middle ground:
    ffmpeg.exe -y -i myfile.mp4 -pix_fmt yuv420p -refs 2 -crf 20 -g 60 -tune fastdecode -movflags faststart output.mp4

    1) Make sure garbage collections aren't happening. You can find these in the profiler, make sure that you aren't generate garbage each frame during video playback, and make sure garbage is collected before the video playback starts.

    2) For best results change the fullscreen mode from windowed (default) to exclusive. This will give the app exclusive control over rendering and presentation, instead of working with the windows renderer.

    3) Make sure vsync is enabled, disable all Graphics Settings (eg built-in-shaders) that aren't required by your app, disable HW statistics in Player Settings.

    4) Make sure no logging is happening during video playback

    5) Use an older version of Unity, eg 5.6.6. I'm not sure whether this is true, but in my experience the new Unity versions include A LOT of extra stuff...which could just be interfering (extra threads etc), so I always use the version that has the feature I need and no more.

    6) Try using the resampler feature in the MediaPlayer

    7) Make sure the system has as few background processes as possible.

    8) Remove the audio track from the video if you aren't using it. Or even you could experiment with removing it and playing it separately.

    I hope these suggestions help. If you're having trouble please email us (www.renderheads.com/contact/) with details.

    Thanks,
     
  40. DrMaxP

    DrMaxP

    Joined:
    Sep 18, 2018
    Posts:
    23
    Many thanks for such a quick reply. I'll try all of this!

    I presume MediaFoundation is the correct API to use?
    Also what is the "resampler feature"?

    Finally, is the profiler the best tool to spot stuttering? Can the the stuttering be objectively measured in Unity rather than by eye?
     
    Last edited: Nov 9, 2018
  41. Modernllama

    Modernllama

    Joined:
    Nov 30, 2012
    Posts:
    19
    Problem description:
    Seem to notice Http connections won't load videos on Android 9. Using a http link vs a https link, one loads successfully whilst the other doesn't.

    Device (which devices are you having the issue with - model, OS version number):
    Google Pixel XL

    Media We're playing a 360 video which can be seen here: http://virti-videos.s3.amazonaws.com/transcode_52.mp4

    System Information:
    AVPro Video: v1.9.4
    Target Platform: Android/iOS
    Unity: v2018.2.14f1 WindowsEditor
     
  42. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Yes MediaFoundation is probably best.

    Resampler tries to smooth out frame rendering, so it buffers a few frames in memory and then tries to play them at a fixed rate.

    You need both the profiler and your eye. The profiler is needed to make sure there isn't any code that's causing garbage generation/collection or taking up too much CPU time, or causing spikes. You need your eye to make sure the video is playing back smoothly, because it's also about delivering the video frames at a fixed time interval.

    Thanks,
     
  43. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Hmm...I don't have an Android 9 device to test with :)
    Could you check what the error messages are from the adb log cat?

    Thanks,
     
  44. DrMaxP

    DrMaxP

    Joined:
    Sep 18, 2018
    Posts:
    23

    Starting to really tear my hair out here. I've adopted as many of the tips as I can in your post above. I've re-encoded at 4K with different settings (to reduce the bit rate) and at lower resolutions - e.g. 1440(p), even going down to standard HD from the original 4K source and playback is still sometimes stuttering. I've also tried playing back the Unity project at HD resolution with the 4K monitor set to 1920x1080. Playback still sometime stutters and it is unpredictable as to when and how often this happens. This is on an 8th Gen i7 with 1070 (in an MSI laptop). I guess I'm going to have to spend a day in the profiler, but so far there is no obvious culprit. Sigh...

    NB to get these videos playing in Unity I had to download the HVEC codec from the Windows store for Windows 10. Are there any other codecs that might be better to use with AVPro/Unity and Windows 10? Is this the best option to use or are there other codes / implementations than the one from the store here:

    https://www.microsoft.com/en-gb/p/h...urer/9n4wgh0z6vhq?activetab=pivot:overviewtab

    -- Update --

    I think this judder is related to how the PC is connected and set up to drive the 4K TV. You need to ensure the TV is the only connected device - i.e. disable a laptop display if connected - is running at the native resolution, is running at 30Hz and may need to be in game mode. You may also need to disable hardware acceleration on Chrome (that might be a red-herring).
     
    Last edited: Nov 12, 2018
  45. region28

    region28

    Joined:
    May 25, 2013
    Posts:
    2
    Hi.
    I use latest version AVPro Trial for playing multiple videos with different dynamical resolution (from 240p to 1080p, 5 or more), but on iOS apps
    terminates 3mins after start with memory issues.
    App use YouTube Live video stream as video sources, and all videos must be played at one time, becouse must be fast switching between them without buffering lags.
    I can't debug this directly (haven't iOS device), but there is XCode logs.

    Some problem on Android, app closed sometimes without any alerts.

    Latest iOS crash log:
     

    Attached Files:

  46. dorukeker

    dorukeker

    Joined:
    Dec 6, 2016
    Posts:
    37
    Performance question

    TL;DR
    Which one is better? multiple small MediaPlayer with small videos vs. one MediaPlayer with one big video

    Hello All,

    For our current AR project we have scenes with 7 planes, each showing a different video clip at the same time.
    The videos are 720p mp4. The application runs on dedicated iPads (no other applications on the device) from 2017 with 2MB RAM.

    I can see two solutions:
    1) Each plane have their own MediaPlayer that is linked to the plane's ApplyToMesh component. They each show one 720p video.
    2) We have one master MediaPlayer game object in the scene. This MediaPlayer plays a video that contains 7 different content in different X,Y positions. (more like a sprite sheet for video) That would make the video file 4K. Each plane have their own ApplyToMesh component that is linked to this single MediaPlayer. And with the offset values they show a different part of the video.

    My question is which solution would be better for performance.
    More info: Indeed we already implemented the first solution. Once the videos are opened and started The RAM usage increases by 100MB, which is OK for our case. However the AR camera view starts stuttering. That is the reason I ask this question in the forum.

    Any comments will be much appreciated.
    Cheers,
    Doruk
     
  47. Modernllama

    Modernllama

    Joined:
    Nov 30, 2012
    Posts:
    19
    Here's the log.

    It works fine with us changing it to use https. Think I did read however there's a way of setting the exoplayer/mediaplayer to allow insecure connections but think that involves changes on the plugin level. Thought it may also be worth mentioning in the documentation.

    Thanks,
     

    Attached Files:

    • log.txt
      File size:
      16.9 KB
      Views:
      578
  48. AxisUnity

    AxisUnity

    Joined:
    May 16, 2017
    Posts:
    12
    Hello once more AndrewRH,
    I have been using an old version for awhile, but I recently had to update Unity version (2017.2.3p4)
    So I had to update AVPro (1.9.5) as well and am now getting this error on Mac:

    Getting the error in the demo scenes as well
     
    Last edited: Nov 12, 2018
  49. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    The plugin didn't upgrade correctly due to files being locked by Unity. Just close Unity, open it again and before you do anything, import the latest version.

    Thanks,
     
  50. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,647
    Definitely a single video with the same total resolution will perform better than 7 individual videos. It also depends on the frame-rate of your videos though. On such a device I wouldn't try to go over 30fps, unless it's a low resolution video (then 60 is fine).

    Why do you have to play 7 videos at the same time? :D
     
unityunity