Search Unity

Android Video Playback Failing (Error opening extractor)

Discussion in 'Addressables' started by Brad-Newman, Jan 5, 2020.

  1. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    When I was using Asset Bundles for video playback on Android I had to make sure the bundles were uncompressed, or video playback would fail with the OpenExtractor error. So I made sure my bundles weren't compressed, and it worked fine.

    Now that I've migrated to Addressables, I'm again getting this OpenExtractor error (see below).

    01/04 21:31:30.110 7993 8055 Warn Unity: AndroidVideoMedia::OpenExtractor could not translate archive:/CAB-a3e7c4bc7097355175410afad71cedda/CAB-a3e7c4bc7097355175410afad71cedda.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed.
    01/04 21:31:30.110 7993 8055 Warn Unity:
    01/04 21:31:30.110 7993 8055 Warn Unity: (Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 331)
    01/04 21:31:30.110 7993 8055 Warn Unity:
    01/04 21:31:30.110 7993 8055 Warn Unity: AndroidVideoMedia: Error opening extractor: -10004
    01/04 21:31:30.110 7993 8055 Warn Unity:
    01/04 21:31:30.110 7993 8055 Warn Unity: (Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 457)


    To try and fix, I selected my Asset Group and in the Inspector selected Advanced Options > Compression > NONE.

    But I still get the error. Is there something else I need to do? Is there a way to verify that the videos are uncompressed?
     
  2. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Last edited: Jan 6, 2020
  3. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Hardcoding ArchiveAndCompressBundles.cs to make everything uncompressed still resulted in the same OpenExtractor error.. :(
     
  4. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Last edited: Jan 5, 2020
  5. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    1. Created a Cache Initialization Scriptable Object from: Assets > Create > Addressables > Initialization > Cache Initialization Settings.
    2. For this scriptable object, I disabled Asset Bundle Compression.
    3. Opened Window > Asset Management > Addressables > Settings and added an entry to the Initialization Objects list.
    4. Linked the Cache Init scriptable object to this list.
    5. Debugged to verify this scriptable object is called when calling Addressables.LoadResourceLocationsAsync.
    6. Build to device.
    7. Still get the same OpenExtractor error when trying to play a video.
     
    Last edited: Jan 6, 2020
  6. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    At long last, success! Had to set the build options to not compress asset bundles:

    BuildOptions.UncompressedAssetBundle
     
  7. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    @unity_bill Can you verify which of these settings are required? Was hoping to avoid hard coding packages.
     
    phobos2077 likes this.
  8. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    For those facing this issue, unfortunately the error has returned. I'm headed back to using AssetBundles for now. Look forward to using Addressables in the future when it's more robust.
     
    Last edited: Jan 8, 2020
    DavidZobrist likes this.
  9. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    Getting a similar error with Asset Bundles. None of these threads helped fix it:
    https://forum.unity.com/threads/error-videoplayer-on-android.742451/
    https://forum.unity.com/threads/vid...hen-using-url-on-some-android-devices.747260/

    Warn MediaExtractor: FAILED to autodetect media content.
    Error MediaExtractor: Trace connect 0x0 0xbf64fd00
    Error NdkMediaExtractor: sf error code: -1010
    Warn Unity: AndroidVideoMedia: Error opening extractor: -10000
    Warn Unity: (Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 461)
     
  10. Brad-Newman

    Brad-Newman

    Joined:
    Feb 7, 2013
    Posts:
    185
    I restricted my asset bundles to be less than 3GB (maybe you only need to be below 5GB, I wanted to play it safe). I then search through all the asset bundles to find a matching video. Preliminary testing has not reproduced the extractor error, and I can play all the videos! Fingers crossed this solution works while doing further testing and scales with more videos.
     
  11. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    Any proper solution yet? I'm facing the same issue. Trying to add CacheInitializationSettings like the documentation suggested just resulted in Addressable system not working at all. Just nothing gets ever loaded w/o any error message. The only fix was to remove the object from InitializationObjects list. What to do now?

    Here's the last debug message from addressables in the log:

    Initialization object ObjectInitializationData: id=CacheInitialization, type=CacheInitialization created instance UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle.

    After that - nothing, no errors, no further messages from addressables, the scene asset just never gets loaded.

    I did some digging into the source code. It looks like CacheInitialization.CacheInitOp is bugged. The Update method should be called repeatedly until Cache.ready returns true so this operation can complete. But for some reason it's only every getting called once. When running in Editor Cache.ready return true and everything works. But on Android build Cache.ready is false, and the operation never completes.

    After more digging it seams ResourceManager.Update which should trigger Update for all IUpdateRecievers only starts after initialization is done, but it's never done because it's waiting for CacheInitialization.. classic deadlock :)

    So I've found a workaround that seems to work for me:
    Code (CSharp):
    1. // the main game startup script
    2.  
    3. private IEnumerator Start()
    4. {
    5. #if ENABLE_CACHING
    6.         while (!Caching.ready) yield return null;
    7. #endif
    8.  
    9.         StartTheGame();
    10. }
    This way I made sure Caching.ready is true before the Addressables are initialized so I avoid triggering the bug.

    And videos play on Android now with disabled compression.

    I really hope somebody from developers read this.
     
    Last edited: Apr 13, 2020
  12. nnton3

    nnton3

    Joined:
    Sep 8, 2017
    Posts:
    19
    Unfortunately this did not work for me Maybe now there is a more relevant solution to this problem?
     
  13. LilMako17

    LilMako17

    Joined:
    Apr 10, 2019
    Posts:
    43
    phobos2077's solution worked for me for delivering video clip assets via remote assets with addressables. I don't initialize addressables on frame 1 of my application, so the Caching.Ready check wasn't necessary in my case.
    1) put the video(s) in their own new asset bundle group, and flag the group as uncompressed. (I also have it set to pack separately, but i dont know if that matters).
    2) make a cache initialization settings object (and attach it to addressables asset settings)
    3) un-check "compress bundles" in the cache initialization object you just made
    4) rebuild your project, and if installing over an existing install, purge the existing cache and re-download bundles.

    HOWEVER, there is a major downside to all this.

    Now ALL my addressable asset bundles are not compressed in the cache, not just the videos. The download size of bundles is the same, but what used to be 450MB of storage on device is now 1.3GB. I don't think this is acceptable for my project, and I'll have to explore other options for videos.
     
  14. phobos2077

    phobos2077

    Joined:
    Feb 10, 2018
    Posts:
    350
    btw Caching.ready workaround is not needed anymore as this was fixed a while ago with Addressables update.
     
  15. bortmarc8

    bortmarc8

    Joined:
    Apr 14, 2022
    Posts:
    1
    Hi! I was stuck on that same error. In my case I was trying to open a file from my Download folder, as my app don't have permissions to open that path I get this error "androidvideomedia: error opening extractor: -10004" when I loaded those videos on the app persistent folder (Application.persistentDataPath) everything started working just fine.

    Good luck! I hope this may help you.
     
  16. Ruhan-_-

    Ruhan-_-

    Joined:
    Sep 14, 2016
    Posts:
    20
    Can someone please help me? I am having the same issues on Android 9.0 or earlier (API level 28 or lower) when downloading addressable video clip content. I even opened a new thread (attached here is also my project folder with a very simple clip recorded with Unity Recorded).

    "Autoconnected Player "Autoconnected Player" AndroidVideoMedia::OpenExtractor could not translate archive:/CAB-156a9f0d16bb33fc9bb9bb792bf6c6ba/CAB-156a9f0d16bb33fc9bb9bb792bf6c6ba.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed."

    This warning is driving me insane!

    https://forum.unity.com/threads/add...r-lower-not-working-remote-and-local.1337231/
     

    Attached Files:

  17. GGsparta

    GGsparta

    Joined:
    Aug 25, 2017
    Posts:
    14
    For anyone facing this issue, just check the path is EXACLTY the case sensible right path. Had the issue on some of my files where a path was
    *.mp4
    but the file was
    *.MP4
    , making it readable on other target but not on Android.

    If it helps. May you find the bug before it finds you.