Search Unity

Bug "Initializing Microsoft Media Foundation failed." when enabling VideoPlayer component

Discussion in 'Audio & Video' started by dgoyette, Feb 17, 2022.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I had a user encounter an error when enabling a VideoPlayer component in my game:

    This feels like a clumsy dependency for Unity to have. Is there a way for me to ensure that VideoPlayer works regardless of which Media Feature Pack features are installed on a player's PC? Or is there at least a way for me to tell, in advanced, whether this error will occur, so that I can do something about it at runtime?
     
  2. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    We depend on Microsoft Media Foundation for any file with H264. If you don't want to have a dependency on Microsoft Media Foundation or any Foundation you should use the webm format. You can use the transcoder in the Editor to transcode your file to VP8. If you want to provide feedback to your users about the dependency, you can use Application.logMessageReceivedThreaded and check for the errors in the log.
     
    ElChileVengador and dgoyette like this.
  3. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Ah, that's very helpful. I have very few videos in my game, so switching to a different format is a totally reasonable solution for me.

    I really appreciate the help with this. Thanks.
     
    The_Island likes this.
  4. emandalaie

    emandalaie

    Joined:
    May 27, 2022
    Posts:
    1
    that's helpful thanks
     
  5. fedorenkosergiy

    fedorenkosergiy

    Joined:
    Jun 11, 2014
    Posts:
    8
    Hello Marc-Olivier,

    I got the same error message in a completely empty project. I created one and removed all built-in packages but I still have the issue. Is there an action I can do to disable it?

    My setup:
    OS: Windows 10 Pro N 21H2
    Unity3d: 2020.3.38f1
    Platforms in the editor: Android, iOS, Standalone

    Thanks,
    Serhii
     
  6. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    Yeah, we send this message when we don't detect MediaFoundation while initializing the video manager. Unfortunately, it doesn't matter if you have videos or not in your project and removing all built-in packages only removes the c# part, not the c++. The good news is even if you get this error, it doesn't impact the rest of your project. I will check if I can fix this in a PR because I understand getting errors that you can't do anything about can be frustrating, but I can't give you an ETA. In the short term, you could install MediaFoundation, but I guess you prefer not.
     
    Last edited: Sep 13, 2022
  7. reev4eg

    reev4eg

    Joined:
    May 10, 2015
    Posts:
    37
    @The_Island Thank you for this workaround. I applied the fix for a system without Media Pack to switch to VP8. My question is about calling Debug.Log in Application.logMessageReceivedThreaded; is it safe?
    upload_2024-1-6_18-57-30.png