Log in

View Full Version : x265 HEVC Encoder


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [25] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197

a5180007
17th August 2014, 13:57
To my understanding, the range for these options will remain 0.0 to 2.0.

As stated above (post #1196), rdoq range has been changed to 0.0..10.0 so that 1.0 is the recommended value.


EDIT : also, psy-rd/psy-rdoq are not written to the SEI:

x265 --rd 4 --psy-rd 1.0 --psy-rdoq 1.0 park_joy_1080p50.y4m -o park_joy.hevc

x265 (build 31) - 1.2+555-866f21378d94:[Windows][MSVC 1800][32 bit] 8bpp - H.265/HEVC codec - Copyright 2013-2014 (c) Multicoreware
Inc - http://x265.org - options: 1920x1080 fps=50/1 bitdepth=8 wpp ctu=64 tu-intra-depth=1 tu-inter-depth=1 me=1 subme=2 merange=57
no-rect no-amp max-merge=2 no-early-skip no-fast-cbf rdpenalty=0 no-tskip no-tskip-fast strong-intra-smoothing no-lossless
no-cu-lossless no-constrained-intra no-fast-intra open-gop interlace=0 keyint=250 min-keyint=25 scenecut=40 rc-lookahead=20 bframes=4
bframe-bias=0 b-adapt=2 ref=3 weightp no-weightb aq-mode=2 aq-strength=1.00 cbqpoffs=0 crqpoffs=0 rd=4 signhide lft sao
sao-lcu-bounds=0 sao-lcu-opt=1 b-pyramid cutree rc=crf crf=28.0 qcomp=0.60 qpmin=0 qpmax=51 qpstep=4 ipratio=1.40 pbratio=1.30


Otherwise, much less ugly artefacts in 32 and 64 CTUs!

x265_Project
17th August 2014, 18:34
As stated above (post #1196), rdoq range has been changed to 0.0..10.0 so that 1.0 is the recommended value.

EDIT : also, psy-rd/psy-rdoq are not written to the SEI:

Thanks for the feedback. We'll take care of this.

LigH
18th August 2014, 10:06
Because it is "stable" now, x265 1.2+557-87400d5c90aa (https://www.mediafire.com/download/8nkrfp1prg6x4l0/x265_1.2+557-87400d5c90aa.7z).

Blue_MiSfit
18th August 2014, 23:22
I'm using the build that LigH just posted above ^^ 1.2+557-87400d5c90aa - the 8 bit variety on x64.

I thought I'd do some PSNR and speed tests just for fun, and got some odd behavior. See how it's warning be about setting --tune psnr even though I already have it set?


G:\>x265.exe --input parkjoy.y4m --preset medium --tune psnr --psnr --bitrate 80
00 --vbv-maxrate 8000 --vbv-bufsize 8000 --output parkjoy_x265_8000_medium.h265

y4m [info]: 1920x1080 fps 50/1 i420p8 sar 1:1 frames 0 - 207 of 208
x265 [info]: HEVC encoder version 1.2+557-87400d5c90aa
x265 [info]: build info [Windows][GCC 4.8.2][64 bit] 8bpp
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x265 [info]: WPP streams / pool / frames : 17 / 8 / 3
x265 [warning]: --psnr used with AQ on: results will be invalid!
x265 [warning]: --tune psnr should be used if attempting to benchmark psnr!
x265 [info]: Main profile, Level-4.1 (Main tier)
x265 [info]: CU size : 64
x265 [info]: Max RQT depth inter / intra : 1 / 1
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut : 25 / 250 / 40
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb / refs: 1 / 1 / 0 / 3
x265 [info]: Rate Control / AQ-Strength / CUTree : ABR-8000 kbps / 0.0 / 1
x265 [info]: VBV/HRD buffer / max-rate / init : 8000 / 8000 / 0.900
x265 [info]: tools: rd=3 lft sao-lcu signhide

x265 [info]: frame I: 1, Avg QP:36.74 kb/s: 32723.60 PSNR Mean: Y:32.379
U:35.246 V:37.691
x265 [info]: frame P: 52, Avg QP:36.80 kb/s: 26042.37 PSNR Mean: Y:28.665
U:31.432 V:35.047
x265 [info]: frame B: 155, Avg QP:41.61 kb/s: 2187.03 PSNR Mean: Y:27.569
U:31.301 V:35.014
x265 [info]: global : 208, Avg QP:40.39 kb/s: 8297.68 PSNR Mean: Y:27.866
U:31.353 V:35.035
x265 [info]: Weighted P-Frames: Y:1.9% UV:1.9%
x265 [info]: consecutive B-frames: 1.9% 0.0% 1.9% 96.2% 0.0%

encoded 208 frames in 26.58s (7.82 fps), 8297.68 kb/s, Global PSNR: 29.198

x265_Project
19th August 2014, 03:13
I'm using the build that LigH just posted above ^^ 1.2+557-87400d5c90aa - the 8 bit variety on x64.

I thought I'd do some PSNR and speed tests just for fun, and got some odd behavior. See how it's warning be about setting --tune psnr even though I already have it set?

Good point. I'll have the team take a look at this.

Should be fixed with this patch... https://bitbucket.org/multicoreware/x265/commits/dca792ce978649a729fa903dea34de996742d5e8

Blue_MiSfit
20th August 2014, 06:57
Hooray I contributed :D

LigH
20th August 2014, 11:50
Because many stable and much fixes, wow ;) - x265 1.2+575-80129b1b6260 (https://www.mediafire.com/download/2wmz006fy6c8g42/x265_1.2+575-80129b1b6260.7z)

benwaggoner
21st August 2014, 20:55
@x265_Project, before 1.3 tagging, it would be better to change the --help (1.2+555-866f213 below) :

--psy-rd <0..2.0> Strength of psycho-visual rate distortion optimization, 0 to disable. Default 0.000000
--psy-rdoq <0..2.0> Strength of psycho-visual optimization in quantization, 0 to disable. Default 0.000000
Does this mean that --psy-rd has been refactored so that 1.0 should be the "default" now, not ~0.3 as before?

benwaggoner
21st August 2014, 21:04
And a couple of other questions about settings and presets

--rdpenalty defaults to 0, although by the description I'd think 1 (RD-penalty) would be prefereable. Is there a downside or risk to using 1? And what the heck is 2 for?
--weightb is off by default everywhere. Does using it have any risks or downsides?

x265_Project
21st August 2014, 21:32
Does this mean that --psy-rd has been refactored so that 1.0 should be the "default" now, not ~0.3 as before?

Yes it does.

lotusgg
22nd August 2014, 03:31
Can someone compile and upload 1.3 stable for me?
For some reason, I just can't get it to work on my encoding ded.

H3
22nd August 2014, 04:34
Can someone compile and upload 1.3 stable for me?
For some reason, I just can't get it to work on my encoding ded.

I hope this helps you:

http://builds.x265.eu/

filler56789
22nd August 2014, 04:44
I hope this helps you:

http://builds.x265.eu/

Hmmm, according to Windows Explorer, their latest build is version 1.2+580-9461fc801cd2.

Version 1.2.581 (8bpp, both 32-bits and 64-bits) @ http://forum.videohelp.com/threads/357754-%5BHEVC%5D-x265-EXE-mingw-builds?p=2341579#post2341579

LigH
22nd August 2014, 07:02
I'm going to build it, but the stable merge (1.3+2-2e17cb106b17) seems to have a lot of warnings regarding signed/unsigned comparisons etc., will probably prefer the latest development revision for publishing.
__

x26+1.3+18-bad70432b1d3 (http://www.mediafire.com/download/byqszmfpmyptlej/x265_1.3_18-bad70432b1d3.7z)

x265_Project
22nd August 2014, 07:22
We are pleased to announce that we have reached version 1.3.

The primary changes in this release are the completion and tuning of the psycho-visual optimizations and new support for multiple pass encoding.

--psy-rd and --psy-rdoq are now completed and scaled such that their recommended initial values are 1.0.

Multipass encodes are now possible with --pass N and --stats FNAME

As usual, full documentation is at: http://x265.readthedocs.org/en/1.3/

= API Changes =

* param.bEmitInfoSEI, --[no-]info
include an SEI identifying the encoder and encoding options.

* param.bHighTier --high-tier
specify tier (used in conjunction with --level-idc)

* param.bEnableFastIntra --[no-]fast-intra
Use a gradient descent to scan angular intra modes

* param.totalFrames
optional indicator of total frame count, may improve rate control

* param.scalingLists
specify custom quantization matrices, "default" or filename

* param.psyRdoq
Psycho-visual optimizations for quantization

* param.bEnableSlowFirstPass
The first pass of multi-pass encodes will run in *turbo* mode unless this option is enabled.

a5180007
22nd August 2014, 16:16
Nice improvements with this version !
Although the 2-pass is not a "pure CRF" yet. And there is a fair difference in first frames and I-frames sizes and ssim :

File http://www.diktafon.atw.hu/112.MTS
x265 1.3+18 crf28 (48,756 KB) vs --bitrate 6764 --pass 2 (48,738 KB)
http://i.imgur.com/fCzziJW.png

http://i.imgur.com/48tFEYC.png

benwaggoner
22nd August 2014, 18:15
Yes it does.
Anything you can share about --rdpenalty and --weightb?

x265_Project
22nd August 2014, 18:22
Anything you can share about --rdpenalty and --weightb?

These algorithms are in the same class... the code is in place, but we haven't spent much time on these functions as we had bigger fish to fry (RDOQ and psy-rdoq, etc.). We'll be turning our attention to these functions, but until we have had a chance to really evaluate how they are working in conjunction with the other changes we recently implemented, we can't recommend using them.

NikosD
23rd August 2014, 11:46
Is there somewhere documented which parts of the code (functions ?) are optimised for AVX2 and which is the speed-up of these specific optimisations ?

Are there any functions using floating point numbers ?

Thanks!

x265_Project
24th August 2014, 02:34
Is there somewhere documented which parts of the code (functions ?) are optimised for AVX2 and which is the speed-up of these specific optimisations ?
Thanks!
denoise_dct
pixel_avg
frame_init_lowres_core
mbtree_propagate_cost
cvt32to16_shl
cvt16to32_cnt
pixel_satd
pixel_var
pixel_sad
pixel_ssd

You can turn off AVX2 or any other specific assembly code optimization using --asm (http://x265.readthedocs.org/en/default/cli.html#cmdoption--asm) to test the performance difference.

benwaggoner
24th August 2014, 02:41
denoise_dct
pixel_avg
frame_init_lowres_core
mbtree_propagate_cost
cvt32to16_shl
cvt16to32_cnt
pixel_satd
pixel_var
pixel_sad
pixel_ssd

You can turn off AVX2 or any other specific assembly code optimization using --asm (http://x265.readthedocs.org/en/default/cli.html#cmdoption--asm) to test the performance difference.
Any data for how much AVX2 speeds up those functions, or x265 overall?

It is pretty annoying that we still don't have a multi-socket AVX2 processor available. Just single-socket consumer-focused Haswell.

nevcairiel
24th August 2014, 08:46
It is pretty annoying that we still don't have a multi-socket AVX2 processor available. Just single-socket consumer-focused Haswell.

Soon.

x265_Project
24th August 2014, 21:29
Any data for how much AVX2 speeds up those functions, or x265 overall?

It is pretty annoying that we still don't have a multi-socket AVX2 processor available. Just single-socket consumer-focused Haswell.
Ben,
I don't have this data handy. We've been accelerating x265 in every way possible for months, and AVX2 assembly code optimizations are just one of areas that we have improved performance. Since performance has been improving in so many other areas someone would have to turn off AVX2 and run tests with the latest code on an AVX2 compatible machine.

As nevcairiel noted... it won't be long until Xeon E5 v3 processors (http://www.cpu-world.com/news_2014/2014080502_Xeon_E5-2600_v3_CPUs_are_available_for_pre-order.html) are available.

Atak_Snajpera
26th August 2014, 21:23
any plans on adding working tune presets like film,grain,anime and so on?

x265_Project
26th August 2014, 23:13
any plans on adding working tune presets like film,grain,anime and so on?
Yes, for sure. This had to wait until the psycho-visual optimizations were ready, but now we can figure out what works best for each type of content, and add these to --tune presets. We have some ideas, but it takes a lot of experimentation and testing to really determine the optimal adjustments. As an open source project, we would love to crowd-source some of this effort. So, I'm calling to all our friends on Doom9 for suggestions. If you are an Anime enthusiast, for instance, can you tell us what settings you have tried, and what adjustments seem to work best for you? We can get separate threads going for each tuning, if you like, and of course, we will contribute our expertise and our results.

Tom

Romario
27th August 2014, 01:19
So, x265_project, is 2-pass work without problems now ? Or not ?

What is more neccesary to development, 2-pass to improve ?

x265_Project
27th August 2014, 01:33
So, x265_project, is 2-pass work without problems now ? Or not ?

What is more neccesary to development, 2-pass to improve ?
2 pass is working great for me and my colleagues, and we've used it to create thousands of encoded streams. Let us know if you have any issues.

Romario
27th August 2014, 02:09
2 pass is working great for me and my colleagues, and we've used it to create thousands of encoded streams. Let us know if you have any issues.

Thanks.

Can you tell me reccomended settings for 2-pass mode ? But without fast first pass.

Thanks in advance.

x265_Project
27th August 2014, 04:21
Thanks.

Can you tell me reccomended settings for 2-pass mode ? But without fast first pass.

Thanks in advance.
OK. Variables that you supply are shown in capital letters...

x265 --input SOURCEFILE --input-res RES --fps FPS --bitrate BITRATE -p PRESET --pass 1 --slow-firstpass --stats STATSFILE.LOG OUTPUT1.hevc

x265 --input SOURCEFILE --input-res RES --fps FPS --bitrate BITRATE -p PRESET --pass 2 --stats STATSFILE.LOG OUTPUT2.hevc


So, for example...
x265 --input test.yuv --input-res 1920x1080 --fps 30 --bitrate 5000 -p slow --pass 1 --slow-firstpass --stats test_stats.log test-firstpass.hevc

x265 --input test.yuv --input-res 1920x1080 --fps 30 --bitrate 5000 -p slow --pass 2 --stats test_stats.log test.hevc

LigH
27th August 2014, 13:11
Another merge after a few refactors and fixes (e.g. more VBV precision in fast presets): x265 1.3+36-77fe0cc583e8 (https://www.mediafire.com/download/ium7wlb3ec9y6oa/x265_1.3+36-77fe0cc583e8.7z)

Romario
27th August 2014, 16:21
OK. Variables that you supply are shown in capital letters...

x265 --input SOURCEFILE --input-res RES --fps FPS --bitrate BITRATE -p PRESET --pass 1 --slow-firstpass --stats STATSFILE.LOG OUTPUT1.hevc

x265 --input SOURCEFILE --input-res RES --fps FPS --bitrate BITRATE -p PRESET --pass 2 --stats STATSFILE.LOG OUTPUT2.hevc


So, for example...
x265 --input test.yuv --input-res 1920x1080 --fps 30 --bitrate 5000 -p slow --pass 1 --slow-firstpass --stats test_stats.log test-firstpass.hevc

x265 --input test.yuv --input-res 1920x1080 --fps 30 --bitrate 5000 -p slow --pass 2 --stats test_stats.log test.hevc


Ok, thanks.

For me is little complicated to use *.yuv source files...This is not good for regular user like me...

Can I use MPEG2 source files or uncompressed AVI files as source ? And to write MKV or MP4 output ? When not, can you tell me with what encoding program can I use this settings.

LigH
27th August 2014, 19:56
Use avs4x265, to load other sources via AviSynth.

lotusgg
27th August 2014, 21:24
I'm trying to encode anime with avs4x265 with 2pass, but its insta-crashing on me.
http://prntscr.com/4h3aq7
Edit:
CLI I'm using:
avs4x265.exe --bitrate 1000 --pass 2 --preset medium --weightb --bframes 16 --rc-lookahead 40 --merange 57 --no-open-gop --min-keyint 25 --ipratio 1.0 --pbratio 1.0 --rd 4 --psy-rd 0.70 --psy-rdoq 0.70 --ctu 64 --aq-strength 0.5 --output akame_08_mbs.hevc --stats test_stats.log avs_x265.avs

avs_x265 is just a generic avs I use to edit for inputing a .mkv file.

x265_Project
27th August 2014, 22:54
I'm trying to encode anime with avs4x265 with 2pass, but its insta-crashing on me.
http://prntscr.com/4h3aq7
Edit:
CLI I'm using:
avs4x265.exe --bitrate 1000 --pass 2 --preset medium --weightb --bframes 16 --rc-lookahead 40 --merange 57 --no-open-gop --min-keyint 25 --ipratio 1.0 --pbratio 1.0 --rd 4 --psy-rd 0.70 --psy-rdoq 0.70 --ctu 64 --aq-strength 0.5 --output akame_08_mbs.hevc --stats test_stats.log avs_x265.avs

avs_x265 is just a generic avs I use to edit for inputing a .mkv file.
You have to create your stats file with a 1st encoding pass. Use the same command line syntax with --pass 1 to generate the stats file, then run --pass 2.

LigH
28th August 2014, 10:11
The universal raw video stream provider for x265, x264 and x262 (sic!) by 06_taro is now called avs4x26x (http://forum.doom9.org/showthread.php?t=162656) from version 0.10.0 on.

Support for a 64-bit version of AviSynth(+) was added.

aegisofrime
28th August 2014, 12:11
Hi x265 project...

I having two different encoding jobs running on two different PCs (one 4770 with 16GB of RAM, the other a 4500U with 8GB RAM) with two different sources. (Both DVDs to QTGMC though)

The error for the two crashes are as follows:


Crash on 4770 machine:
av2y [info]: error: wrote only 516806 of 518400 bytes
Crash on 4500U Machine:
av2y [info]: error: wrote only 516501 of 518400 bytes


The 4500U machine was running 1.3+36-77fe0cc583e8, while the 4770 was running 1.2+575-80129b1b6260

I'm running the encode with Mulder's Simple x264/265 launcher if that matters. Any idea how I could help to resolve this? Thanks! Let me know if you need more information.

lotusgg
28th August 2014, 14:16
You have to create your stats file with a 1st encoding pass. Use the same command line syntax with --pass 1 to generate the stats file, then run --pass 2.

Can I do it with in the same .bat file?

LigH
28th August 2014, 14:19
Yes, certainly.

lotusgg
28th August 2014, 14:32
Well, it worked.
But I have a question...
Is rd and rdoq good for anime? I'm using it without even knowing if its beneficial or otherwise. :p
And what can I do to prevent banding?

LigH
28th August 2014, 14:41
I wish I had good lossless cartoon/anime material to test on; but from what I saw in the "varun" samples with a very plain but tinted background (e.g. "Kristen and Sara"), PsyRD and PsyRDOQ may not be useful for such material in any arbitrary combination of values. I fear it may provoke structures from small detail areas to be transferred to slightly noisy areas, adding "moving wall" artefacts to supposedly flat color ramps, especially with higher PsyRD values. I guess it is more useful in real life footage where everything has a bit structure.

But you may have to test on your own to be certain.

lotusgg
28th August 2014, 15:08
I wish I had good lossless cartoon/anime material to test on; but from what I saw in the "varun" samples with a very plain but tinted background (e.g. "Kristen and Sara"), PsyRD and PsyRDOQ may not be useful for such material in any arbitrary combination of values. I fear it may provoke structures from small detail areas to be transferred to slightly noisy areas, adding "moving wall" artefacts to supposedly flat color ramps, especially with higher PsyRD values. I guess it is more useful in real life footage where everything has a bit structure.

But you may have to test on your own to be certain.

If you want material, I can give you some high-detailed/grained samples of anime.

x265_Project
28th August 2014, 16:34
Hi x265 project...

I having two different encoding jobs running on two different PCs (one 4770 with 16GB of RAM, the other a 4500U with 8GB RAM) with two different sources. (Both DVDs to QTGMC though)

The error for the two crashes are as follows:


The 4500U machine was running 1.3+36-77fe0cc583e8, while the 4770 was running 1.2+575-80129b1b6260

I'm running the encode with Mulder's Simple x264/265 launcher if that matters. Any idea how I could help to resolve this? Thanks! Let me know if you need more information.
If you're using an x265 launcher or another front-end application or GUI, it's hard for us to know where the problem lies. To debug the problem, it would be best to convert your input file to YUV (using FFMPEG, for example... you can start with a limited number of frames), and then run x265 directly with the same command line, using the YUV decoded frames as input. If this works, chances are the problem is with the front-end application.

x265_Project
28th August 2014, 16:36
If you want material, I can give you some high-detailed/grained samples of anime.
I would also like to get access to some good sample anime content. SFW only please. Can you point me to some good examples?

Thanks,
Tom

filler56789
28th August 2014, 16:38
@Tom: it's odd that you have never read or heard of avs2yuv or avs2pipe :D

lotusgg
28th August 2014, 17:59
I would also like to get access to some good sample anime content. SFW only please. Can you post on a cloud drive and private message me the link?

Thanks,
Tom

Are you fine with torrents? They're pretty heavy, so I can't just throw then online.

LigH
28th August 2014, 22:35
No pirating here. See forum rules. Private copies stay private.

foxyshadis
28th August 2014, 22:38
@Tom: it's odd that you have never read or heard of avs2yuv or avs2pipe :D

avs2yuv runs in a separate process from x265, so it shouldn't be the culprit; all x265 sees is YUV frames. Maybe try also encoding the script to x264 slow or veryslow to ensure stability under intense thermal pressure. That trips up a lot of people who aren't watching their temps. However, it can also be the avisynth side failing instead.

That entry can also mean that x265 didn't like what you were feeding it, since avs2yuv will fwrite until the buffer fills up even if the encoder doesn't accept anything. aegisofrime, your log should also include the command-lines and any other log entries from both x265 and avs2yuv, can you post them?

sneaker_ger
28th August 2014, 23:38
And what can I do to prevent banding?
I haven't specifically tested it but encoding with 10 bit is probably able to prevent most of it. Simply use a high-bitdepth build of x265, they will use 10 bit encoding by default.

H3
29th August 2014, 04:24
Does psy-rd and psy-rdoq worth it to use ? Because if I'm using it I just get more artifacts than a more detailed looking picture...

x265_Project
29th August 2014, 06:28
Does psy-rd and psy-rdoq worth it to use ? Because if I'm using it I just get more artifacts than a more detailed looking picture...
--psy-rd can only be used with the medium, slow, slower, veryslow, placebo presets (RD level 3 or higher).

--psy-rdoq can only be used with the slow, slower, veryslow or placebo presets (RD level of 4 or higher)

If you adjust the strength correctly, it should provide a very positive improvement. Can you share your command-line?

I recommend starting with --psy-rd 0.6 --psy-rdoq 1.0

Use lower values if you are using very low bitrates with a lot of motion and detail. Try some tests with different values to see what works best for your content and your other settings.

Tom