Videos transcoded with Handbrake are gamma boosted

Parallax Abstraction wrote on 11/11/2015, 10:22 PM
Hey everyone. I've been beating my head against this problem for a while and I hope one of the gurus here has an answer. I run a YouTube channel and record and edit footage in high quality, often with large files. However, I like to archive all my old footage and projects but have limited storage space and budget. What I've been doing to alleviate this is after a while, I take my old captured footage and transcode it using Handbrake. This results in much smaller files with minimal quality reductions.

However, there's one major problem that I can't figure out. Anything that gets transcoded in Handbrake gets a significant gamma boost when imported into Vegas Pro 13, to the point where it looks washed out. Here are comparison shots: https://imgur.com/a/xAllz, the second image being the one that I imported after Handbrake conversion. The brightness difference is pretty obvious there but it's even worse with the raw footage.

Here's the kicker though: This only happens in Vegas Pro. If I view the transcoded video in any other player, the brightness is no different from the original. However, it's not only there when editing in Vegas Pro, it renders out with the gamma boosted as well and that is visible in any player.

I've tried a ton of different Handbrake settings and profiles and nothing has resolved this. Given that it only happens in Vegas Pro, it feels like there must be something I can do to overcome it but I'm stumped. I really want to be able to use Handbrake to archive my footage and save space but not if it's going to do this kind of gamma boost to it.

Has anyone here happened to run into this and have any ideas on it? Thanks so much!

Comments

john_dennis wrote on 11/12/2015, 1:18 AM
Do you have a Computer to Studio RGB filter or any other filter on any event, track or Preview?

I'm not experiencing a levels shift when rendering to Handbrake, but I sincerely believe that you are.
Warper wrote on 11/12/2015, 4:47 AM
Please provide MediaInfo report for source and handbrake encoded file
Please provide screenshot of Vegas project settings.
Please provide screenshots of histogram view for source loaded into vegas and handbrake encoded file loaded into vegas (for the same frame).

If things go well, you can apply Sony Levels filter with computer RGB to studio RGB preset. If things are not so well and you got color claming, you'll need another way to encode your video or different project settings to avoid color clamping.
Parallax Abstraction wrote on 11/12/2015, 10:46 AM
I do not have Computer to Studio RGB enabled but that has been a commonly suggested solution to this problem that I have tried to no avail. Just to be clear, I'm not rendering TO Handbrake, I'm trying to work with footage that has come OUT of Handbrake.
Parallax Abstraction wrote on 11/12/2015, 11:08 AM
Here are the standard project settings I use for 60fps projects: https://imgur.com/JqF5uLI. I use similar settings for 30fps projects.

Here are the histogram comparisons. The bottom image is the footage that came out of Handbrake. It's definitely obvious: https://imgur.com/a/o9min

Here are the two MediaInfo dumps you asked for as well, the first being the original, the second being the Handbrake file. Once again I want to reiterate, the transcoded file looks fine when playing in anything but Vegas.

General
Complete name : V:\PXA Plays\Blues and Bullets\Episode 1\Blues and Bullets 2015-09-17 16-16-22-646.avi
Format : AVI
Format/Info : Audio Video Interleave
Format profile : OpenDML
File size : 12.4 GiB
Duration : 1h 51mn
Overall bit rate mode : Variable
Overall bit rate : 15.9 Mbps
Writing application : BandiAviMuxer 1.0

Video
ID : 0
Format : MPEG Video
Format version : Version 1
Format settings, BVOP : No
Format settings, Matrix : Default
Codec ID : MPEG
Codec ID/Info : Chromatic MPEG 1 Video I Frame
Duration : 1h 51mn
Bit rate mode : Variable
Bit rate : 12.8 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 59.940 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.103
Stream size : 9.94 GiB (80%)

Audio #1
ID : 1
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 1h 51mn
Bit rate mode : Constant
Bit rate : 1 536 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Stream size : 1.19 GiB (10%)
Alignment : Aligned on interleaves
Interleave, duration : 10 ms (0.60 video frame)
Interleave, preload duration : 19 ms

Audio #2
ID : 2
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 1h 51mn
Bit rate mode : Constant
Bit rate : 1 536 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Stream size : 1.19 GiB (10%)
Alignment : Aligned on interleaves
Interleave, duration : 10 ms (0.60 video frame)
Interleave, preload duration : 9 ms

---

General
Complete name : V:\Capture\Blues And Bullets 2015-09-17 16-16-22-646_preview.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 22.0 MiB
Duration : 1mn 0s
Overall bit rate mode : Variable
Overall bit rate : 3 078 Kbps
Encoded date : UTC 2036-02-06 06:28:16
Tagged date : UTC 2036-02-06 06:28:16
Writing application : HandBrake 0.10.2 2015060900

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 0s
Bit rate : 2 912 Kbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59.940 fps
Minimum frame rate : 59.920 fps
Maximum frame rate : 59.960 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.023
Stream size : 20.8 MiB (95%)
Writing library : x264 core 142 r2479 dd79a61
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=2 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=12 / lookahead_threads=4 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=600 / keyint_min=60 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=20000 / vbv_bufsize=25000 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2036-02-06 06:28:16
Tagged date : UTC 2036-02-06 06:28:16
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 59s 968ms
Bit rate mode : Variable
Bit rate : 153 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 1.09 MiB (5%)
Title : Stereo / Stereo
Encoded date : UTC 2036-02-06 06:28:16
Tagged date : UTC 2036-02-06 06:28:16

