Search Unity

How to integrate 360 video with Unity

Discussion in 'Audio & Video' started by touloused, Jul 27, 2017.

  1. antics_unity

    antics_unity

    Joined:
    Jul 4, 2018
    Posts:
    2
    Hi touloused,

    thanks for the heads up on how to integrate video in a unity project and it's very cool; I have it working for android and was wondering to get it work for webgl do I need to do something special?

    I am trying to run it on my localhost, but the problem I have is that it is trying to load an sharedassets1.resource file instead of the video's that I provided. I am new in unity and have no clue how to tackle this. Does it have to do with buuildsettings compress mode or something?

    thanks
     
  2. Consort

    Consort

    Joined:
    Nov 16, 2017
    Posts:
    1
    Hi Folks!

    Firstly, thank you Unity for this fantastic addition to Unity.

    My question is this:

    I'm building a simple little app for a client which needs to play 360 videos ( which they are providing to me ) in a youtube 360 format, as shown here. The top half of the video is the left/right panorama, and the bottom half is an up/down panorama. This, I am assuming, is so that the videos don't have stitching issues at the top and bottom of the sphere.

    If I watch the video on youtube ( where the temporary, not final, videos are located ) they look fantastic, and I can look around in 3D and don't see any stitching issues anywhere.

    However Unity's panoramic skybox shader doesn't seem to have support for this layout.

    Can anyone help or suggest how I could get this to work?

    Thanks!

    Dave

    upload_2018-8-15_10-59-38.png
     
  3. JRW_WSP

    JRW_WSP

    Joined:
    Jun 26, 2017
    Posts:
    37
    I have the same question as zulaman! This shader is working great for me on the skybox but not when I apply it to an actual sphere. I can see it fine on the sphere in the scene view but when in the game view I don't see the sphere at all. Its not a normals issue either as its the same (in game) in or outside the sphere. Any ideas why this is happening? I'm hoping to combine 360 video with 3d sound so could really do with being able to teleport around to different "bubbles" rather than always being at the origin...
     
  4. unity_WLLuu-hXxoSJRA

    unity_WLLuu-hXxoSJRA

    Joined:
    Jul 9, 2018
    Posts:
    1
    Hello!
    We're using this to display stereo (upper/lower) panoramic images and are encountering a very visible seam. This doesn't happen when playing stereo video files.When playing, it looks great - the stereo effect is working perfectly, but there is a very visible seam.


    When I uncheck "Generate MipMaps",as digableMatt,my texture changes on error color.
    Texture MaxSize: 8192.
    Dragged the image (7680x7680)
    Oculus Go sdk.
    But when I change texture's max size on 4096 - it's all ok. There is not a very visible seam without.
     

    Attached Files:

    • todo.PNG
      todo.PNG
      File size:
      36.6 KB
      Views:
      889
  5. DaneyT

    DaneyT

    Joined:
    Aug 24, 2017
    Posts:
    4
    Hey Dave,

    I also faced this issue and found a solution. It seems that since the beginning of this year youtube has a new encode format for 360 video's.
    If you use the commands below you will get a normal 360 video from youtube as a "flat" video texture file.

    Source:
    https://github.com/rg3/youtube-dl/issues/15267

    Example get video formats list from URL (with cmd windows)
    youtube-dl --user-agent "" eyn9Bvr4UQ4 -F

    Example: download fragments:
    youtube-dl --user-agent "" eyn9Bvr4UQ4 -f 305+140 --merge-output-format mp4
     
    Last edited: Oct 28, 2018
    Usmith likes this.
  6. DaneyT

    DaneyT

    Joined:
    Aug 24, 2017
    Posts:
    4
    I have a question and I hope someone has already solved it.
    In my quest to get better quality 360 video's I encountered this:
    https://developer.oculus.com/downloads/package/vr5kplayer/

    John Carmack from Oculus seems to have created a way to playback 5k video's with 60frames per second for mobile and pc devices. At the moment (from what I can tell) it is only native supported and not by Unity.
    Has anyone managed to get this working in Unity? Any help is appreciated.

    Greetings,
    Dan
     
  7. Usmith

    Usmith

    Joined:
    Apr 7, 2013
    Posts:
    20
    This works for me, thank you DaneyT
     
  8. AdrianG001

    AdrianG001

    Joined:
    Nov 21, 2018
    Posts:
    2
    Unfortunately after an android update i have the same problem on my Mi mix2

    Regards,
    Adrian Gates
    Technical Consultant - Apps4Rent
     
    Last edited: Nov 22, 2018
  9. voyagelms

    voyagelms

    Joined:
    Jul 12, 2017
    Posts:
    7
    Hi everyone!!

    I just wanted to share my solution for playing 360 video content in Unity in case anyone else is working on the same problem.

    I've created a dedicated thread so that future developers can reference the library easily.

    In any case, I hope everyone can benefit from this!! :)
    And if you liked it, please give a star on the Github repository!!
     
  10. cons_fx

    cons_fx

    Joined:
    Sep 24, 2018
    Posts:
    6
    Hello everyone!

    I'm new to unity VR and I am trying to create a scene in VR where a 360 video plays and then transitions to another one through a skybox transition.

    Basically what I wanted to do is:

    1. Start playing first 360 video with VideoPlayer in Skybox
    2. Transition to video 2 by fading in another Skybox with video 2 attached to it

    Is it possible to do this? Because from what I've found out you need a video player to play any 360 video regardless of the skybox. I've managed to change scenes with the SceneLoader() but that requires the scene to fade in and fade out.
    What I want to do is blend the frames of the first video to the second video and then have the 2nd video play.

    Any workaround this?

    Thanks in advance!
     
  11. souledgar

    souledgar

    Joined:
    Feb 15, 2013
    Posts:
    5
    I assume you're using Unity's Panoramic Skybox technique. The problem is that in Unity, there is only ever one skybox. In order to fade-transition from one thing to another, you need two things to exist at the same time. If you want to continue using the panoramic skybox technique, here's a suggestion off the top of my head:

    1. Before you swap in video 2, render what is currently on the skybox into a texture. Render said texture onto a panoramic sphere or box around the camera, creating a fake skybox. Note that the texture is not a video, its a still.
    2. Swap in video 2. It needs a moment to load up.
    3. When video 2 is ready, fade out the fake skybox.

    Of course, this means that Video 1 freezes while Video 2 loads and transits, but IMO unless you're doing low res and bitrate, attempting to play 2 panoramic videos is risky business at best.
     
  12. voyagelms

    voyagelms

    Joined:
    Jul 12, 2017
    Posts:
    7
  13. dormouse

    dormouse

    Joined:
    Mar 1, 2011
    Posts:
    82
    Hello everyone,
    as i used SkyboxPanoramicShader to display panorama pictures as background, i have noticed that the alpha channel is not considered in the Shader. is there an easy way to add alpha channel to do some fadein-out effect ? thanks for any ideas.
     
  14. enigmagame

    enigmagame

    Joined:
    Feb 16, 2014
    Posts:
    13
    Same issue here, anyone have found a solution?
     
  15. Hunubul

    Hunubul

    Joined:
    Dec 17, 2018
    Posts:
    65
    Hey! I have 2 problems.
    One is that when I view images (.jpg), over-under, stereo, 360 images, I get an ugly blueish line where the edges meet. I tried setting warp more to clamp, I basically tried changing every option on my image, nothing changed. See attached pic.

    EDIT: Building errors have been solved by moving the script to Editor folder. I'm new obviously to this.
    Now I'm getting grey screen even tho cam is on, working, and my scene is checked in build settings. I'll most likely figure it out as well, unlike the line in the pics which I can't seem to solve.

    Why is this happening, how do I solve it?
     

    Attached Files:

    Last edited: Jan 10, 2019
  16. martinamenegon

    martinamenegon

    Joined:
    Aug 28, 2014
    Posts:
    31
    I am having the same issue of Hunubul! it works but I have a bluish seam (video works in other player and unreal, so it is not the video file.. I guess).. anyone that can help with this issue?
     
  17. Hunubul

    Hunubul

    Joined:
    Dec 17, 2018
    Posts:
    65
    News! The empty skybox material is also having the line after the unity update. Does anyone know how to make it disappear?
     

    Attached Files:

  18. jaysalois

    jaysalois

    Joined:
    Jan 12, 2019
    Posts:
    3
    Hey Everyone! Seemingly simple question(maybe not so simple answer as I've searched quite a bit?[and I am sincerely a novice at this])….Is there a way to have multiple hotspots with videos attached automatically load at the same time at Scene Load? I'm trying to sync different camera angles that were recorded simultaneously.
     
  19. ninjaconsultant

    ninjaconsultant

    Joined:
    Apr 1, 2013
    Posts:
    1
    Hi!

    I've been following this google doc with some success (!) to but my 360 videos into Unity 2018.3.9f1 for an interactive project.

    I have a dozen videos, and it's tedious to make a new material each time. I can't seem to duplicate materials... can't I prefab this process somehow? (I'm like an advanced Unity beginner, I suppose).

    Also the doc says to go to Windows -> Lighting, but on this version of Unity on a Mac it's more like Windows -> Rendering -> Lighting Settings, which took some digging because you can't really search for that in the Help menu.
     
  20. DieterLaser

    DieterLaser

    Joined:
    Jul 1, 2017
    Posts:
    7
    oh my god thanks for that!!!
     
    Last edited: May 9, 2019
  21. aetechshop

    aetechshop

    Joined:
    Aug 21, 2019
    Posts:
    1
    nice things draw on 3d maya software i really admire from your work.
     
  22. vrticalmedia

    vrticalmedia

    Joined:
    Jan 19, 2020
    Posts:
    1
    I know this thread is old, but I'm a non-technical 360 Live Streaming enthusiast and am dedicated on making a 360 vr solution. Will Unity ever natively support 360 video live streaming? Whether from AMS or AWS or other rtmp protocols.
     
  23. derekpittx

    derekpittx

    Joined:
    Feb 10, 2020
    Posts:
    1
    Damm even I am having a similar kind of issue, I have searched all over the internet and even have posted on number of threads on different forum, no solution seems to work. I am really frustrated, can anyone of you here help me resolve this issue, I am very much tired now.
     
    Last edited: Feb 11, 2020
  24. Fangh

    Fangh

    Joined:
    Apr 19, 2013
    Posts:
    274
    The 3D Layout does not appears with XR Plugin Management enabled. Which is what 2019.3 suggest to use.
    You have to use the legacy "Virtual Reality Supported" in your project settings.
     
  25. alphakanal

    alphakanal

    Joined:
    Jan 21, 2013
    Posts:
    52
    is there a similar way to view 3D 360° Pictures in unity as well ?
     
  26. Chuno1978

    Chuno1978

    Joined:
    Mar 11, 2020
    Posts:
    1
    I just bought the Vuze + 360 VR camera. My question is, will I be able to take that video after stitching it and import it into Unity for the entire skybox + scene, so that I can then add the player so that they can look around as the video plays?
     
  27. TicTacTommy

    TicTacTommy

    Joined:
    Dec 9, 2019
    Posts:
    3
    Is there a solution available using the new XR management? or a work around when using the XR system?
     
    Andy3D likes this.
  28. Andy3D

    Andy3D

    Joined:
    Jan 31, 2015
    Posts:
    42
    Has anyone figured out a way to enable vr for stereoscopic video when using the XR route? Really don't want to go back to using legacy Oculus utilities. Or is that the only way to use 3d video (side by side) as skybox content in unity 2019?
    Hoping unity can answer this. Im finding a lot of questions on this but no answer from unity.
    Failing an official route, maybe there is a kludgey option in using the old skybox shader and editing it?
     
  29. Morning_Calm

    Morning_Calm

    Joined:
    Jul 9, 2019
    Posts:
    3
    I'm using the Unity VideoPlayer for playing 360 video content on Oculus Go/Quest. Having some issues with caching causing the system to crash at higher resolutions (>4k).
    Best word I've got from Unity is that using the VideoPlayer with a URL is supposed to prevent it from loading the whole file into memory, though with older versions that wasn't how it was supposed to work. Whatever the case is supposed to be, that's not how it works now.
    I thought about encoding the videos using h265 codec so file size is smaller so less memory is needed. But Unity player won't play them. Anyone have any export encoder settings for h265 (HEVC) that work with the Unity VideoPlayer? I'm using Adobe Premiere Pro...
     
  30. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    Indeed, Unity's VideoPlayer isn't caching anything on your behalf when playing from a URL. This isn't to say that the Android API we're using behind the scene isn't doing its own caching, but it's not something we have control of (e.g.: one of the Android versions of the code has this buffering capped to 20Mb). If you could share the info that leads you to conclude the crash is due to the movie getting cached, maybe it'll help us see if there are avenues to control this that we haven't seen yet.

    This will move the problem away but not get rid of it. H.265 is typically half the size of H.264, assuming this is what you're using. Perhaps an additional 2x compression is all that's needed in your context, but I'm just pointing out what to expect.

    It would be interesting to see what the log is saying on your device when it fails to play H.265. I'm seeing these recommendations for H.265 usage on Oculus: https://creator.oculus.com/blog/encoding-high-resolution-360-and-180-video-for-oculus-go/

    This here (https://developer.oculus.com/blog/introduction-to-360-video-for-gear-vr/) recommends:
    • Suggested Stereoscopic Configuration: 3840×2160 video at 30 FPS, encoded with H.265/VP9 10-20mbps bitrate.
    The general recommendation for H.265 on Android is much lower than what Oculus says however. This is the Android reference for H.265 codec support: https://developer.android.com/guide/topics/media/media-formats#video-codecs

    It says:
    • Main Profile Level 3 for mobile devices and Main Profile Level 4.1 for Android TV
    Which is about 960×540@30.0fps. This is of course way lower than what Oculus can do, but it may be a good place to start to validate that Unity's VideoPlayer does in fact work on your device with H.265.

    Note that for H.265 content to play in the Windows editor, you need to instal the HEVC Video Extensions from the Windows App Store: https://www.microsoft.com/en-us/p/hevc-video-extensions/9nmzlz57r3t7?activetab=pivot:overviewtab

    There should be an error message stating this when you try to play a H.265 movie in the Windows editor.

    So if, after doing these basic checks, things are still not working, please submit a bug report so we can investigate.

    Hope we can solve this quickly,

    Dominique Leroux
    A/V developer at Unity
     
  31. Morning_Calm

    Morning_Calm

    Joined:
    Jul 9, 2019
    Posts:
    3
    That's a very detailed and quick response Dominique. Thank you.
    To answer your Qs in order:
    - Yes I was using h264. I followed that Oculus page guidelines for my encodes... Both h264/265 play fine with the standalone Gallery player on my Go in 6K. Issues come when playing videos using my Go app with Unity's VideoPlayer.
    - I have since got some small 6K h265 video files (<10mb) to play on the Go through Unity's VideoPlayer but a larger file (450mb) failed to play.
    - That Android Main profile Level is obviously much too low for 6k, which must be Main Profile Level 6.0 or higher.

    I'm not actually a dev, I am managing this project and editing all the videos but not developing in Unity. My dev posted here about the problem if you wouldn't mind taking a look: https://answers.unity.com/questions/1755981/video-player-memory-usage.html

    If that's not clear, I'll ask my dev to submit a bug report. Thanks again for your help.
     
  32. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi again,

    Thanks for the additional information. The analysis that your dev did is also useful. From my understanding by reading Android's own code, there doesn't seem to be any memory release of the played movie when it's streaming from the web. It just accumulates the content in memory, where it seems to persist (in case the movie is looped or a seek is done, I suppose). But it's hard to know for sure: we'd need to know what Android version is running, etc. And even there, because we delegate all the network download and file parsing to the Android media sdk (namely: MediaExtractor), there may not be much we can do. This also explains why your dev is perceiving an incorrect memory profiling situation with the VideoPlayer: this profiler exposes the memory that Unity itself allocates, but third party libraries (such as the Android media APIs) are not part of this bottom line, hence the picture being incomplete.

    There appears to have been tests to download the file ahead of time and then play from disk. If I understand correctly, these also appear to cause memory usage issues. Again, if the problem lies entirely in Android's MediaExtractor there won't be much we can do. But if the download is happening through UnityWebRequest before the actual playback, then care must be taken to use a DownloadHandlerFile with the request, or else the file will be download to memory (hence causing the out of memory issue again).

    So: if you could file a bug that exposes both - failing - ways of trying to play the video, we will be able to understand more precisely what is going on and possibly suggest workarounds or even fix things, depending on what we find.

    Dominique
     
  33. Morning_Calm

    Morning_Calm

    Joined:
    Jul 9, 2019
    Posts:
    3
    My dev got it sorted with a bug report and some feedback. Thanks a lot.
     
  34. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    My pleasure.

    If you could tell us what the bug id is, we may be able to speed things up with the analysis.

    Thanks for the follow-up!

    Dominique
     
  35. dhanushx012

    dhanushx012

    Joined:
    Sep 7, 2020
    Posts:
    1
    Thanks for the clarification. get-mxplayer.in mxplayer
     
    Last edited: Sep 16, 2020
  36. JoeTheWiltshire

    JoeTheWiltshire

    Joined:
    Apr 23, 2013
    Posts:
    5
    Hi all, I'm trying to use the skybox-panoramic shader to display equirectangular over/under stereo 360s on the quest, but I'm having an issue with distortion at the poles (definitely the south, not sure about the north as my test images don't have a lot of detail at the north)

    This effect isnt mega visible on a flat screen but in VR when looking down creates quite a nauseating effect.
    See image example from one of the blender open films, pole is circled in red:

    Edit: Imgur is down so see attached image example 1 (PoleIssue1)

    This is applied to a sphere in scene, I have tried different geometry / applying directly to skybox but the issue persists, I haven't been able to find a shader that solves this issue.

    I tested a mono image with shape setting "cube", on a skybox cubemap material applied to the same geometry, aside from requiring rotation to match stereo shader orientation it displays mostly the same except that the pole looks much better:

    Edit: Imgur is down so see attached image example 2 & 3 (PoleIssue 3 is using stereo pano skybox, PoleIssue4 is skybox&cube)

    Is unity doing some seam fixing (without the option checked in my texture setup) here with mono images to clean the pole issue? Would this mean that the same fix would not work in VR as the guestimated fixed pixels wouldn't match stereo?

    I have to assume there's a way around this issue but I haven't been able to find any posts about it online.
    Could it also be render settings? I am using 3dsmax & vray for my own renders but they show the same issue as the blender example.

    Is there a shader that fixes this? or a beta version of the stereo pano shader with this issue solved?

    Or am I trying to solve this in the wrong way?
    In the past I have used a 2 sphere setup with skybox cubemap materials for a cardboard app and selective camera rendering which didn't seem to have these issues.
    But with the new oculus XR setup (specifically for quest) selective rendering per eye doesn't seem to work in the same way hence the need for the all-in-one shader.

    Thanks for any help,
    Joe.
     

    Attached Files:

    Last edited: Nov 16, 2020
  37. JoeTheWiltshire

    JoeTheWiltshire

    Joined:
    Apr 23, 2013
    Posts:
    5
    I have also just tried the attached shader which seems to be similar to the standard built in cubemap shader, but supporting stereo images.
    The effect is different and maybe slightly better but as I expected it seems like the fudging at the poles to clean up the seams still results in a nauseating viewing experience in VR.
     

    Attached Files:

  38. toftof

    toftof

    Joined:
    Apr 12, 2014
    Posts:
    5
  39. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    141
  40. sushanta1991

    sushanta1991

    Joined:
    Apr 3, 2011
    Posts:
    305
  41. gazeranco

    gazeranco

    Joined:
    May 1, 2020
    Posts:
    2
    Bit late, but just in case anyone else has this issue (like I did) on your video player change the Aspect Ratio to Stretch. Then the black circles at the top and bottom will go away. I was using the correct resolution for the video file.
     
  42. sfgp1996

    sfgp1996

    Joined:
    May 9, 2023
    Posts:
    3
    Hello guys,

    I play a side-by-side 3D video (1920x1080 for each eye). I try to config this, but in top and button of my screen, the video are not good.

    Can you help me? I will let a image.