Can I set the color profile in the GUI version of HandBrake?

HandBrake for Mac support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
Uli
Posts: 5
Joined: Sat Oct 12, 2019 11:40 pm

Can I set the color profile in the GUI version of HandBrake?

Post by Uli »

Hi everyone,

First post of a complete HandBrake newbie – I hope it isn’t too stupid. :? And thanks for this fantastic app and all your support! :D

Description of problem or question:

I’m trying to convert a short SD movie in mov container format (huge file size and incorrect aspect ratio) into a smaller mp4 one with the correct aspect ratio.

To do this I used the Fast 1080p30 preset and changed the PAR to 16:15 (which produces the correct ratio).

This works flawlessly except that HandBrake sets the color profile to 6-1-6 (NTSC). But since this is a PAL movie, the resulting colors are wrong.

I see that in the CLI version of HandBrake, there’s an option to set the correct color profile (--color-matrix pal). Is there a way to achieve this in the Mac GUI version, too? I tried to enter something into Video > Extra Options, but whatever syntax I tried, it wasn’t recognized.

If it’s not possible in the GUI version, could you tell me how I can find out how to perform exactly the same conversion I performed in the GUI version (because everything else was just as I wanted), only with the additional --color-matrix pal option?

Thanks a lot in advance!

Uli

HandBrake version:
1.2.2

Operating system and version:
macOS 10.14.6 Mojave

HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

HandBrake Activity Log for Session: 2019-10-12T00:35:59Z
Handbrake Version: 1.2.2 (2019022300)
jana (Konvertiert).mp4
Preset: Fast 1080p30 (Modifiziert)
[02:35:59] macgui: QueueCore prevented sleep
[02:35:59] macgui: QueueCore scanning specifically for title: 1
[02:35:59] CPU: Intel(R) Xeon(R) CPU           W3680  @ 3.33GHz
[02:35:59]  - logical processor count: 12
[02:35:59] hb_scan: path=/Volumes/Media/Privat/2012/Korsika/jana (Konvertiert).mov, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image /Volumes/Media/Privat/2012/Korsika/jana (Konvertiert).mov
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[02:35:59] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[02:35:59] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Media/Privat/2012/Korsika/jana (Konvertiert).mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2019-10-12T00:10:48.000000Z
    encoder         : Mac OS X v? (AVF 1550.4, CM 2290.13, x86_64)
    encoder-eng     : Mac OS X v? (AVF 1550.4, CM 2290.13, x86_64)
  Duration: 00:06:33.65, start: 0.000000, bitrate: 6023 kb/s
    Stream #0:0(deu): Audio: none (WMA2 / 0x32414D57), 44100 Hz, 2 channels, 132 kb/s (default)
    Metadata:
      creation_time   : 2019-10-12T00:10:48.000000Z
      handler_name    : Core Media Audio
    Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 720x576 [SAR 1:1 DAR 5:4], 5890 kb/s, 24.99 fps, 25 tbr, 2500 tbn, 5k tbc (default)
    Metadata:
      creation_time   : 2019-10-12T00:10:48.000000Z
      handler_name    : Core Media Video
      encoder         : H.264
