Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th June 2017, 17:58   #1  |  Link
danfgtn
Registered User
 
Join Date: Dec 2016
Posts: 9
avisynth 10 bit conversion?

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

Code:
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.
danfgtn is offline   Reply With Quote
Old 27th June 2017, 23:33   #2  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,902
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.

Code:
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?

Last edited by FranceBB; 27th June 2017 at 23:37.
FranceBB is offline   Reply With Quote
Old 28th June 2017, 03:02   #3  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Use AviSynth+ (r2506 is the latest, but this stuff has been around since last August/September), and after telling f3kdb to use output_depth=10 (and output_mode=2),
Code:
ConvertFromDoubleWidth(10)
Also requires that the receiving application has been updated to understand AviSynth+ giving it high bit depth pixel formats. FFmpeg, for example.
qyot27 is offline   Reply With Quote
Old 17th January 2018, 16:23   #4  |  Link
Sachin
Registered User
 
Join Date: Nov 2017
Location: India
Posts: 11
Quote:
Originally Posted by qyot27 View Post
Use AviSynth+ (r2506 is the latest, but this stuff has been around since last August/September), and after telling f3kdb to use output_depth=10 (and output_mode=2),
Code:
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.
Sachin is offline   Reply With Quote
Old 17th January 2018, 16:38   #5  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
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.

avs2pipemod -y4mp "input.avs" | x265 - --y4m --preset medium --crf 22 --output-depth 10 -o "output.265"

Last edited by sneaker_ger; 17th January 2018 at 23:05. Reason: one missing hyphen
sneaker_ger is offline   Reply With Quote
Old 17th January 2018, 16:50   #6  |  Link
Sachin
Registered User
 
Join Date: Nov 2017
Location: India
Posts: 11
Thank you. I will try it
Sachin is offline   Reply With Quote
Old 17th January 2018, 17:29   #7  |  Link
Sachin
Registered User
 
Join Date: Nov 2017
Location: India
Posts: 11
How to use other x265 parameters in the above mentioned command line
Sachin is offline   Reply With Quote
Old 17th January 2018, 23:04   #8  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Just add them anywhere behind "x265".

http://x265.readthedocs.io/en/default/cli.html
sneaker_ger is offline   Reply With Quote
Old 18th January 2018, 17:05   #9  |  Link
Sachin
Registered User
 
Join Date: Nov 2017
Location: India
Posts: 11
Finally I encoded a 10bit video. Thanks for your guidance
Sachin is offline   Reply With Quote
Reply

Tags
10bit, avisynth

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:47.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.