Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Create .obb with video bigger than 2 GB for Android (AssetBundle?) ?

Discussion in 'Editor & General Support' started by Xatpy, Nov 6, 2017.

  1. Xatpy

    Xatpy

    Joined:
    Mar 19, 2013
    Posts:
    7
    Hi,
    I am trying to create an Android App that contains a big video file (2.5 GB). Unity does not allow to create automatic .obb (File--> Build Settings --> Player Settings --> Publishing Settings --> Split Application Binary) bigger than 2 GB.
    So, I am trying to include this big video using AssetBundles. However, I am having issues to include that video file (.mp4) as an asset bundle for Android. The issue is that Unity does not accept video files for mobile if they are not included in the StreamingAssets folder. And I do not want to put the file there because BuildAssetBundles does not work with that folder.
    Please, do you know how could this be done? Or any idea about how could I manage it?
    Thanks!
     
  2. BFS-Kyle

    BFS-Kyle

    Joined:
    Jun 12, 2013
    Posts:
    882
    The 2GB limit is a restriction on Android, not from Unity. No matter where you put the 2.5GB file, it will be too big.

    See https://developer.android.com/google/play/expansion-files.html

    Your options are:

    1. Shrink the file size down (re-export the video in a different format)
    2. Split the video up into multiple smaller pieces (can make use of the Android Main + Patch OBB file, 2GB each)
    3. Host the video file online and have your application download it the first time it launches and save it to disk (would mean you have to host the file and pay for bandwidth and manage a large file download)
     
  3. Xatpy

    Xatpy

    Joined:
    Mar 19, 2013
    Posts:
    7
    @BFS-Kyle Thanks for your reply.

    It is an application for Oculus/Gear VR, so I have apk (1GB) + one patch obb file up to 4 GB --> https://developer.oculus.com/blog/tech-note-expansion-file-support-for-gear-vr-beta/

    So, following your second option: Do you know how could I integrate with Unity that big file in a big (> 2 GB) obb file?
     
  4. BFS-Kyle

    BFS-Kyle

    Joined:
    Jun 12, 2013
    Posts:
    882
    Ah thats cool. Yep, you can definitely do that! Its even on the link you just had:

    You just have to manage it yourself. Unity hasn't always had the 'split application binary' option, its just a convenience thing to take care of it automatically for you now. All you have to do is create the .APK which does not include the video file, then turn the video file into the main .obb file (either by putting it into an asset bundle, or zipping it up, or maybe even just renaming it and using it directly). Then using some library (e.g. the OBB Downloader plugin) you can access the obb file and load it up (either by unzipping it, or getting unity to load the asset bundle, or your own way).
     
  5. Xatpy

    Xatpy

    Joined:
    Mar 19, 2013
    Posts:
    7
    Thanks @BFS-Kyle . Yep, I know that it is possible to do, but I know how to do it ^^.
    I tried to add manually (using WinRaR) to one .obb generated by Unity, but it did not work because it seems that Unity signs that obb and if you modify it, Unity is not able to read it.
    Because of that, I was wondering how to do it with asset bundles, because I have not been able to handle/put the video in the asset bundle creation.
    So, I am looking for a procedure to do it. Thanks!!
     
  6. Xatpy

    Xatpy

    Joined:
    Mar 19, 2013
    Posts:
    7
  7. Xatpy

    Xatpy

    Joined:
    Mar 19, 2013
    Posts:
    7
  8. agilelensalex

    agilelensalex

    Joined:
    Apr 7, 2014
    Posts:
    24
  9. eparampara

    eparampara

    Joined:
    Jun 27, 2019
    Posts:
    1
    I m trying to upload my 1GB app in play store. But I can't upload it.
     
  10. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    143
    Hi people from the past!
    Is there no way to just override the 2gb max size for the generated .obb file?
    If it's for the Oculus store its 4gb that's the limit as mentioned, but even some use cases you don't care about the limit (like if we have our own way of distributing apps).
    EDIT;
    Got a build working without splitting to the .obb - used il2cpp and arm64 with lz4 compression - the apk made it to 2.8GB, and works fine on the Oculus Quest which is the target. Seems counter-intuitive that we can't build bigger .obb's with mono (for obvious iteration reasons) when the apk works fine. Give us a warning, but at least the option to do so!

    UPDATE;
    The above method seems to crash on the Oculus Quest 2, and we still can't automatically build main obb files using "Split Application Binary", because of the stupid "above 2GB" limit. Guess I have to implement a manual .obb loading system for our whole project... Come on Unity....
     
    Last edited: Nov 17, 2020
  11. evan_spiegel

    evan_spiegel

    Joined:
    Jul 17, 2019
    Posts:
    26
    Hey there, were you able to upload the 2.8 GB apk to Oculus using command prompt and ovr-platform-util? Or did you sideload it? When I tried uploading my full 4.1 GB apk to Oculus it said max size 1.1 GB for the apk.
     
  12. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    143
    Yea no - this was only a sideloaded project so didn't have the need.
     
  13. AdamSt

    AdamSt

    Joined:
    Jun 2, 2013
    Posts:
    18
    Did anyone came to a solution for this? I'm facing this problem also right now - having 180 3D VR movies for Oculus Quest, app is ready, released for steam and now I'm facing all these problems releasing on Quest - max app size 1GB, max obb 4GB but unity will let me create only max 2GB. It's propably stupid "tick" somewhere in code of unity, so maybe just give option to turn off this limitation?
     
  14. evan_spiegel

    evan_spiegel

    Joined:
    Jul 17, 2019
    Posts:
    26
    Upgrading to Unity version 2019.4.17 got rid of that error for me and let me make builds with obb bigger than 2GB!