Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Fredrum's avatar
Fredrum
Expert Protege
12 years ago

Fast HD video playback

Hi,

does anyone have any tips they could share for lowest latency HD video playback in Unity?
A demo I am playing with is using four(4!) HD clips played back simultaneously.

It is some stereo footage I shot and also with an added alpha channel per eye that I generated myself.
At the moment the Alpha channel is a RGB clip like the others but maybe there's a way to create a single color channel video clip that can playback? (I actually haven't tried that yet.)

But it is very choppy at the moment on my i7-gtx660.

I am using just Unity's default movieTexture.

EDIT: I am just noticing that it is very stuttery even when I am playing just one of the streams. Strange as the FPS counter is on a constant 90. (my non video scenes are all smooth as)

EDIT2: There is something strange going on with the HD movieTexture playback. The frame counter goes to 90ish fps when I thought it would be forced to match the Rifts 75Hz if equal or higher? I disabled vsync in Unity but added this to a script, Application.targetFrameRate = 75;
This made the frame counter display 75ish fps but I got the same stuttery feel.

I then got rid of that line and re-enabled vsync and loaded up a lower res version of the clip but otherwise with the same codec/quality etc settings.
This now played perfectly smooth and ran at 75fps. (slower than the full HD clip)


Any ideas why the HD clip would break the smoothness even as it reports higher or equal to 75fps?


Any tips appreciated.


Cheers
Fred

4 Replies

Replies have been turned off for this discussion
  • The RenderHeads AVPro plugin for Unity has worked great for us. It is built on top of the Windows Media Foundation framework and is capable of smoothly playing up to 4k video.
  • Anton's avatar
    Anton
    Honored Guest
    Be careful. The AVPro plugin breaks terribly if you're using:
    - Linear Space Lighting
    - HDR
    - Any image effects (in my experience)

    Its sad there's next to no good video solution in unity..
  • Thanks for the tips Anton.

    We're using AVPro for a project and we're using HDR to bad results. Off to try this now...
  • "Anton" wrote:
    Be careful. The AVPro plugin breaks terribly if you're using:
    - Linear Space Lighting

    I've found that linear space is often handled incorrectly by Unity's native video playback as well, but it can be fixed with a gamma correction shader. If there are HDR issues, this could be tricker to fix.