10 bit and 12 bit encodes result in 8 bit on nightlies

Discussion of the HandBrake command line interface (CLI)
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
FallenSnow
Posts: 17
Joined: Thu Apr 02, 2015 6:49 pm

10 bit and 12 bit encodes result in 8 bit on nightlies

Post by FallenSnow »

When I use main10 and main12 profiles I still get 8 bit depth. In the past main10 used to result in 10 bit depth. Below is the relevant portion showing I am inputting the correct settings.

Code: Select all

[18:55:54] Auto Passthru: fallback is AC3
[18:55:54] Auto Passthru: using AC3 Passthru for track 1
[18:55:54] job configuration:
[18:55:54]  * source
[18:55:54]    + video.mkv
[18:55:54]    + title 1, chapter(s) 1 to 1
[18:55:54]    + container: matroska,webm
[18:55:54]  * destination
[18:55:54]    + /tmp/encoding-in-process-9166.mkv
[18:55:54]    + container: Matroska (libavformat)
[18:55:54]  * video track
[18:55:54]    + decoder: h264
[18:55:54]    + filters
[18:55:54]      + Framerate Shaper (mode=0)
[18:55:54]        + frame rate: same as source (around 23.976 fps)
[18:55:54]      + Crop and Scale (width=1280:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[18:55:54]        + source: 1280 * 720, crop (0/0/0/0): 1280 * 720, scale: 1280 * 720
[18:55:54]    + Output geometry
[18:55:54]      + storage dimensions: 1280 x 720
[18:55:54]      + pixel aspect ratio: 1 : 1
[18:55:54]      + display dimensions: 1280 x 720
[18:55:54]    + encoder: H.265 (libx265)
[18:55:54]      + preset:  fast
[18:55:54]      + options: aq-mode=3:aq-strength=1.8:b-adapt=1:bframes=6:qcomp=0.5:rdoq-level=1
[18:55:54]      + profile: main12
[18:55:54]      + quality: 25.00 (RF)
[18:55:54]  * audio track 1
[18:55:54]    + decoder: Unknown (AC3) (5.1 ch) (track 1, id 0x1)
[18:55:54]      + bitrate: 384 kbps, samplerate: 48000 Hz
[18:55:54]    + AC3 Passthru
[18:55:54] sync: expecting 85533 video frames
x265 [info]: HEVC encoder version 1.9
x265 [info]: build info [Linux][GCC 5.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
x265 [info]: Main profile, Level-3.1 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: frame threads / pool features       : 3 / wpp(12 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut       : 24 / 240 / 40
x265 [info]: Lookahead / bframes / badapt        : 15 / 6 / 1
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / 1 / 1
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 3 / 1.8 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-25.0 / 0.50
x265 [info]: tools: rd=2 psy-rd=2.00 rdoq=1 signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=4 deblock sao
results in an 8 bit encode, mediainfo of the file:

Code: Select all

# mediainfo encoding-in-process-9166.mkv
General
Unique ID                                : 92857235646632860945565396036417832165 (0x45DBA72F7F129B55FE59BB3185BD44E5)
Complete name                            : encoding-in-process-9166.mkv
Format                                   : Matroska
Format version                           : Version 2
File size                                : 5.79 MiB
Encoded date                             : UTC 2016-03-14T01:55:54Z
Writing application                      : HandBrake 20160314002439-20b5485-master 2016031301
Writing library                          : Lavf56.1.0 / Lavf56.1.0
IsTruncated                              : Yes

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L3.1@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Writing library                          : x265 1.9:[Linux][GCC 5.3.0][64 bit] 8bit+10bit+12bit
Encoding settings                        : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=1 / subme=2 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=240 / min-keyint=24 / scenecut=40 / rc-lookahead=15 / lookahead-slices=4 / bframes=6 / bframe-bias=0 / b-adapt=1 / ref=3 / limit-refs=3 / no-limit-modes / weightp / no-weightb / aq-mode=3 / qg-size=32 / aq-strength=1.80 / cbqpoffs=0 / crqpoffs=0 / rd=2 / psy-rd=2.00 / rdoq-level=1 / psy-rdoq=0.00 / signhide / deblock / sao / no-sao-non-deblock / b-pyramid / cutree / no-intra-refresh / rc=crf / crf=25.0 / qcomp=0.50 / qpmin=0 / qpmax=51 / qpstep=4 / ipratio=1.40 / pbratio=1.30
FallenSnow
Posts: 17
Joined: Thu Apr 02, 2015 6:49 pm

Re: 10 bit and 12 bit encodes result in 8 bit on nightlies

Post by FallenSnow »

I just compiled the latest git with x265 1.7 and it works as expected. Then I again recompiled it with x265 1.9 and it doesn't work.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5727
Joined: Sat Feb 09, 2008 7:21 pm

Re: 10 bit and 12 bit encodes result in 8 bit on nightlies

Post by JohnAStebbins »

First, since you didn't supply a complete log, we have no idea what version of handbrake you are using, which matters. In fact, we need to know the handbrake version for 99.999% of support requests which is one of the many reasons we harp on people to supply the damn activity log.

Second, using the main10 and main12 profiles does not automatically mean you are using the 10 and 12 bit encoders. You need to explicitly select the 10 or 12 bit encoder from the encoder list. From the command line, this would be "-e x265_10bit" and "-e x265_12bit". Then the main10 and main12 profiles are valid options. It's possible you supplied the correct encoder option and it fell back to the 8bit encoder due to the 10 and 12 bit encoders being unavailable. There's no way for me to tell from your log fragment.

If you supplied all the correct command line options, then there is a problem with the x265 10 and 12 bit shared objects you are using. The version of the x265 shared libs you use must match the version of the 8biit libx265 that is statically linked in to HandBrake. Since you didn't supply a complete log, I can't tell you which version you need.

In addition, the x265 shared libs must be build with the C API exported. This requires a special option when configuring the x265 build with cmake. Here is the script I use to build these libraries on linux.

Code: Select all

#!/bin/sh

mkdir -p 10bit 12bit

cd 12bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=ON -DENABLE_SHARED=ON -DENABLE_CLI=OFF -DMAIN12=ON
make -j8 ${MAKEFLAGS}

cd ../10bit
cmake ../../../source -DHIGH_BIT_DEPTH=ON -DEXPORT_C_API=ON -DENABLE_SHARED=ON -DENABLE_CLI=OFF
make -j8 ${MAKEFLAGS}

cd ..
ln -sf 10bit/libx265.so libx265_main10.so
ln -sf 12bit/libx265.so libx265_main12.so
FallenSnow
Posts: 17
Joined: Thu Apr 02, 2015 6:49 pm

Re: 10 bit and 12 bit encodes result in 8 bit on nightlies

Post by FallenSnow »

Ah, thank you. I didn't know -e x265_10bit was an option. I am using a clone of the git repository at https://github.com/HandBrake/HandBrake. I'm building multiple versions of handbrake each with different x265 versions, but I think I will start using linked libraries now. I'm going to try and see if I can figure it out now, thank you.
FallenSnow
Posts: 17
Joined: Thu Apr 02, 2015 6:49 pm

Re: 10 bit and 12 bit encodes result in 8 bit on nightlies

Post by FallenSnow »

Success! Thank you, thank you, thank you! And with linked libraries too.
Post Reply