Selur's Little Message Board
[HELP] How encode 8bit to 10bit correctly? - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [HELP] How encode 8bit to 10bit correctly? (/thread-856.html)



How encode 8bit to 10bit correctly? - redbtn - 24.01.2019

Hello. How encode 8bit Blue-Ray to 10bit correctly?
I open remux.mkv file, choose High10@5.1 profile, set Calculation precision to 10bit. Here is what I got in CLI:

x264 --preset placebo --crf 18.00 --profile high10 --level 5.1 --ref 4 --vbv-maxrate 720000 --vbv-bufsize 720000 --sar 1:1 --range tv --colorprim bt709 --transfer bt709 --colormatrix bt709 --demuxer raw --input-res 1920x1080 --input-csp i420 --input-range tv --input-depth 10 --fps 24000/1001 --output-depth 10 --output "F:\MKV\Hybrid\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400_new.264" -


Avs preview

LoadPlugin("C:\PROGRA~1\Hybrid\32bit\avisynthPlugins\LSMASHSource.dll")
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: F:\MKV\QUANTUM_OF_SOLACE\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv
#  input color sampling YV12
#  input luminance scale tv
LWLibavVideoSource("F:\MKV\QUANTUM_OF_SOLACE\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv",cache=false,stacked=true,format="YUV420P8",repeat=true)
# current resolution: 1920x1080
# filtering
# adjusting bit depth current 8 to target 8
PreFetch(6)
return last


Do I need any conversion 8 to 10 bits in avs? Or is that enough? I ask, because when I chose x265, Avs has changed to:

LoadPlugin("C:\PROGRA~1\Hybrid\32bit\avisynthPlugins\LSMASHSource.dll")
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: F:\MKV\QUANTUM_OF_SOLACE\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv
#  input color sampling YV12
#  input luminance scale tv
LWLibavVideoSource("F:\MKV\QUANTUM_OF_SOLACE\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv",cache=false,stacked=true,format="YUV420P8",repeat=true)
# current resolution: 1920x1080
# filtering
# adjusting bit depth current 8 to target 10
# avisynthPreview 0, avisynthScriptView 1
# convert to 10bit for encoder
ConvertBits(10)
PreFetch(6)
return last

This has ConvertBits(10). But then I chose x264 again and the AVS was the same, with ConvertBits(10).
I am almost newbie in encoding. I'm a little confused.

Thank you! And i apologize for my bad english.


Screens if they needed.

[Image: 6e6e35b06400t.jpg]

[Image: 189e2247e022t.jpg]

[Image: 0ba5c02420d6t.jpg]


RE: How encode 8bit to 10bit correctly? - Selur - 24.01.2019

a. I would recommend using Vapoursynth
b. it's a bug, but no worries Hybrid will use ffmpeg to convert the output depth to 10bit.
-> will look into it
Easy workaround: switch to another encoder and back to x264. Smile

Cu Selur


RE: How encode 8bit to 10bit correctly? - redbtn - 24.01.2019

So i set profile and calculation precision to 10bit

--profile high10 --level 5.1 --input-depth 10 --output-depth 10

And Hybrid will use ffmpeg to convert the output depth to 10bit, It doesn't matter whether ConvertBits(10) is set or not, right?
But it is better that it was?

Or I switch to Vapoursynth and do not worry, everything will work correctly?

This is VS i got:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\MKV\QUANTUM_OF_SOLACE\QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/MKV/QUANTUM_OF_SOLACE/QUANTUM_OF_SOLACE-2008-REMUX-003200-003400.mkv", format="YUV420P8", cache=0)
# making sure input color matrix is set as 709
clip = core.resize.Point(clip, matrix_in_s="709",range_s="limited")
# making sure frame rate is set to 24000/1001
clip = core.std.AssumeFPS(clip, fpsnum=24000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# cropping the video to 1920x800
clip = core.std.CropRel(clip=clip, left=0, right=0, top=140, bottom=140)
# Output
clip.set_output()

Selur, Thanks for the answers and for the Hybrid!


RE: How encode 8bit to 10bit correctly? - Selur - 24.01.2019

Quote: It doesn't matter whether ConvertBits(10) is set or not, right?
right
Quote:But it is better that it was?
Nope, should be the same.

Quote:Or I switch to Vapoursynth and do not worry, everything will work correctly?
Vapoursynth usually scales better with more cores, but uses more RAM, also I think it's more straight forward when dealing with high bit depth.
(+ Hybrid uses a 64bit version of Vapoursynth, but only a 32bit version of Avisynth)
Only reason to using Avisynth for me is when I use some old filters which are not available in Vapoursynth.

Cu Selur

Ps.: I send you a link to a dev version which should adjust the Avisynth script 'properly'.


RE: How encode 8bit to 10bit correctly? - redbtn - 24.01.2019

Thank you very much! With dev version everything works right!
I use Avisynth because I find it easier to understand it because of its simpler syntax. I do not use any filters, only crop and resize. Now I started using Hybrid and it does everything automatically.
The last question is where can I find x264 log file?


RE: How encode 8bit to 10bit correctly? - Selur - 24.01.2019

Quote:The last question is where can I find x264 log file?
my guess the report file (Config->Internals->Create report file) should contain what you are looking for

Cu Selur


RE: How encode 8bit to 10bit correctly? - redbtn - 24.01.2019

Thx, exactly what i need!
I attached gif file, probably a bug?


RE: How encode 8bit to 10bit correctly? - redbtn - 25.01.2019

Can I ask you something else? I think I'm doing something wrong, or somewhere in my settings was wrong. I switch to Vapoursynth. In my x264 CLI i see --demuxer raw, but in job log i see --demuxer y4m
i go to VS documentation and find example.

vspipe --y4m script.vpy - | x264 --demuxer y4m - --output encoded.mkv

So in job log all right, but why in my CLI --demuxer raw? I don’t understand how it should be, so I’m afraid to make a mistake. Thx!

[Image: 717d526c2393t.jpg]      [Image: 4cb9bd728d40t.jpg]


--------------------------
PS: In VS script i find

# adjusting output color from: YUV420P8 to YUV420P10 for x264Model (i420)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")

In Filtering>Vapoursynth>Misc i find Color Resizer. I can change it to Lanczos, Spline etc. Which one will be the best?


RE: How encode 8bit to 10bit correctly? - Selur - 25.01.2019

a. No, bug. Everything is as it should be.
b. x264 cli preview always shows --demuxer raw, since it doesn't know what will feed it (ffmpeg, mencoder, avs2yuv,...), during Job creation the decoder which feeds the encoder is choosen as needed and the demuxer ist adjusted accordingly.
c. Couldn't find anything case which resulted in netter results than bicubic.

In general: If you don't know an option keep it at the value Hybrid chooses.

Cu Selur