Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Video Jitters when the project is exported to WebGL

Discussion in 'Audio & Video' started by ronshalev3d, Sep 15, 2020.

  1. ronshalev3d

    ronshalev3d

    Joined:
    Apr 30, 2019
    Posts:
    21
    Versions tested:
    2018.2.0, 2018.2.2, 2018.4.27LTS, 2019.2.21, 2019.3.15, 2019.4.10LTS,
    2020.1.0, 2020.1.5

    Using Windows10 64bit
    The project plays the videos using AVPro video player, streaming from StreamingAssetPath via link.
    while the videos play smoothly in windows versions, exporting to WebGL and playing locally on Firefox 70 makes all the videos Jitter and Stutters while playing (the sound plays smoothly).

    I've tried:
    1. Check various Unity versions.
    2. Use Force Smooth Streaming in the AVPro elements.
    3. Reduce video Sizes sometimes from 170MB to 40-50MB.

    In the build log (12)
    throughout all the scenes where a video is loaded, I get the warning
    WebGL warning: texSubImage: `source` cannot be null.

    However, it does not freezes the video, and after 32 warnings I get the comment that "no further warnings will be sent" but the jittering persists.
    thus I don't know if the warning and the issues are connected.

    here is a preview of one of the videos. obviously the movement of the camera is smooth in the original video
    https://drive.google.com/file/d/1hqhLW14DvbsI-kinowLlCAuB7hh25pI0/view?usp=sharing

    Any help from developers or unity staff regarding this strangeness would be appreciated
     
  2. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    Are you saying this happens with the Unity VideoPlayer (and you just verified with AVPro as well), or this is entirely on the AVPro side? If its AVPro, then I recommend you contact RenderHeads directly (see the various support options at the bottom of http://renderheads.com/products/avpro-video/).

    If this is with the Unity VideoPlayer, then you should probably log a bug with a simplified project that reproduces this in case there is something we can do about this.

    I did have a look at your recording, and to me this kind of jitter is coherent with incorrectly interpreted timestamps in H.264 decoding when there are b-frames present (Main or High profiles would use this feature). b-frames mean there will be out-of-sequence frames in the stream so that decoding frame 2 may use data from frame 4, which obviously implies the frame 4 has to be decoded before frame 2. Sometimes decoders get mixed up in their logic and end up showing frames in the order they appear in the stream rather than in the order they should appear temporally.

    To verify this, you may try to re-encode the video and force it to use the Baseline profile. It may solve - or more adequately put: sidestep - the issue. If the problem is as I describe it, then it's quite possibly a browser issue so I suggest trying this out with other browsers for comparison.

    Using ffmpeg, the following command would re-encode the movie with the video track using the baseline profile and will just copy the audio track without re-encoding it. I'm assuming you use H.264 here, please make adjustments if you are using another video codec.

    ffmpeg -i original.mp4 -profile:v baseline -c:a copy using_baseline.mp4

    Let us know what you find, and hope this helps!

    Dominique Leroux
    A/V developer at Unity