Full range luminance level 0-255

whakan Posts: 73

Hi, I made this thread to help @CedricBonnier with Hitfilm misunderstanding of luma levels.

Part 1 - Context:

I own a Lumix G80, it records 4K @100Mbs, 1080p60 @28Mbts and so on... they both are using MP4 container and H.264 codec (it also record AVCHD but I really don't use it).

The camera let me choose two luma levels

  • 0-255 Full range
  • 16-255 (really strange)

I always shoot full range 'cause compatibility

Part 2 - Hitfilm (Pro v6):

I usually transcode my footage to DNxHD for a smooth editing process but sometime for a fast preview I put the mp4 video straight out from the camera to the timeline, and noticed that the DNxHD (that uses quicktime) looks more "flat" shadows and highlight are not out of the range while the mp4 is more contrasty with SH and HL blowed out.

Part 3 - Media:

Here two frames exported from the hitfilm viewer:

4K MP4 h.264 @100 Mb     0-255

Media info: https://pastebin.com/Ni3pvznK

1080p DNxHD @170Mb   0-255 (I think)

Media info: https://pastebin.com/PCJM35FG

*footage are ungraded anf just added to the timeline

Part 5 - Suggestions:

  • The possibility to set luminance level form the media property window
  • An effect thet let us convert 0-255 to 16-235 and viceversa

Part 6 - Questions:

The hitfilm workspace what luma uses?

whe I export the file from HF what luma levels are set?


If you need a piece of raw video, I can upload it on drive.

Thank you in advance, hope this would help.



  • CedricBonnier
    CedricBonnier Posts: 1,235 Staff

    The possibility to set luminance level form the media property window

    This is already implemented and will be in version 6.2. (I've already said too much, I can't give any dates or ETA).

    An effect thet let us convert 0-255 to 16-235 and viceversa

    I don't think this would be useful as generally once converted, there is a data loss (because we are talking about wrong conversions here, for example expanding 16-235 to 0-255 when the data is already 0-255).

    A good way to see what's going on with your image is to set your project to 16 or 32 bit color and inspect the scopes. After all, that's what the scopes panel is about, checking colors :)

  • Palacono
    Palacono Posts: 3,414 Enthusiast

    @CedricBonnier Vegas has a couple of easy to drop on  Studio-to-RGB or RGB-to-Studio track, or project level, effects and it's pretty obvious if your stuff is out of range and you've gone the wrong way, so you swap them over.

    Doesn't mean you don't use Scopes etc. because you can ideally work in 0-255 and just drop on the 16-235 RGB-To-Studio filter if you're sending .MP4 footage to YouTube (which will re-expand it to 0-255 because...dumb assumptions), but leave it off for anywhere else that leaves it alone.

  • CedricBonnier
    CedricBonnier Posts: 1,235 Staff

    Maybe it does have value, I haven't thought about it much but the export to MP4 already does the conversion IIRC so you wouldn't want to end up doing it twice, especially if you have to re-export the entire video.

    If the functionality present in the next version (6.2) is still not enough to cover all cases, we can add some more functionality around this, it'll mainly depend on user feedback.

  • NormanPCN
    NormanPCN Posts: 4,371 Expert
    edited January 2018

    Part 1: 16-255 (really strange)

    16-255 is not uncommon. This is what I had described in response to one of your other posts as superwhites. Maybe not common in DSLR type cameras but it shows up in genuine video cameras. I don't claim to be an expert in what is common but some time ago in the Vegas forum there was a thread asking people to post what levels their camera captured. There were a lot of 16-255 superwhite cameras.

    As previously stated, superwhites camera data is very problematic with Hitfilm in its current implementation.

    Part 2: DNx looking flatter than your full range MP4 (correctly flagged from your MediaInfo report). This is normal and expected. Your transcode tool performed a full range to studio conversion when encoding to DNx. Hitfilm does/did not expand the DNx levels to full range on import. That is why it is flatter. Computer monitors use full range data (not true 'video' device). Therefore studio levels will look flatter unless adjusted for display. DNx has to go through Quicktime so FxHome maybe be losing some direct control of the decode and levels here.

    As previously stated you can get different results with DNx depending on the transcode tool and the settings used for DNx. Getting studio levels media is the norm, regardless of if the source media is flagged full range or not.

    I had created a test file where I got full range data into a normal DNx file and Hitfilm did not clip the data on import. The basis of my statements about expansion of DNx media in Hitfilm.

    Part 6: Hitfilm is full range RGB internally AFAIK. Hitfilm as of 6.1 does a studio to full range expansion (16..235 -> 0..255) on

    AVC in MP4 or MOV where the full range VUI flag is not present or if present and set to limited/off. The full range flag, on, suppresses this expansion.

    AVCHD probably get the expansion under the same rules as AVC in MP4 but I have never specifically tested it. It just stands to reason that AVC should perform consistently.

    MPEG-2 in MP4. No VUI flag option here. Expansion is always done.

    Cineform does not seem to expand. There might be some Cineform encoder/decoder options that can affect this. Vegas nor Hitfilm offer these and a Vegas encode to Cineform with full range data does not get clipped on import into Hitfilm. Before Hitfilm 2017 and after.

    Hitfilm 6 does the expansion with Prores media. Prores is now natively decoded. I cannot remember what previous Hitfilm versions did with Prores via Quicktime. For some reason I don't think they did the expansion. If true, this is a change in HF6 from previous version(s).   Hitfilm has always clipped full range data in Prores.

    I have uninstalled Quicktime so I can no longer test what Hitfilm might do with Quicktime codec usage. For Prores through Quicktime this would have to be Express 2017.

    I verified my test files with an external video scope app that does not mess with data. It just dumps the raw decode data to the scopes.

    For MP4+AVC export Hitfilm does a full range to studio levels conversion. We want these playback files to be studio 16..235 levels.

    Image sequences are exported full range.

    Cineform export? I did a quick levels export test but I cannot remember the specific results and I never saved a project for that test. If I had to guess they were exported at studio levels.

    My preference is that intermediate formats not mess with my data unless the codec in restricted to studio levels.

  • Triem23
    Triem23 Posts: 20,279 Power User

    Note there are already at least two effects in Hitfilm that let one do any kind of level conversion one wants--Levels Histogram and Curves. Once the conversion is built it can be saved as a custom preset for future use. 

  • Palacono
    Palacono Posts: 3,414 Enthusiast
    edited January 2018

     @Triem23 yes, but they're both bodges that can't be applied at Track level because...no Track level (or Project level) effects.

    It would be useful to be able to have a Studio-to-RGB  or vice-versa filter applied on the Export page (the equivalent for me in Vegas is applying it at the Project level) and as in option for Imports, or on a clip's Properties; assuming they haven't actually been converted on import and are just flags applied to the import footage to display at the different levels while editing, grading etc.

    When I was trying out Convert a while back it was all sorts of wrong for the ranges depending on whether I was exporting ProRes, DNxHD, and their HD or 4K or whatever they're called versions, where it was almost random as to how they'd be stretched or otherwise changed by Convert and/or Hitfilm. So a simple gradient image could be linear, stretched out of range or have notches in it where it had been first squashed, then restretched.  All from the same .MP4 input.

  • NormanPCN
    NormanPCN Posts: 4,371 Expert
    edited January 2018

    I did a test of Cineform export (to AVI) in Hitfilm 6.

    A full range to studio levels conversion is done on export. I would rather it did not do this. When I import that file into Hitfilm the levels are expanded back to full range. Hitfilm import is self consistent with its own output.

    I have a Cineform AVI, generated by Vegas, that has data that would visibly clip if a studio to full range conversion were performed. It does not get clipped on import into Hitfilm.

    I think there is some codec option with Cineform being used. My guess is that there is a flag in the data stream that indicates if data stream is to be interpreted as studio or full range.

    Neither Vegas or Hitfilm have any levels options for Cineform encode. It seems apparent that both are using a different encoding option.

    The Virtualdub native Cineform encoder also does not offer any levels options. Levels is global. I've not tested what it does/generates.

    The Video for Windows Cineform config dialog does show some levels options. VirtualDub can use VfW. Since I do have GoPro studio installed I do have the VfW Cineform encoder/decoders installed.

  • Triem23
    Triem23 Posts: 20,279 Power User

    @Palacono oh, there's room for improvement, but the original wish was for an "effect to do [level conversion]."  There are at least two. There's NO NEED for a specific studio/full levels conversion effect when these could be added as presets to the existing levels/curves effect and can currently be self created quickly. Especially since, as you correctly noted, there's no track level effects (or Grade Layers in the Editor Timeline). If any dev time were to go to levels control it would be Media Properties (which Cedric said too much about) or at export. :) 

  • Palacono
    Palacono Posts: 3,414 Enthusiast

    @NormanPCN if Hitfilm is doing the hokey on Export and then the cokey on Import of the same file, it would be interesting to see what happens after a few round trips on a linear gradient.

    I'd expect notches in the histogram after the first time around, but would it get worse over time? 

  • NormanPCN
    NormanPCN Posts: 4,371 Expert
    edited January 2018

    @Palacono I'm not sure. In part that is why I have stated my preference for intermediates is that they stay full range. The move to studio is a loss in levels and the expand back does not gain them back. Ever.

    With an 8-bit project and a Cineform intermediate one might be pretty safe since Cineform is always 10+ bits. 10-bit studio still has more levels than 8-bit full range. Of course the 422 is a loss and the RGB<->YUV conversion can have loss. There is always Cineform RGB which has no chroma subsample or YUV conversion. And finally there is always the lossy compression.

    So the levels back/forth boomerang would certainly be one of many potential losses but I would not hazard a guess as to what the weighting amongst them would be.

    For the most part I think Hitfilm is going about the levels thing in a smart way. What percentage of people know about the whole levels thing and what you should do and when. Yea right. The OP of this thread posted something showing the DNx was flatter than the full range MP4. Hitfilm is not misinterpreting anything the transcode changed the levels.

    When I got into the whole video thing with Vegas a handful of years ago I was one of those. I had a full range camera and everything looked good in the preview window but the renders looked bad. Vegas does nothing with levels, does nothing to tell you about it, does nothing to help you maintain levels. It is up to you to know about your source and what the render requirements are. I even started a thread about ways to have Vegas help us. One of the SCS developers commented on. No real takers from users but the Dev was interested in reading user discussions on such topics. I eventually gave up trying to maintain studio levels and just wne pure full range and always put a levels conversion on the output bus when rendering.

    Then we have Hitfilm. It tries to completely hide the levels levels mess. I think this is smart. It only ever displays on a computer monitor so full range data is the norm here. It tries conform input to full range. Output is generally conformed to studio on output. No Hitfilm user is ever going to have a complaint about their video in playback does not look the same as the viewer because of an encoding levels problem. A perpetual problem in Vegas. I got sick of answering those problems.

    The idea is good, the implementation has some holes and NO flexibility. Superwhites cameras are a real problem on import. Intermediate seems a bit inconsistent with levels interpretation. Some of that intermediate issue could be Quicktime related. Losing some control over things when using Quicktime codecs.

    Flexibility would be...

    Import. Allow a media pref to disable expansion and/or set the levels interpretation on the file. Default is as currently implemented. This seems to be in the pipeline per Cedric.

    Export. Allow an encode template option for yes/no performing a full to studio levels conversion. Default would be as currently implemented. Better would be MP4/AVC would default to studio and intermediates would default to full (assuming no codec limitations, Cineform okay).

    Especially with intermediates, someone is probably interfacing with some other app or user/app. Who knows what that other user/app wants. Maybe they want/prefer studio or maybe full. To be flexible with interfacing with other things YOU the developer need to take change and be flexible. Don't depend on others to do things for you. Having a levels go/nogo option in Hitfilm has got to be trivial. If it is not trivial, then that is a major red flag.

    Interface flexibility is something I know intimately. Quick story. Not video related. We once had a customer link our (Borland) Pascal compiler output into a Micro Focus Cobol program. Once when we were exhibiting at the Software Development conference in Santa Clara our booth was next to the Micro Focus booth. Chatting with those guys I mentioned that we had a customer link our Pascal into their Cobol system. They gave us a strange look and asked how the hell did they do that. Simple, you document how to link Microsoft C into your stuff and we have an option in our stuff to make it interface like MS C. Back then interface ABI was the lawless Wild West so everybody was going their own way and most compiler runtime systems were (idiotically) persnickety. 

  • Palacono
    Palacono Posts: 3,414 Enthusiast

    @NormanPCN as usual, agree with everything you  said. :)

  • Aladdin4d
    Aladdin4d Posts: 2,466 Enthusiast

    Levels and using DNx with QuickTime has always been unpredictable especially when using multiple apps. The only way Avid folks can guarantee the levels stay consistent is to use MXF instead of MOV. Unfortuately HitFilm doesn't support DNx in an MXF wrapper yet.  

This discussion has been closed.