0
\$\begingroup\$

When I try to import a video file to play in a VideoPlayer component, I get the following errors in the Console:

WindowsVideoMedia error 0xc00d5212 while reading C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4

Context: Setting media type for first video stream
Error details: No suitable transform was found to encode or decode the content.
Track types:
   Audio Track, type: U
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
Error while reading movie: C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
VideoClip import error for Assets/Videos/output.mp4
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
-----------------------------------------------------------
WindowsVideoMedia error 0xc00d5212 while reading C:/Users/Jonas/OneDrive/Projects/Project1/Assets/Videos/output.mp4

Context: Setting media type for first video stream
Error details: No suitable transform was found to encode or decode the content.
Track types:
   Audio Track, type:
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

The video file is just an ordinary H.264/AAC MPEG-4 video file transcoded using ffmpeg. But I also tried the same format and H.264/AAC QuickTime MOV (both rendered from Blender) and AVI (JPEG) from Blender as well.

System Details:

  • Unity 2018.4.12f1 (LTS) Personal
  • Build target: Android (Minimum API Level 25)
  • Windows 7 Home Premium 64 Bit (SP1)
  • Blender 2.80
  • ffmpeg version N-85588-g6108805


I tried to post this to the Unity Forums before, but as of writing this, the thread has yet to be greenlighted by moderation, so I might as well try posting it here, as you usally get an answer much more quickly

\$\endgroup\$
0
\$\begingroup\$

Depending on where you are playing the video from, either local or from a url. You have to set the video player to the clip. The paths change depending on what platform you build to so if you want android then you would get the file from streaming assets path

#if !UNITY_EDITOR && UNITY_ANDROID
            url = Application.streamingAssetsPath + "/" + "VideoName.mp4";
        #endif

to just quickly check if your video will work, which it should no problem then you can

 public VideoClip vidClip;//drag or dynamically set your clip 

and then you would set the clip

if (VideoSource == VideoSource.VideoClip)
    {
        player.source = VideoSource.VideoClip;
        player.clip = vidClip;
    }

also note that you normally want to use this inside a Coroutine. then for the rest to work properly you can prepare the player and set the audio.

    player.audioOutputMode = VideoAudioOutputMode.AudioSource;
    player.EnableAudioTrack(0, true);
    player.SetTargetAudioSource(0, audio);


    player.Prepare();
    WaitForSeconds waitTime = new WaitForSeconds(5);
    while (!player.isPrepared)
    {
        yield return waitTime; break;
    }
    image.texture = player.texture;
    player.Play();

    audio.Play();
    while (player.isPlaying)
    {
        yield return null;
    }

Update :

1-updating the adapter- if the files playable in windows media then that error should disappear.

2-Changing the default media player on the machine. Then importing the clip should work without error.

\$\endgroup\$
  • \$\begingroup\$ I can't even import any video clip into the Assets folder. I get this error when importing, so I can't even try to play it. \$\endgroup\$ – Jonas Kohl Nov 12 at 13:12
  • \$\begingroup\$ Can you play the video in media player on your system? May need to update your Display Driver Adapter on the system and try again. If neither of those help I can't think of another solution with the info provided. Hope that helps out \$\endgroup\$ – Justin Markwell Nov 12 at 13:53
  • \$\begingroup\$ The video file plays just fine in media players (tested with VLC, MPC-HC and Chrome) \$\endgroup\$ – Jonas Kohl Nov 12 at 19:45
  • \$\begingroup\$ Yea my best bet is on updating the adapter and if the files playable in windows media then that error should disappear. Mine works fine but when I looked up your error code I was led to issues that involved a update to the display adapter. I do not believe windows 10 has this issue but was a common win7 update. Or possibly change your default media player to vlc on your machine and try to drop it in the project and see if that helps it recognize the import \$\endgroup\$ – Justin Markwell Nov 12 at 20:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.