Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Playing 4K video in Unity3D

Discussion in 'Editor & General Support' started by dormouse, Nov 20, 2017.

  1. dormouse

    dormouse

    Joined:
    Mar 1, 2011
    Posts:
    65
    Hello everyone,

    Recently, we are going to play 4K videos in Uinty3D with format H264 and 3840*3840 resolution. But we have figure out some issues:

    With our first test with MacBook Pro Late 2013, GT 750M, in Unity3D(2017.2.0f3). Preview 4K video has green screen issue (OpenGL rendering), see attach. There's no video preview at all, only hear some sound...

    When tested the same video clip on Alienware R15 with GTX 1070 (Windows 10) with Unity3D(2017.1.1f1), Playing 4K video in preview is OK, but with significant lag and losing frames...

    Then with a big machine with GTX Titan X (Windows 10), in Unity (2017.1,0). Playing quality is Good, there's no more lag nor losing frames issue.

    In all conditions above, playing 4K video out side Unity3D are all very good, no lag nor losing frames.
    We also tested reducing resolution to 512*512 with Unity3D, it works well, no lag nor losing frames.

    Could anyone figure out where is the bottleneck or any solutions ? or how we can report this issue to Unity ?

    all the best
     

    Attached Files:

  2. Biggix

    Biggix

    Joined:
    Dec 8, 2014
    Posts:
    37
    You might want to re-code your video file with a much lower bitrate and see if it helps.
    Code (CSharp):
    1. ffmpeg -i yourfile.mp4 -vcodec libx264 -crf 24 file_reencoded.mp4
    2.  
    24 is the numer for the bitrate. (You can start as low as 21) If it helps, increase bitrate by a small amount and test until you find an acceptable performance/bitrate ratio.
     
  3. dormouse

    dormouse

    Joined:
    Mar 1, 2011
    Posts:
    65
    thanks a lot. Do you think the issue comes from Graphical Card ?because in the test materials above, only TitanX is 4K VR read graphic card. others are not.
     
  4. Biggix

    Biggix

    Joined:
    Dec 8, 2014
    Posts:
    37
    Did you find a solution? I don't think this could be hardware based. The files should be playing anyway.