Search Unity

Question Videoplayer stutters and speeds up in build, but plays fine in editor

Discussion in 'Audio & Video' started by Steven-1, May 18, 2021.

  1. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    Hi. Sorry for the long silence. So what happens is the bisection team found that the regression occurred at least four years ago during the transition from 2019 to 2020. I assume it is some changes in the graphics API. I presume because we deprecated an internal tool during that time, which means we can only build the engine on an old mac with an old OS. So we only know it happens in a range of ~500 commits. I tried to get my hand on one, but it is tricky when you know you can't downgrade on a Mac, and they are pushing devs to update to newer versions aggressively. After learning this, it went on the back burner as I was dragged into other issues like crashes. I tried multiple times to go back to it but I get quickly backtracked to something else.

    While it is a regression, we changed the backend in 2022 and 2023, so we can't promise it will return to what it was in 2019. This has been a recurrent theme of trying to fix something and regressing elsewhere. We are too dependent on platforms to provide critical pieces outside our ability to repair. It is why we are working on a better solution. But it is more of a long-term plan, so there is nothing I can promise you short term.

    We are trying to improve the stability of the VideoPlayer on all the platforms, and scrubbing is one part of it. So we plan to investigate more, but we may find no simple fix to this problem. We plan to close it as Won't fix, which means we keep it in our backlog as a bug, but we can't provide you with an acceptable timeline.
     
    Last edited: Mar 15, 2023
  2. travelsound84

    travelsound84

    Joined:
    Jan 15, 2014
    Posts:
    34
    First, thanks for getting back on this and for the detailed report.

    While I don't know much about graphics API, it's still disappointing that such an important feature is not working properly and even if it is a regression, it takes so long to improve the Video player's performance on newer unity versions. I would figure all it takes is somebody debugging/profiling what is going wrong with this feature to improve it, but then again I'm not a graphics API programmer, so I can't really judge on that.

    Lesson learned on Unity about the importance of fixing things that were given and taken for granted.
    We will have to see what we can risk for our next releases. In the past, the Asset Store was not reliable too, since Plugins tend to get outdated and didn't work on new Unity Updates. I don't know anymore which is the right way to go about this.

    If you have any recommendations on what I should do, please let me know. Our community and with it our company is depending on this feature (video scrubbing). If you know any plugin out there that solves this problem, and would be reliable in long term, please let me know.

    Kind regards
     
  3. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    It is not cheap but the best alternative that I know off is AVPro. They don't support all platform but they support all the major one and I heard good feedback from it so you could give it a try. It has a free version which could be enough to try. https://assetstore.unity.com/packages/tools/video/avpro-video-core-edition-181844
     
  4. travelsound84

    travelsound84

    Joined:
    Jan 15, 2014
    Posts:
    34
    Thanks for the suggestion.
    We used AVPro in the past, but back then they didn't support iOS and Android, that's why we fell back on Untiy's VideoPlayer. I've been in touch with them now, and it looks like they do have their own internal functions for video scrubbing so I will give it a try. I'll get back to report how that went.
     
  5. Chris-RH

    Chris-RH

    Joined:
    Apr 21, 2022
    Posts:
    222
  6. travelsound84

    travelsound84

    Joined:
    Jan 15, 2014
    Posts:
    34
    Chris-RH likes this.
  7. travelsound84

    travelsound84

    Joined:
    Jan 15, 2014
    Posts:
    34
    I was just informed in the bug report that they are closing the ticket without solving it... just wow.

    For the tests I did so far AVpro worked okay. But it's a real pain to have to pay 400$ for something that just worked fine 2 years ago. I'm not even interested in any of their features, I just needed a VideoPlayer component to work like it used to, with a decent scrubbing performance. This is just so frustrating when you develop a software and every time you do an update you have to struggle with S*** like this... My opinion about Unity is really getting worse and worse in terms of long-term reliability...
     
    Last edited: Apr 27, 2023
  8. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    I told you we would likely close it as Won't fix and explained what it meant. We keep it in our backlog and plan to fix it, but we can't provide it within an acceptable timeframe. And to be clear, from my testing, the scrubbing worsened but is decent. It is really bad for your clip because you have one keyframe every 8 seconds. Having a smaller distance between your keyframe will not only compress it better, but it also improves the seeking a lot. Try it yourself. You just need to reencode your clip with a 1 or 2 secondes keyframes interval. Here is the command to try it with FFmpeg:
    Code (CSharp):
    1. ffmpeg -i <input> -vcodec libx264 -x264-params keyint=30:scenecut=0 -acodec copy out.mp4
    As I said, I am working right now on improving multiple parts of the VideoPlayer and plan to improve seeking, but I don't know how long it will take.
     
    Last edited: Apr 27, 2023
  9. travelsound84

    travelsound84

    Joined:
    Jan 15, 2014
    Posts:
    34
    1. It's not just this clip, we have thousands of clips in our database that are just unusable with any of the latest Unity Versions VideoPlayer components (when scrubbing). And for our clients, I cannot ask them to reencode all of their own clips. Thanks for the suggestion though.

    2. All our clips work fine with AvPro. I'm just not happy with paying 400$ for just a simple component, which was a given feature in the past. And in general, after Unity updates, third-party assets tend to stop working so you have to chase down their developers to update their assets. That's why I don't like to go down that road.

    Since the bug was accepted as a regression, I had hoped that this would be fixed in a predictable time. I'm sorry if I attacked you personally, and I appreciate you getting back and working on the case. The fact remains that I have to either wait and be patient or pay somebody I can't rely on in the long term.
     
    Last edited: Apr 28, 2023
  10. Peterj76

    Peterj76

    Joined:
    Nov 28, 2015
    Posts:
    8
    I have a game with a 25 FPS Intro video.... It plays smooth. I re-rendered that video in 50 FPS put in another game and it plays choppy. I am going to include the 25 FPS version in my new game and see if its something to do with frame rate.
     
  11. The_Island

    The_Island

    Unity Technologies

    Joined:
    Jun 1, 2021
    Posts:
    502
    Please open another thread since this thread is about primarily scrubbing. You need a stable framerate and a good enough device to run 50 fps. Check your profiler, try disabling SkipOnDrop and check if your video is in variable framerate.
     
  12. Awan212

    Awan212

    Joined:
    Mar 1, 2024
    Posts:
    4
    I've encountered similar frame drop issues when building our app "Love Character Test" for standalone platforms. Previously, it ran smoothly on Unity 2018, but after transitioning to Unity 2020, these problems emerged. Have you experimented with newer versions of Unity or reached out to Unity directly regarding this issue?
     
  13. vanceagrig

    vanceagrig

    Joined:
    Jul 13, 2018
    Posts:
    7
    Hi, I have the same issue on a 30fps, 740x480, mp4, video, in unity 2022 all versions up to 2022.3.20f1.
    Any ideas on how to fix it in unity 2022.3.18 up?
    Thanks.

    FIXED : I have disabled the Skip On Drop option in the video player component and it is no longer lagging.

    Thanks : The_Island
     
    Last edited: Mar 12, 2024