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. Dismiss Notice

Unity Video Player and Android - Laggy

Discussion in 'Android' started by govi627, Nov 15, 2017.

  1. govi627

    govi627

    Joined:
    Jan 30, 2013
    Posts:
    19
    Hello,

    My video playback on android is laggy using Unitys native video player.

    I am using Unity version 2017.2.0f3, and I am using Unity's built in Video Player to play videos on Android. The videos I am using are mp4/h264 and are relatively small in size(under 10mb). The videos do play but they are not playing back smooth in the slightest. It hangs in the beginning, plays smooth for maybe 2 seconds, then gets choppy again. Made the same build for PC and ran perfectly. Any ideas?

    Some more info:
    • Tested out two devices (Samsung tablet(Lolipop) and Google Pixel 2(Oreo)) - Same Result
    • Tried transcoding to VP8 instead of h264
    • Tried not importing audio and getting rid of Audio Listener

    Appreciate any help, thanks

    Joe
     
  2. rjonaitis

    rjonaitis

    Unity Technologies

    Joined:
    Jan 5, 2017
    Posts:
    115
    Hi,
    There was a known issue with android video player multithreaded rendering, it is fixed in 2017.2.0p3. Try disabling multithreaded rendering in the player settings and see if that makes video playback smooth. If it does not make it better I'll need your video file to check it.
     
    jwsocal likes this.
  3. govi627

    govi627

    Joined:
    Jan 30, 2013
    Posts:
    19
    @rjonaitis

    Thanks for reply, did some extensive testing with a new version of Unity. I couldn't find 2017.2.0p3 but did find 2017.2.0p1 from this link (https://unity3d.com/unity/qa/patch-releases). That did seem to make a big difference. I disabled multithreaded and sure enough the videos played back very smoothly. On oreo the videos played back fine over a long period of time with no slow downs, but on the lolipop device the videos started off fine but got progressively slower over time. Regardless this was a big help so thank you.

    Joe
     
  4. rjonaitis

    rjonaitis

    Unity Technologies

    Joined:
    Jan 5, 2017
    Posts:
    115
    2017.2.0p3 should be released around 22-24 of November.
    Glad this worked out for you. Without any additional knowledge of your scene and video I can't really tell what could be wrong on lolipop device. Best guess it's a lower performance device and it might start overheating overtime reducing framerate.
     
    shindosatoshi likes this.
  5. jwsocal

    jwsocal

    Joined:
    Jul 8, 2017
    Posts:
    1
    This worked pretty well for me. Thanks.
     
  6. StayThirsty

    StayThirsty

    Joined:
    Jul 6, 2013
    Posts:
    33
    It appears this bug is still alive in 2018.2.19f1
    Disabling multi-threaded rendering had improved the video playback for me :)
     
  7. Auguin

    Auguin

    Joined:
    May 23, 2018
    Posts:
    8
    This may help someone, I also have the same problem with building standalone, it's working on computeur but laggy on Microsoft Surface.
    The solution for me is change graphics APIs for windows and take first OpenGLES2.

    Unity 2018.2.7f1
     
  8. Hello996iam007

    Hello996iam007

    Joined:
    Jun 27, 2019
    Posts:
    3
    Hi,Auguin.
    I have the same problem,
    my version is 2018.2.3.f1,
    my target platform is windows standalone.

    The option "multi-threaded rendering " is not existed in PlayerSetting , i can not find it.
    I change GraphicsApi to OpenGLCore/OpenGLES2/OpenGLES3, still no improvement for the video playback, laggy and choppy.
     
  9. ScrafyGaming

    ScrafyGaming

    Joined:
    Dec 4, 2017
    Posts:
    1
    I don't know if you have found a solution yet, but if you Enable "Use Incremental GC", thje video should play smoothly.

    Hope it helps.
     
    Puck_Rui and Marc-Saubion like this.
  10. dezzell

    dezzell

    Joined:
    Feb 7, 2015
    Posts:
    32
    This worked for me. Disabling multithreaded rendering within Unity 2022.2.21. I created a function to disable the main Game Object with Terrain and other game objects, when you play a video, however it was still choppy on Android 13 S21 Ultra. Nothing was running except for the video player and a 50 MB video locally on the device.

    I tried different Video formats, bit rate, h264, h265, and nothing was working. As soon as I disabled Multithreading in Project Settings for Android build, The choppiness went away. Videos play fine now.

    Not sure if Unity can determine a fix for their video player. Seems they have always had issues.

    Even with terrain and other objects enabled and multithreaded disabled, it is choppy. So I have the script disable everything when a video plays and now with multithreaded disabled, at least the video plays normal now.

    I have other apps with videos and at some point I just redirect to Vimeo or YouTube as the video player just doesn't work correctly in Unity.

    I use Unity for mobile apps most of the time, with member login, access to podcast and videos, and it would be nice to have a better video streaming process. I know their are Assets that are super expensive like AVPro that may be better at video performance.

    Maybe Unity can purchase AVPro and integrate into their Product to help developers. I imagine Unity as a be all for App and game development with integrated video streaming and amazing capabilities.