[02:35:59] scan: decoding previews for title 1
[02:36:00] scan: 10 previews, 720x576, 24.995 fps, autocrop = 0/0/0/0, aspect 1.25:1, PAR 1:1
[02:36:00] libhb: scan thread found 1 valid title(s)
[02:36:00] macgui: QueueCore scan done
[02:36:00] 1 job(s) to process
[02:36:00] starting job
[02:36:00] decomb filter thread started for segment 0
[02:36:00] decomb filter thread started for segment 1
[02:36:00] decomb filter thread started for segment 2
[02:36:00] decomb filter thread started for segment 3
[02:36:00] decomb filter thread started for segment 4
[02:36:00] decomb filter thread started for segment 5
[02:36:00] decomb filter thread started for segment 6
[02:36:00] decomb filter thread started for segment 7
[02:36:00] decomb filter thread started for segment 8
[02:36:00] decomb filter thread started for segment 9
[02:36:00] decomb filter thread started for segment 10
[02:36:00] decomb filter thread started for segment 11
[02:36:00] decomb check thread started for segment 0
[02:36:00] decomb check thread started for segment 1
[02:36:00] decomb check thread started for segment 2
[02:36:00] decomb check thread started for segment 3
[02:36:00] decomb check thread started for segment 4
[02:36:00] decomb check thread started for segment 5
[02:36:00] decomb check thread started for segment 6
[02:36:00] decomb check thread started for segment 7
[02:36:00] decomb check thread started for segment 8
[02:36:00] decomb check thread started for segment 9
[02:36:00] decomb check thread started for segment 10
[02:36:00] decomb check thread started for segment 11
[02:36:00] mask filter thread started for segment 0
[02:36:00] mask filter thread started for segment 1
[02:36:00] mask filter thread started for segment 2
[02:36:00] mask filter thread started for segment 3
[02:36:00] mask filter thread started for segment 4
[02:36:00] mask filter thread started for segment 5
[02:36:00] mask filter thread started for segment 6
[02:36:00] mask filter thread started for segment 7
[02:36:00] mask filter thread started for segment 8
[02:36:00] mask filter thread started for segment 9
[02:36:00] mask filter thread started for segment 10
[02:36:00] mask filter thread started for segment 11
[02:36:00] mask erode thread started for segment 0
[02:36:00] mask erode thread started for segment 1
[02:36:00] mask erode thread started for segment 2
[02:36:00] mask erode thread started for segment 3
[02:36:00] mask erode thread started for segment 4
[02:36:00] mask erode thread started for segment 5
[02:36:00] mask erode thread started for segment 6
[02:36:00] mask erode thread started for segment 7
[02:36:00] macgui: QueueCore started encoding jana (Konvertiert).mp4
[02:36:00] mask erode thread started for segment 8
[02:36:00] macgui: QueueCore with preset Fast 1080p30 (Modifiziert)
[02:36:00] mask erode thread started for segment 9
[02:36:00] mask erode thread started for segment 10
[02:36:00] mask erode thread started for segment 11
[02:36:00] mask dilate thread started for segment 0
[02:36:00] mask dilate thread started for segment 1
[02:36:00] mask dilate thread started for segment 2
[02:36:00] mask dilate thread started for segment 3
[02:36:00] mask dilate thread started for segment 5
[02:36:00] mask dilate thread started for segment 4
[02:36:00] mask dilate thread started for segment 6
[02:36:00] mask dilate thread started for segment 7
[02:36:00] mask dilate thread started for segment 8
[02:36:00] mask dilate thread started for segment 9
[02:36:00] mask dilate thread started for segment 10
[02:36:00] mask dilate thread started for segment 11
[02:36:00] yadif thread started for segment 0
[02:36:00] yadif thread started for segment 1
[02:36:00] yadif thread started for segment 2
[02:36:00] yadif thread started for segment 3
[02:36:00] yadif thread started for segment 4
[02:36:00] yadif thread started for segment 5
[02:36:00] yadif thread started for segment 6
[02:36:00] yadif thread started for segment 7
[02:36:00] yadif thread started for segment 8
[02:36:00] yadif thread started for segment 9
[02:36:00] yadif thread started for segment 10
[02:36:00] work: only 1 chapter, disabling chapter markers
[02:36:00] yadif thread started for segment 11
[02:36:00] job configuration:
[02:36:00]  * source
[02:36:00]    + /Volumes/Media/Privat/2012/Korsika/jana (Konvertiert).mov
[02:36:00]    + title 1, chapter(s) 1 to 1
[02:36:00]    + container: mov,mp4,m4a,3gp,3g2,mj2
[02:36:00]    + data rate: 6023 kbps
[02:36:00]  * destination
[02:36:00]    + /Volumes/Media/Privat/2012/Korsika/jana (Konvertiert).mp4
[02:36:00]    + container: MPEG-4 (libavformat)
[02:36:00]      + align initial A/V stream timestamps
[02:36:00]  * video track
[02:36:00]    + decoder: h264
[02:36:00]      + bitrate 5890 kbps
[02:36:00]    + filters
[02:36:00]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[02:36:00]      + Decomb (mode=39)
[02:36:00]      + Framerate Shaper (mode=2:rate=27000000/900000)
[02:36:00]        + frame rate: 24.995 fps -> peak rate limited to 30.000 fps
[02:36:00]      + Crop and Scale (width=720:height=576:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[02:36:00]        + source: 720 * 576, crop (0/0/0/0): 720 * 576, scale: 720 * 576
[02:36:00]    + Output geometry
[02:36:00]      + storage dimensions: 720 x 576
[02:36:00]      + pixel aspect ratio: 16 : 15
[02:36:00]      + display dimensions: 768 x 576
[02:36:00]    + encoder: H.264 (libx264)
[02:36:00]      + preset:  fast
[02:36:00]      + profile: main
[02:36:00]      + level:   4.0
[02:36:00]      + quality: 22.00 (RF)
[02:36:00]      + color profile: 6-1-6
[02:36:00] sync: expecting 9839 video frames
[02:36:00] encx264: encoding at constant RF 22.000000
[02:36:00] encx264: unparsed options: level=4.0:ref=2:8x8dct=0:weightp=1:subme=6:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=30
x264 [info]: using SAR=16/15
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
x264 [info]: profile Main, level 4.0, 4:2:0, 8-bit
[02:36:00] sync: first pts video is 0
[02:36:00] sync: "Kapitel 1" (1) at frame 1 time 0
[02:37:13] reader: done. 1 scr changes
[02:37:14] work: average encoding speed for job is 133.901459 fps
[02:37:14] comb detect: heavy 1 | light 32 | uncombed 9805 | total 9838
[02:37:14] decomb: deinterlaced 1 | blended 32 | unfiltered 9805 | total 9838
[02:37:14] vfr: 9838 frames output, 0 dropped and 0 duped for CFR/PFR
[02:37:14] vfr: lost time: 0 (0 frames)
[02:37:14] vfr: gained time: 0 (0 frames) (0 not accounted for)
[02:37:14] h264-decoder done: 9838 frames, 0 decoder errors
[02:37:14] sync: got 9838 frames, 9839 expected
[02:37:14] sync: framerate min 11.521 fps, max 25.000 fps, avg 24.994 fps
x264 [info]: frame I:43    Avg QP:18.74  size: 36025
x264 [info]: frame P:7097  Avg QP:22.17  size:  7073
x264 [info]: frame B:2698  Avg QP:24.36  size:  2408
x264 [info]: consecutive B-frames: 61.1%  3.2% 11.2% 24.5%
x264 [info]: mb I  I16..4: 25.8%  0.0% 74.2%
x264 [info]: mb P  I16..4:  1.0%  0.0%  0.6%  P16..4: 73.5% 10.0%  5.7%  0.0%  0.0%    skip: 9.2%
x264 [info]: mb B  I16..4:  0.9%  0.0%  0.0%  B16..8: 35.7%  2.0%  0.0%  direct:24.2%  skip:37.2%  L0:48.4% L1:47.6% BI: 3.9%
x264 [info]: coded y,uvDC,uvAC intra: 50.9% 97.7% 70.8% inter: 13.7% 59.6% 10.0%
x264 [info]: i16 v,h,dc,p: 30% 20% 28% 22%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 19% 21%  5%  6%  6%  5%  5%  4%
x264 [info]: i8c dc,h,v,p: 54% 18% 22%  6%
x264 [info]: Weighted P-Frames: Y:0.2% UV:0.1%
x264 [info]: ref P L0: 84.8% 15.2%
x264 [info]: ref B L0: 77.8% 22.2%
x264 [info]: ref B L1: 94.2%  5.8%
x264 [info]: kb/s:1183.70
[02:37:14] mux: track 0, 9838 frames, 58238259 bytes, 1183.58 kbps, fifo 4096
[02:37:14] libhb: work result = 0

User avatar
BradleyS
Moderator
Posts: 1817
Joined: Thu Aug 09, 2007 12:16 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by BradleyS »

Save your GUI settings as a new preset, then import it in the CLI using --preset-import-gui --preset="Name". Then you can apply the additional options you need.

Uli
Posts: 5
Joined: Sat Oct 12, 2019 11:40 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Uli »

BradleyS wrote:
Sun Oct 13, 2019 3:16 am
Save your GUI settings as a new preset, then import it in the CLI using --preset-import-gui --preset="Name". Then you can apply the additional options you need.
Thanks!

But if I understand this correctly, your reply implies that there is no way in the GUI app to set the color profile, is this correct?

User avatar
BradleyS
Moderator
Posts: 1817
Joined: Thu Aug 09, 2007 12:16 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by BradleyS »

At the moment, that is correct. This might change in the future as we have plans to overhaul some of these areas.

User avatar
BradleyS
Moderator
Posts: 1817
Joined: Thu Aug 09, 2007 12:16 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by BradleyS »

I should add, it's possible the source doesn't have this information set (or we're not reading it correctly), so HandBrake is guessing a profile.

Uli
Posts: 5
Joined: Sat Oct 12, 2019 11:40 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Uli »

BradleyS wrote:
Sun Oct 13, 2019 3:21 am
At the moment, that is correct. This might change in the future as we have plans to overhaul some of these areas.
I see, thank you! It would be a very useful enhancement from my POV.
BradleyS wrote:
Sun Oct 13, 2019 3:23 am
I should add, it's possible the source doesn't have this information set (or we're not reading it correctly), so HandBrake is guessing a profile.
Yes, that’s definitely the case here. No info in the source file, and HandBrake is guessing wrong (I think) because the aspect ratio is also distorted and 720 x 576 (typical of NTSC) instead of correctly 768 x 576 (typical of PAL). Maybe HandBrake would guess correctly if it used the target aspect ratio instead of the source aspect ratio. Anyway, I know that in this specific case that the original video was a PAL recording, and the color looks a bit out of place with 6-1-6.

Thanks for your help, I’ll try the CLI for now!

Uli

User avatar
Rodeo
HandBrake Team
Posts: 12475
Joined: Tue Mar 03, 2009 8:55 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Rodeo »

If you use the x264 encoder, you can set the color matrix and related options via the libx264 options text box, and we do read those back after x264 options get applied, unless this has changed. Not sure about other encoders.

Uli
Posts: 5
Joined: Sat Oct 12, 2019 11:40 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Uli »

Rodeo wrote:
Sun Oct 13, 2019 6:13 am
If you use the x264 encoder
Well, at least I am under the impression that I do. In the Video pane of the GUI, the video encoder popup is set to H.264 (x264) and the log says

Code: Select all

job configuration:
[...]
   + encoder: H.264 (libx264)
you can set the color matrix and related options via the libx264 options text box
The text box you refer to is the Extra Options text box in the Video pane, is this correct?

If so, how would be the exact code I would have to enter in this text box to add the PAL color profile? Everything I could think of and tried did not work.

My latest trial was

Code: Select all

videoformat=pal
in the text box. This resulted in the GUI saying:

Code: Select all

x264 Unparse: videoformat=pal:level=4.0:ref=2:weightb=0:no-deblock=1:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=30
and the log file saying:

Code: Select all

[04:18:26]    + encoder: H.264 (libx264)
[04:18:26]      + preset:  fast
[04:18:26]      + tune:    fastdecode
[04:18:26]      + options: videoformat=pal
[04:18:26]      + profile: main
[04:18:26]      + level:   4.0
[04:18:26]      + quality: 22.00 (RF)
[04:18:26]      + color profile: 6-1-6
[04:18:26] sync: expecting 9839 video frames
[04:18:26] encx264: encoding at constant RF 22.000000
[04:18:26] encx264: unparsed options: videoformat=pal:level=4.0:ref=2:weightb=0:no-deblock=1:cabac=0:8x8dct=0:weightp=0:subme=6:vbv-bufsize=25000:vbv-maxrate=20000:rc-lookahead=30
So my additional setting was listed, but the color profile was still 6-1-6. :(

User avatar
Rodeo
HandBrake Team
Posts: 12475
Joined: Tue Mar 03, 2009 8:55 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Rodeo »

You need to set the matrix, primaries and transfer specifically.

Also I don 't think this would be reflected in the log as the job configuration gets written before encoder init, but you could check the output via MediaInfo.

User avatar
Rodeo
HandBrake Team
Posts: 12475
Joined: Tue Mar 03, 2009 8:55 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Rodeo »

I can't remember the recommended values for PAL off the top of my head though.

Uli
Posts: 5
Joined: Sat Oct 12, 2019 11:40 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Uli »

Rodeo wrote:
Sun Oct 13, 2019 2:06 pm
You need to set the matrix, primaries and transfer specifically.
Yep, that did it! :D Thanks a lot! :D :D

The complete settings for PAL in the Extra Options text box would be:

Code: Select all

videoformat=pal:colorprim=bt470bg:transfer=bt709:colormatrix=smpte170m
(I left the videoformat tag for consistency, don’t know if it actually does anything …)

However, since in my case (PAL 5-1-6 instead of NTSC 6-1-6) the only difference are the Color Primaries (the first component),

Code: Select all

colorprim=bt470bg
actually produces exactly the same result and was all I needed.

(For those interested, the meaning of the numbers of 6-1-6 etc. are listed in e.g. https://github.com/bbc/qtff-parameter-editor.)
Also I don 't think this would be reflected in the log as the job configuration gets written before encoder init
Correct.
but you could check the output via MediaInfo.
The Inspector window of the macOS Finder also lists this metadata correctly, so there’s not even a need for MediaInfo. Of course I always looked there to confirm the result; I just did not mention it here.

Again, thanks a lot! Problem solved. :D

(An explicit Color Profile popup in the GUI would still be a good idea IMHO, for those who feel not familiar with textual options. The GitHub link above points to a small program written by the BBC for only the task of setting the color profile correctly in video files, as almost no software allows you to do this.)

User avatar
BradleyS
Moderator
Posts: 1817
Joined: Thu Aug 09, 2007 12:16 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by BradleyS »

Yes, I forgot x264 allows one to set these values manually. Glad you got it sorted.

User avatar
Rodeo
HandBrake Team
Posts: 12475
Joined: Tue Mar 03, 2009 8:55 pm

Re: Can I set the color profile in the GUI version of HandBrake?

Post by Rodeo »

BradleyS wrote:
Sun Oct 13, 2019 4:33 pm
Yes, I forgot x264 allows one to set these values manually. Glad you got it sorted.
And we also have special code to grab those if set via advanced options, and make sure we write the same values on the container where applicable (MP4).

Post Reply