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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Question VideoPlayer cannot play URL

Discussion in 'Audio & Video' started by Fabio_Vieira, May 29, 2020.

  1. Fabio_Vieira

    Fabio_Vieira

    Joined:
    Mar 25, 2020
    Posts:
    3
    Greetings community, this is my first time creating a post here, so I hope it's in the right section.

    I'm still a noob programmer and also new to Unity(using unity 2017.4.34f1 and unity 2019.3.0f6.), but I'm trying to get this VideoPlayer asset to work properly.
    My goal is to receive a live broadcast and show it as a texture to this Plane(gameObject). I'm trying to receive the image feed from this URL

    URL tested: http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4

    Errors:
    WindowsVideoMedia error 0xc00d36c4 while reading http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4
    VideoPlayer cannot play url : http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4


    As for the live broadcast, I streamed with OBS Studio over a local RTMP server. But I could only watch that stream with VLC media player, entering URL 'rtmp://myip:1935/live/key.mjpg'.

    I do need to get that stream over the Plane as it'd act like a browser player for example.

    thanks in advance.
     
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    256
    Hi Fabio!

    I've just tested the URL locally, both with 2017.4.40f1 and 2019.3.0f6, and the video does play fine in the VideoPlayer. So there's something more happening on your side for Microsoft Media Foundation to report 0xc00d36c4 (which means "Unsupported byte stream type"). The video itself is quite basic (uses H.264 video encoding, 720p resolution, 24fps, AAC audio encoding, stereo, 44.1KHz) and doesn't pose any problems when played locally using Microsoft's Film&TV app on my Windows 10 system. I cannot think of a definitive reason (Windows version? Missing codecs on your system? Problem accessing this URL from Unity with your network/security config?) for this failure, so you may consider submitting a bug report including your test scene. Also, have you tried with another URL (this one, for example: https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_5MB.mp4)?

    This being said, the live broadcast feed you are creating from VLC will definitely not be supported in Unity's current VideoPlayer. Live streaming - such as rtmp:// - is something we have been considering for a good while but still haven't gotten to it.

    So if you can stick to the http:// streaming - technically called "progressive download" - then you should be able to get this working ... provided we identify what's not working for you in this specific instance.

    Hope we can quickly find and fix what's happening,

    Dominique Leroux
    A/V developer at Unity
     
  3. Fabio_Vieira

    Fabio_Vieira

    Joined:
    Mar 25, 2020
    Posts:
    3
    Thank you for the answer. I think you're probably right about the windows version or other stuff related. I'm making this post to update and maybe guidance since I'm not sure exactly how to do the http streaming exactly. So:

    I've tested both URL on another computer with the same 2017 unity version, and they DO WORK on the Plane. What leads to think that is due to some Windows configuration/lack of codec.

    For the computer that I'm working on that gave me the error at first, testing the URL provided by @DominiqueLrx . It gave another error, that I have no clue what 0x80072ee4 is.

    WindowsVideoMedia error 0x80072ee4 while reading https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_5MB.mp4

    With that in mind. I'll try to fix this problem. And for the live streaming I'll start searching for http streaming and how to set it up. I'm thinking about FFmpeg to stream the entire monitor, but having a hard time understanding how it works.

    An alternative for the rtmp issue that I was thinking about, but yet didn't try. Would be to receive the data inside script and keep making Texture2D, wouldn't be smooth but anything over 10FPS suits my necessity for testing now.
     
    Last edited: Jun 1, 2020
  4. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    256
    Hi Fabio,

    Glad you were able to get the VideoPlayer working for the wanted scenario on another machine. It does look like the original machine you were using has a health problem.

    This error code means WININET_E_INTERNAL_ERROR. It's an error code from Microsoft's Wininet API (deals with http and ftp). There isn't much documentation on what this really means or how to address however. Note that Unity's VideoPlayer tries quite hard to translate these obscure error codes into human-readable strings, but this instance appears to be one of the (many) situations where error code-to-string mechanisms are not working.

    Indeed, if the end goal is to have live streaming (as opposed to reading pre-recorded content from a web server), then you'll have to use something else than the VideoPlayer. You can also look on the Unity Asset Store for live streaming solutions. Furthermore, there are open source C# implementations of RTSP/RTMP that you can adapt to run in Unity, though this is not a trivial amount of work.

    But what you describe (receive images and upload to Texture2D) can also work if the images are not too big and network conditions are good. I have seen projects that implement Motion JPEG (MJPEG) support for Unity so this could be a good place to start.

    Hope this helps,

    Dominique
     
  5. ShadowlessStudios

    ShadowlessStudios

    Joined:
    Jan 8, 2017
    Posts:
    15
    What if I want to watch over the Video Player, a Live Stream with an URL Like this : 192.168.2.149:8081 , it doesnt work ? But why ? Its a Network Stream wich can be opned over a browser or VLC Media Player.
     
  6. FranknSon

    FranknSon

    Joined:
    May 27, 2017
    Posts:
    18
    Any update on rtmp solutions for Unity to play live video streams?