Thank you for your help!
Warper wrote on 11/12/2015, 4:10 PM
Parallax Abstraction
As you said, it's definitely obvious, the situation is quite the contrary to the one I thought.
As I see, generally you import bandicam capture through vfw interface and get computer levels normalized video. I wonder how you render it for youtube, but that's not imeddiately important.
As I see, Handbrake reads this video and encodes it into studio levels video in mp4 container. It's ok, it's standard and normally players will render exactly same picture when it's decoded back to RGB space from handbrake encode or from source avi file.
But Vegas is not standard player and it works with studio levels by default. It's corrected back on the end side for appropriate codecs and it's corrected for preview in corresponding settings pages.

If my assumption is correct, you have few options:
* apply Levels filter with studio RGB to computer RGB for every handbrake encoded clip when you import it back
* use 32-bit project with 1,000 gamma and some viewing (if it will not screw up your workflow, and you know it's slower)
* force handbrake to produce full-range colors h264 encode (I don't remember how it's done currently, since advanced tab gone, but x264 can do it)

Parallax Abstraction wrote on 11/12/2015, 8:04 PM
That's great info Warper, thank you so much! Yeah, I don't know if the Handbrake GUI has an option for full-range colours or not. I'll certainly look into it as that seems to be the best way to fix this problem at its source. I tried switching to 32-bit colour and it made everything in the preview window look psychedelic.

I'll try your first suggestion with Handbrake and if I can't figure that out, I'll try the others and report back the results. If these work, this will be a huge boon to me. Thank you again!
Parallax Abstraction wrote on 11/12/2015, 9:41 PM
Warper, you are a life saver! So I spent quite a bit of time trying to figure out how to get Handbrake to encode with the full colour range and came up with nothing. I asked on the Handbrake forum but their response seems so far to just be "This is a Vegas problem, talk to them." Helpful. :) Instead, I tried your suggestion of applying the Sony Levels Studio RGB to Computer RGB preset and lo and behold, the converted clips look perfect! Since this issue is only happening with projects that I archive (which is the point at which Handbrake becomes involved), this is an easy thing to do. I can either apply the filters to the archived clips I use in future projects or just to the project as a whole if it's easier. No big deal whatsoever.This is going to save me buckets of archival disk space. Thank you so much!
Parallax Abstraction wrote on 11/12/2015, 10:05 PM
So I discovered something else interesting. When I capture with Bandicam, I was usually doing it as AVI. I tried changing the container to MP4 since that's what the archival footage I encode with Handbrake changes into anyway. When I import a freshly captured MP4 clip from Bandicam into Vegas Pro, I get the same gamma boost that I get from Handbrake and can apply the same steps to correct it. Yet, MP4 footage I capture using AVerMedia RECentral (the software I use with my console capture device) does not have this problem. I guess Bandicam has the same colour space issue. Very odd.
john_dennis wrote on 11/12/2015, 10:24 PM
More than you ever wanted to know about video levels and how different editors handle them:

studio RGB, computer RGB - still not getting it

Sony Levels video FX

Video Levels

What is wrong with Vegas output levels?

Video Preview window levels?

What min/max levels does your cam shoot?

Levels Computer To Studio For Bluray?

Levels 16-235 not really needed anymore?

Can someone explain to me Black levels in a track?

There are other threads.

musicvid10 wrote on 11/13/2015, 6:17 AM
A look at your MediaInfo is revealing.

You've got mpeg-1 (YUV) video inside an AVI wrapper.
Handbrake libav sees the wrapper and defaults to RGB color space as one would expect.
Vegas always defaults to RGB color space, as the links above ultimately attest.

Find which levels preset in Vegas works (on the output, not the preview!), and get on with it wrt your existing captured footage.
You may actually have to stack a couple of filters to get the job done with errored footage.

You probably chose mpeg-1 as your capture codec because it's easier on your CPU.
But its not right for other reasons.

Really, mpeg-1 stopped being maintained when Win XP was released.
I'm sure there are other codecs available in your capturing program.

Experiment.
Parallax Abstraction wrote on 11/13/2015, 7:21 AM
I was originally using NVENC H.264 which puts most of the capture load on my GPU (a GTX 970 which can more than handle it) but the file sizes were insane and I wasn't able to work with them on the timeline in Vegas Pro without it struggling to keep up. When using MPEG-1 (which is actually Bandicam's own version of the codec), there was very little quality difference and the file sizes were much more manageable. However, the latest version of Bandicam which came out just a few days ago, has support for NVIDIA's new HEVC method when capturing to MP4. This actually has the quality of NVENC but smaller file sizes than MPEG-1 and Vegas Pro doesn't struggle with that footage on the timeline. I still have to apply the Studio-Computer RGB filter but that's no big deal at all.

Thanks everyone for the help and for all the links. I'll definitely be checking those out!
musicvid10 wrote on 11/13/2015, 8:04 AM
HEVC opens in Vegas?

Parallax Abstraction wrote on 11/13/2015, 8:18 AM
It appears not. I had thought so last night but sadly, I still had NVENC enabled in Bandicam when I was doing that testing. Serves me right for messing with this stuff well past my bed time. :) It's a bummer that HEVC isn't presently supported but it is what it is. There was a free plug-in mentioned in another thread that supposedly adds support but I don't know how useful that is. I may mess with it. Otherwise, I'll just keep encoding using NVENC and compress it with Handbrake when I go to archive it.