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 > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd August 2016, 13:07   #1  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
Feed x264 with 16bit avs

Hi,
I'm trying to encode an avs+ x64 16bit script using x264-10bit, but I can't get a dithered 10bit encode, but only an interleaved one...

Script
Code:
setmemorymax(4096)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("dss2",3)

dss2("test1.avs_lossless.mp4",preroll=100,pixel_type="YV12")

dither_convert_8_to_16()

dither_out()

Prefetch(4)
CLI
Code:
"%~dp0x264-10bit.exe" --input-depth 16 --input-res 1920x1080 --preset ultrafast --qp 0 -o %1_lossless_10_64.mp4 %1
edit: using avs4x26x and avs+ x86 all seems working fine
Code:
"%~dp0avs4x26x.exe" -L "%~dp0x264-10bit.exe" --qp 0 --preset ultrafast -o %1_lossless_10.mp4 --input-depth 16 %1
__________________
powered by Google Translator

Last edited by Motenai Yoda; 2nd August 2016 at 13:23.
Motenai Yoda is offline   Reply With Quote
Old 16th August 2016, 13:09   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
If all you're doing is loading and encoding, it might be better to use ffmpeg built against 10-bit x264 and cut avisynth out completely.
Also vapoursynth is coming of age and could simplify things (though it has the potential to greatly complicate things too).

Sent from my Che2-L12 using Tapatalk
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 16th August 2016, 18:26   #3  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,416
A) The ability for x264 to fake 16bit input with AviSynth was a hack, contained in a patch and never applied to mainline. That's why it only appears in tMod builds and avs4x26x.

B) Even with AviSynth+ now supporting proper high bit depth output, you weren't doing that. You were outputting interleaved.

C) x264 still can't support proper high bit depth input from AviSynth+ because it has to have its locally-provided avisynth_c.h header and the input module updated to recognize the new pix_fmt constants. And that won't happen if priority is given to continuing to maintain support for AviSynth 2.5. The patch allowing FFmpeg to do so is currently being reviewed (they dropped 2.5 support pretty much as soon as 2.6 was released last year).
qyot27 is offline   Reply With Quote
Old 16th August 2016, 21:14   #4  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Have you tried:
Code:
Dither_quantize (bitdepth=10)
Dither_out ()
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 17th August 2016, 00:57   #5  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
@Mug Funky that was an example to reproduce the issue

@qyot27 *insert a thank you gif here*
you know if it is included into asuna/yuuki mod?

@Sparktank I tried, same result, but getting a 16bit interleaved dithered at 10bit
__________________
powered by Google Translator

Last edited by Motenai Yoda; 17th August 2016 at 01:25.
Motenai Yoda is offline   Reply With Quote
Old 17th August 2016, 01:06   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I am curious, is this the real Mug Funky, or some modern fake.

Mug Funky died decades ago, methinks.

(PS, if you really are the real Mug funky, nice to see you still alive and well).

PPS, what was it that woke you up ?
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 17th August 2016, 01:52   #7  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
Quote:
Originally Posted by StainlessS View Post
I am curious, is this the real Mug Funky, or some modern fake.

Mug Funky died decades ago, methinks.

(PS, if you really are the real Mug funky, nice to see you still alive and well).

PPS, what was it that woke you up ?
Even Sharktooth too was pretty sick IIRC.
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 17th August 2016, 03:49   #8  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,416
Quote:
Originally Posted by Motenai Yoda View Post
@qyot27 *insert a thank you gif here*
you know if it is included into asuna/yuuki mod?
That's x265. x265-yuuki doesn't have a standalone AviSynth input module, scripts are loaded through libavformat if that's been compiled in and the libavformat build had AviSynth support enabled.

Unfortunately, I believe that the LAVF module in general is limited to 8bit or something, because when I tried that with my own builds of AviSynth+, ffmpeg, and x265-yuuki with the right patches in place, it did not want to recognize any >8bit file properly, script or not, -D setting correct or not.

FFmpeg itself will be able to, given the correct libs are used (10-bit libx264, multilib libx265). Once the patch goes through, anyway. It may take a few days for that to propagate out and end up in Zeranoe's builds, though.

Quote:
@Sparktank I tried, same result, but getting a 16bit interleaved dithered at 10bit
Dither_out doesn't output real high bit depth with AviSynth. It only outputs interleaved (maybe stacked too, but I didn't mess with it too much). You have to use ConvertFromDoubleWidth(10) after you've messed with Dither to get AviSynth+ to hand real 10-bit video to the receiving application - provided that application also supports getting those pix_fmts from AviSynth+. Like this:
Code:
setmemorymax(4096)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("dss2",3)

dss2("test1.avs_lossless.mp4",preroll=100,pixel_type="YV12")

dither_convert_8_to_16()

dither_out()

ConvertFromDoubleWidth()

Prefetch(4)
Although that will give you 16bit, not 10bit. Use the bitdepth parameter in Dither_out and bits parameter in ConvertFromDoubleWidth to do 10/12/14 output.

