Search Unity

Video Video Player Glitchy and Stutters

Discussion in 'Audio & Video' started by Zullar, Apr 23, 2019.

  1. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    615
    I have a .mp4 video which plays smoothly in VLD and Windows Media Player.

    Fresh windows PC reboot + new blank project and when I play the clip with Video Player it's glitchy.

    Any ideas what to look into? Thanks.
     
    guifs, wavekeyboard and EricWilliams like this.
  2. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    247
    • Encode to: Mp4 with H264.
    • Profile: Baseline 3.0.
    • Encoder present: Medium or Fast or VeryFast.
    • FrameRate = 30fps (not 60fps).
    Use HandBrake (it's free) to convert it at the selected size (HD, FullHD, SD, etc...). Get your mp4 and convert it to mp4 again using these adjustments.
     
    guifs and Zullar like this.
  3. JerryWitt

    JerryWitt

    Joined:
    Feb 15, 2019
    Posts:
    3
    What pixel size is your video? What is the frame rate?

     
  4. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    247
    Frame rate: 30 fps (i've tried at 60fps but it not always it works as it should)
    Pixel size... Right now I'm using 1280x720 and 1024x1024 clips
     
  5. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    615
    Video was 1920x1080 @ 60FPS.

    I built the .exe and it was smooth. Only glitchy in editor it seems.
     
  6. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    247
    Ah, ok. I see you are compiling for windows... I was talking about mobile.

    On the other side, if you only play one video, you shouldn't have any problem. Playing several videos in sequence is more tricky and it doesn't work smoothly using 60fps clips (talking about Mobile target here).

    In my experience in windows & IOS playing videos works just fine (as it should to), on android preparing de videoplayer take too much time (a big problem if you are playing several videos in sequence) and on Mac OSX it was unusable, it doesn't play fine a single clip.
     
    guifs likes this.
  7. Anindreo

    Anindreo

    Joined:
    May 6, 2019
    Posts:
    2
    You can use some video transcoder apps to adjust the video parameter settings for better compatibility, like handbrake, freemake, winx video converter free, etc. They are all free.
     
  8. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    615
    I haven't tested Android but have you tried to call VideoPlayer.Prepare( ) on all your different clips before playing? This may push the loading to the beginning and avoid hickups when playing from and transitioning from one clip to the next. Just an idea to try.
     
  9. jocyf

    jocyf

    Joined:
    Jan 30, 2007
    Posts:
    247
    Yeah, I'm preparing all videos before playing them. The Prepare function is superfast on IOS, but in Android it doesn't work so well. On the other side Preparing a video clip while playing another one, create some hickups in the player in screen because all runs on the same threath.

    The idea under my app is to play a videoclip depending on the user action, so I have to prepare the potential clips before the player can interact... (is a sort of interactive movie) and once the select clip is playing you may have to prepare another potential clips (and release the previous one) in order to let the player choose something again.
    It all work perfectly fine on IOS and windows, but it's unusable on Android for that specific reason: The Prepare funcion can not keep up the users interactions.

    I'm using muted audio clips. The apropiate audioclip (a separate wav file) is played manually using my own manager because there is another problem when start playing already prepared clips with audio: there is a delay for half second on IOS. The video just stops for half second and then start playing normally. Using my own audioplayer sincronized with the videoplayer is not a perfect solution (has sincronization problems when pausing and resuming again, for example) but works fine (it works better than playing the video with the audio channel already in the clip).
     
    guifs likes this.
  10. guifs

    guifs

    Joined:
    Sep 13, 2019
    Posts:
    1
    thank you all. I saw my problem with the video here. Special thanks to jocyf who saved me in this video problem on android
     
    jocyf likes this.