Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Video Slow UrlSource Streaming in video player

Discussion in 'Audio & Video' started by 60days, Apr 29, 2019.

  1. 60days


    Jan 27, 2012
    I'm seeing dramatically different speeds between streaming any mp4 video file in Unity vs anything else (e.g. VLC, web browser). This is occurring to the extent that videos that are streamable in any other app are un-streamable in Unity (in fact I haven't found a video that streams properly on my 100mbps connection).

    In unity the speed ranges from 35KBps to 200KBps and doesn't keep up with playback rate, whereas in the other apps it bursts in 3.5MBps or more as more buffer is needed to maintain smooth playback. I appreciate network performance is very dependent on other factors, but the difference in bandwidth use seems consistent across servers & files.

    This behaviour occurs across files as small as 1MB / 7 seconds (when the slow playback extends the length to 30 seconds+) , and larger ones as linked below. It also occurs whether calling Preare() on the player or not.

    I've tested this with 2018.1.2f & 2018.3.4f on MacOS in editor and in standalone on a 100mbps cable connection and 4G connection.

    To Reproduce:

    - use any network throughput monitor (I use Little Snitch on MacOS)
    - add a video player to an empty scene with url of or other mp4, set to render to camera.
    - play the scene and observe throughput
    - enter url into VLC/browser window
    - hit enter and observe throughput

    (be aware unity will cache video segments, so repeat viewings will not give the same result as the first)

    Is there some buffer-size argument I am missing or other config that determines the range requests sent to the server?

    EDIT: I have just tried downloading the file before playing via UnityWebRequest and it performs at the speed of the browser, so I believe this is a buffering & HTTP range request issue with the video player. I will use this approach for now as it ends up >10x faster than the player in total, but for long videos this will introduce unnecessary delays while dowloading video that could already be playing.

    Screen Shot 2019-04-29 at 1.05.12 pm.png
    Screen Shot 2019-04-29 at 1.04.18 pm.png
    Last edited: Apr 29, 2019
    ASerpent likes this.