You can also do it the hard way and pipe it end to end:
Code:
ffmpeg -i fake10.avs -vcodec rawvideo -f raw - | ffmpeg -s 1920x1080 -r 24 -pix_fmt yuv420p10le -i - [other encoding options]
Or something like that. I wouldn't worry about it too much when that tactic is about to become obsolete.
qyot27 is offline   Reply With Quote
Old 17th August 2016, 05:52   #9  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Wow, I never realized how much went in (didn't go in) to >8bit.

Well, it's going to be fun over the next while to see how everything turns out.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 17th August 2016, 12:09   #10  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
What about using avs2pipemod to send y4m stream directly to x264? Does it work?
shekh is offline   Reply With Quote
Old 17th August 2016, 14:26   #11  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
DJATOM just updated his Avs2YUV mod to support AviSynth+'s new HBD color formats. It it considered 'unstable' so right now is the perfect time to test and report any bugs. To see what's new, take a look at the changelog.
Reel.Deel is offline   Reply With Quote
Old 17th August 2016, 16:45   #12  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
@qyot27 I was referring to yuuki mod of x264 which should be a fork of the taro's one

@Reel.Deel my goal is to use/pipe avs+ 64bit directly to x264 I'm trying this mod but getting Error: failed to load avisynth.dll
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 17th August 2016, 18:57   #13  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,416
Quote:
Originally Posted by Motenai Yoda View Post
@qyot27 I was referring to yuuki mod of x264 which should be a fork of the taro's one
If it has SAPikachu's avs 16bit patch included, then yeah.

And yes, it looks like it does.
qyot27 is offline   Reply With Quote
Old 18th August 2016, 01:30   #14  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 552
I released Avs2YUV 0.24 BugMaster's mod 5 with support for AviSynth+ high bit-depth pixel formats.
It should be still compatible with AviSynth 2.5x. And if all will be ok (no serious problems detected) than I will add such support to x264 directly.

Last edited by MasterNobody; 18th August 2016 at 21:54. Reason: Updated release version
MasterNobody is offline   Reply With Quote
Old 21st August 2016, 13:18   #15  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Quote:
Originally Posted by Motenai Yoda View Post
@Reel.Deel my goal is to use/pipe avs+ 64bit directly to x264 I'm trying this mod but getting Error: failed to load avisynth.dll
There are 2 builds: for x86 and x64 arch. You should use avs2yuv64.exe for x64 avisynth (:
DJATOM is offline   Reply With Quote
Old 22nd August 2016, 00:05   #16  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
Yep, it's me. Was working outside of video for a while but I'm doing a bit of it these days.
Also as you can see from my avatar, life happened (a couple of times), which limited my ability to spend time on forums.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 22nd August 2016, 15:26   #17  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Quote:
Error: failed to load avisynth.dll
Managed to trigger that bug. Using latest avisynth+ dll solves it. I'll investigate later.
DJATOM is offline   Reply With Quote
Old 23rd August 2016, 02:52   #18  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
Ok tried them
- MasterNobody: I get an horizontal scrolling stuff with unaligned scrolling chroma
- DJATOM now work but I get only a green video, with values only as lsb, and scrolling to the left as MasterNobody's one.

avs+ 64bit version r2172

script:
Code:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("lsmashvideosource",3)
lsmashvideosource("tt1.avs_lossless.mp4")

Dither_convert_8_to_16()

dither_out()
#~ ConvertFromStacked()
ConvertFromDoubleWidth()
Prefetch(threads=4)
batch:
Code:
"%~dp0avs2yuv64.exe" -depth 16 %1 -o - | "%~dp0x264-10bit.exe" --qp 0 --preset ultrafast --input-res 1920x1036 --fps 24000/1001 --input-depth 16 -o %1_lossless.mp4 -
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Old 23rd August 2016, 07:42   #19  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 552
Quote:
Originally Posted by Motenai Yoda View Post
Ok tried them
- MasterNobody: I get an horizontal scrolling stuff with unaligned scrolling chroma
- DJATOM now work but I get only a green video, with values only as lsb, and scrolling to the left as MasterNobody's one.
...
Code:
"%~dp0avs2yuv64.exe" -depth 16 %1 -o - | "%~dp0x264-10bit.exe" --qp 0 --preset ultrafast --input-res 1920x1036 --fps 24000/1001 --input-depth 16 -o %1_lossless.mp4 -
You need to use "-raw" option for avs2yuv with such x264 command line.
Or better you should use "--demuxer y4m" option for x264 than you wouldn't need "--input-res 1920x1036 --fps 24000/1001 --input-depth 16" there as it would get this info from y4m format (which is default in avs2yuv without "-raw" option).
MasterNobody is offline   Reply With Quote
Old 23rd August 2016, 14:59   #20  |  Link
Motenai Yoda
Registered User
 
Motenai Yoda's Avatar
 
Join Date: Jan 2010
Posts: 709
Quote:
Originally Posted by MasterNobody View Post
You need to use "-raw" option for avs2yuv with such x264 command line.
Or better you should use "--demuxer y4m" option for x264 than you wouldn't need "--input-res 1920x1036 --fps 24000/1001 --input-depth 16" there as it would get this info from y4m format (which is default in avs2yuv without "-raw" option).
ok so with --demux y4m or -raw and --demux raw both works well.
__________________
powered by Google Translator
Motenai Yoda is offline   Reply With Quote
Reply

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 05:11.


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