Log in

View Full Version : Feeding AVIsynth+ 10-bit output to x264 (10-bit)


Stereodude
30th April 2018, 20:45
How do I get 10-bit AVIsynth+ output into x264 10-bit for a 10-bit encode? I know my script outputs YUV420P10.

Here's what I get with my attempt to just feed the .avs to it.
x264.2851.10bit.x64.exe --crf 18.0 --preset placebo --tune film --aq-strength 1.2 --vbv-maxrate 50000 --vbv-bufsize 62500 --level 4.1 --keyint 120 --open-gop --threads 20 --lookahead-threads 2 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 -o test_10b.264 test.avs
avs [error]: not supported pixel type: YUV420P10
x264 [error]: could not open input file `test.avs'

Do I need to pipe it in with avs2pipemod64 v1.1.1? If so, what does that look like?

Here's what I'm using for x265: (it works)
avs2pipemod64.exe -y4mp "test.avs" | "C:\HDTV Tools\x265\x265-10b8b-PGO.exe" --crf 18.0 -p veryslow --vbv-maxrate 50000 --vbv-bufsize 62500 --level 4.1 --keyint 120 --open-gop -D 10 --colorprim "bt709" --transfer "bt709" --colormatrix "bt709" --sar 1:1 -o test_g1.0_18_10b.265 --input - --y4m

Also, what happened to the 10-bit versions of x264? The last I see are Komisar's builds of 2851 which are not the latest version (2901).

DJATOM
30th April 2018, 20:50
Well, you can try my build, it should work with 10/12/14 bits input: http://www.mediafire.com/file/re0n18m4l35kxa1/x264-aMod-x64-2851.exe

Stereodude
30th April 2018, 20:53
Well, you can try my build, it should work with 10/12/14 bits input: http://www.mediafire.com/file/re0n18m4l35kxa1/x264-aMod-x64-2851.exe
How does your build differ from the generic Komisar clear 10-bit build? Also, what happened to 10-bit builds after 2851?

DJATOM
30th April 2018, 21:53
How does your build differ from the generic Komisar clear 10-bit build? Also, what happened to 10-bit builds after 2851?

My build is 2851 codebase (I'm too lazy to update, but will switch to new soon) + certain patches: x264_logger.v7.2377.diff, x264_est_size.2358.diff (that's the same as Komisar), and my own modifications: avs patch for 10-14 bits support, y4m patch for XLENGTH support (vspipe output this; you don't need to specify --frames option, x264 will know how many frames it need to encode from y4m header), vpy support (you can feed VapourSynth scripts directly onto encoder, no need in vspipe).
It also built with l-smash (mp4 output) and lavf (for swscale support).

sneaker_ger
30th April 2018, 21:57
You can pipe similar to x265:
avs2pipemod -y4mp "script.avs" | x264 - --demuxer y4m --output-depth 10 -o "output.264"
The official x264 builds (from videolan server) have become multi-bitdepth. That's why you can't find special 10 bit builds anymore on videolan server. Activate 10 bit output via --output-depth 10. (I don't know why komisar isn't maintaining at the moment. One reason could be that the multi-depth changes have broken a lot of custom mods.)

https://download.videolan.org/x264/binaries/

Stereodude
30th April 2018, 22:03
The official x264 builds (from videolan) have become multi-bitdepth. That's why you can't find special 10 bit builds anymore on videolan server. Activate 10 bit output via --output-depth 10.
Thanks! I didn't realize that option was added to the videolan builds. It's not listed in the x264 command line options wiki @ chaneru.com

Edit: I had a mistake in my script. This doesn't seem to work.

Edit2: It seems I misunderstood you. I still have to pipe right? Because otherwise I still get the "avs [error]: not supported pixel type: YUV420P10" error.

Ma
30th April 2018, 22:09
x264 could work exactly like x265 via pipe, instead of options (in x265)
--input - --y4m
please use (in x264)
--demuxer y4m -

For new version of x264 and 10-bit encoding please add
--output-depth 10

Stereodude
30th April 2018, 22:30
x264 could work exactly like x265 via pipe, instead of options (in x265)
--input - --y4m
please use (in x264)
--demuxer y4m -

For new version of x264 and 10-bit encoding please add
--output-depth 10
Okay, I didn't realize I still had to pipe even with the new versions of x264. I though you guys were saying it would accept the 10-bit YUV420P10 AVS+ output directly.

Using avs2pipemod64 plus --output-depth 10 with the new x264 builds indeed works.

sneaker_ger
30th April 2018, 22:40
I though you guys were saying it would accept the 10-bit YUV420P10 AVS+ output directly.
From what DJATOM said his builds can. The vanilla builds don't accept 10 bit avs+ (but they accept 16 bit).

Stereodude
1st May 2018, 05:10
Thanks for the help guys. Now I have another puzzle to solve now that I've been able to compress my source to 10 bits with both x264 and x265...

Both have quite obvious banding in subtle smooth gradients in a very low noise source when played back through a full 10-bit playback chain (Win8.1 using MPC-HC w/ LAV + MadVR with 10-bit exclusive + 12bit Nvidia output) that the raw YUV420P10 10-bit source doesn't have. Stranger yet, when the 10-bit encoded files are played back through an 8-bit playback chain, with madVR set to only output 8-bits, they look fine with no obvious banding. :confused:

A lossless CRF 0 x264 10-bit encode doesn't have the banding either, so I know it's not the decoder. Presumably I need to tune my x264/x265 settings, but I guess that's for another thread.

jpsdr
1st May 2018, 08:08
(I don't know why komisar isn't maintaining at the moment. One reason could be that the multi-depth changes have broken a lot of custom mods.)

Yes, it has. This is why on my releases i've skipped the multi-detph commit...

sneaker_ger
1st May 2018, 10:28
lossless CRF 0 x264 10-bit
x264 10 bit --crf 0 isn't lossless, --qp 0 is.

Stereodude
1st May 2018, 12:06
x264 10 bit --crf 0 isn't lossless, --qp 0 is.
Oh, I'm learning all sorts of new things in this thread.