Search Unity

Question Lossless video codec support?

Discussion in 'Audio & Video' started by menderbug, Aug 8, 2020.

  1. menderbug

    menderbug

    Joined:
    May 14, 2018
    Posts:
    26
    I'm trying to get a (tiny) lossless video imported into Unity, and I'm a little confused what's supported. The easiest would seem to be an H.264 video with the High 4:4:4 profile and no lossy compression. However, Unity refuses to import these files, saying that High 4:4:4 is unsupported. But all the information I can find online says that Unity can deal with whatever H.264 profiles are supported on the system the app is running, and my PC can definitely run that profile in a number of other programs.

    Is there any way to get this profile running, or is there a different, supported lossless video codec (in particular without any chroma subsampling) that would be supported on most desktop platforms?
     
  2. artfail

    artfail

    Joined:
    Apr 18, 2017
    Posts:
    34
    I need this too. I think unity refuses anything in the High profile for some reason.
     
  3. DominiqueLrx

    DominiqueLrx

    Unity Technologies

    Joined:
    Dec 14, 2016
    Posts:
    260
    Hi!

    Unity's support for H.264 video depends on what the underlying OS libraries support. For instance, on Windows, Baseline, Main and High profiles are supported up to level 5.1, as described in their documentation.You can see what level 5.1 provides over here in terms of resolution and frame rate.

    This is sometimes clouded by the fact that the graphics card will inject its own video decoders, and these will be picked up first - in order to benefit from hardware acceleration - if they fit the content being played.

    For the scenario you are describing, the problem (again: assuming Windows) is that 4:4:4 chroma sampling is not supported for this profile; only 4:2:0 is - refer to the same Microsoft documentation I pointed out above. Confusingly enough, the H.264 profile named "High" is a different thing than the H.264 profile named "High 4:4:4". "High" is 4:2:0 only, whereas "High 4:4:4" supports 4:4:4, 4:2:2 and 4:2:0.

    I'm not aware of an uncompressed movie format that would be supported by the VideoPlayer across desktops.

    If working with image sequences in the Unity timeline is adequate for what you are doing, then you may want to have a look at https://docs.unity3d.com/Packages/com.unity.streaming-image-sequence@0.3/manual/index.html and use it with PNG images. This will obviously result in larger asset content but since you're mentioning your video is tiny, maybe it will be acceptable.

    Hope this helps,

    Dominique Leroux
    A/V developer at Unity
     
  4. artfail

    artfail

    Joined:
    Apr 18, 2017
    Posts:
    34
    Hi,
    Thank you for this in-depth reply. So what it sounds like is "High" is supported but not any of the other High profiles with chroma sampling other than 4:2:0. And this is because Unity does not have its own implementation but rather falls back to what windows or ios supports out of the box.