View Full Version : avisynth 10 bit conversion?
danfgtn
16th June 2017, 17:58
How to convert 10 bit inside avisynth and extract it so that it works?
This is my script, but I'm not sure what's wrong, that my videos come out like this.
https://i.imgur.com/rWAoCbg.png
My script
SetMemoryMax(1024)
SetMTMode(mode=3,threads=4)
FFVideoSource("C:\RMZ\RAW\avatar.mkv", threads=1, enable10bithack=false, colorspace="YV12")
SetMTMode(mode=2,threads=4)
Trim(18000, 20000)
TFM(order=-1, field=-1,mode=0,cthresh=8)
TDecimate(mode=1, cycleR=1, cycle=25, rate=24.000, hybrid=0)
AssumeFPS(24)
QTGMC(Preset="Medium", Sharpness=0, InputType=3, SourceMatch=3, FPSDivisor=1, ShowSettings=False, TR0=0, TR1=1, TR2=1, Rep0=0, Rep1=0, Rep2=0, RepChroma=false)
Dither_convert_8_to_16()
dfttest(Y=true, U=false, V=false, ftype=1, sigma=2, sigma2=2, lsb_in=true, lsb=true)
f3kdb(range=30, grainY=64, grainC=64, sample_mode=1, opt=-1, mt=true, input_depth=16, output_depth=16)
#DitherPost(mode=6) #Uncomment this filter to preview.
Dither_quantize(10, reducerange=true, mode=6) #Comment out this filter to preview.
Dither_Out() #Comment out this filter to preview.
FranceBB
27th June 2017, 23:33
First of all, Dither tool is a hack, 'cause 16bit is not officially supported by Avisynth.
Anyway, it works and I've been using it for a while.
You can use f3kdb to dither down to 10bit output, so Dither_quantize and Dither_Out are not needed.
Also, try to avoid using MT Mode, 'cause afaik it doesn't work reliably with Dither Tool.
FFVideoSource("C:\RMZ\RAW\avatar.mkv")
Trim(18000, 20000)
TFM(order=-1, field=-1,mode=0,cthresh=8)
TDecimate(mode=1, cycleR=1, cycle=25, rate=24.000, hybrid=0)
AssumeFPS(24)
QTGMC(Preset="Medium", Sharpness=0, InputType=3, SourceMatch=3, FPSDivisor=1, ShowSettings=False, TR0=0, TR1=1, TR2=1, Rep0=0, Rep1=0, Rep2=0, RepChroma=false)
Dither_convert_8_to_16()
dfttest(sigma=64, tbsize=1, lsb_in=true, lsb=true, Y=true, U=true, V=true, opt=3, dither=0)
f3kdb(range=15, Y=80, Cb=60, Cr=60, grainY=0, grainC=0, keep_tv_range=True, input_depth=16, output_depth=10)
There's another way to use 16bit in avisynth, which is using HDRCore (16bit interleave), while Dither Tool uses 16bit stack.
HDR Core is slightly faster but less supported.
Also please note that if you are using AVS Studio or VirtualDub for preview, you can't view 10/12/16bit footages, but you gotta encode them first.
In order to view if everything is working fine, just use output_depth=8 in f3kdb, check it in VirtualDub, then, if everything is working fine, change it back to 10 and encode with your favorite encoder (x264, x265 etc).
By the way, may I ask you what are you trying to achieve with TFM, Tdecimate, AssumeFPS and QTGMC? Is your source interlaced? Telecined? Both?
qyot27
28th June 2017, 03:02
Use AviSynth+ (r2506 is the latest (https://forum.doom9.org/showthread.php?p=1809045#post1809045), but this stuff has been around since last August/September), and after telling f3kdb to use output_depth=10 (and output_mode=2),
ConvertFromDoubleWidth(10)
Also requires that the receiving application has been updated to understand AviSynth+ giving it high bit depth pixel formats. FFmpeg, for example.
Sachin
17th January 2018, 16:23
Use AviSynth+ (r2506 is the latest (https://forum.doom9.org/showthread.php?p=1809045#post1809045), but this stuff has been around since last August/September), and after telling f3kdb to use output_depth=10 (and output_mode=2),
ConvertFromDoubleWidth(10)
Also requires that the receiving application has been updated to understand AviSynth+ giving it high bit depth pixel formats. FFmpeg, for example.
ffmpeg showed "incompatible pixel format 'yuv420p10le' for codec 'libx265' , autoselecting format 'yuv420p' " response .
my command line
code:
ffmpeg -i "d:\encoding\1.avs" -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -c:a no "d:\encoding\1.mkv"
my script
code:
lsmashvideoSource("D:\Encoding\part1.mp4")
dither_convert_8_to_16()
knlmeanscl(d=4,s=4,a=4,h=0.6)
f3kdb(range=15,y=80,cb=60,cr=60,grainY=0,grainC=0,keep_tv_range=true,input_depth=16,output_depth=10,output_mode=2)
ConvertfromDoubleWidth(10)
ffmpeg-3.4.1-win64-static
AviSynthPlus-r2580
please help, thank you.
sneaker_ger
17th January 2018, 16:38
Your ffmpeg build (zeranoe) probably doesn't support 10 bit encoding. If you can't build yourself you can often find x265cli builds with 10 bit support, e.g. in the x265 thread (https://forum.doom9.org/showthread.php?p=1830615#post1830615).
avs2pipemod -y4mp "input.avs" | x265 - --y4m --preset medium --crf 22 --output-depth 10 -o "output.265"
Sachin
17th January 2018, 16:50
Thank you. I will try it
Sachin
17th January 2018, 17:29
How to use other x265 parameters in the above mentioned command line
sneaker_ger
17th January 2018, 23:04
Just add them anywhere behind "x265".
http://x265.readthedocs.io/en/default/cli.html
Sachin
18th January 2018, 17:05
Finally I encoded a 10bit video. Thanks for your guidance
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.