Skip to content

x265

currentMigrated from docs/encoders/x265.mdx at 37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0

Open Source H.265 / HEVC video encoder

Latest release
4.3
Last commit
License
GPL-2.0
Stars
60

x265 is an open-source encoder for H.265 / HEVC developed by MulticoreWare, available as a command-line program and as the libx265 library used by FFmpeg, HandBrake and others. It is GPL-licensed, with a commercial licence also offered by MulticoreWare. x265 is actively developed: version 4.3 was released on 31 July 2026, and the GitHub repository is the main upstream.

Its defaults are aimed at low-bitrate streaming: SAO, deblocking and AQ smooth the picture to hide artifacts. With a few changes (lower CRF, SAO limited or off, stronger psy-rdoq) it is also an excellent high-fidelity encoder, which is how most enthusiast encodes use it.

Most FFmpeg builds include libx265. Source releases are tagged on GitHub; many distribution and third-party builds are “multilib” builds that include 8-, 10- and 12-bit encoding in one binary.

Terminal window
x265 --preset slow --crf 20 --output-depth 10 -o output.hevc input.y4m
ffmpeg -i input.mkv -c:v libx265 -preset slow -crf 20 -pix_fmt yuv420p10le -c:a copy output.mkv

The standalone program reads Y4M or raw YUV and writes a raw HEVC bitstream; mux it with mkvmerge, MP4Box or FFmpeg. To feed it from FFmpeg, pipe Y4M. FFmpeg 9.0.2 still needs -strict -1 to write more than 8 bits to Y4M:

Terminal window
ffmpeg -i input.mkv -pix_fmt yuv420p10le -strict -1 -f yuv4mpegpipe - | x265 --input - --y4m --preset slow --crf 20 --output-depth 10 -o output.hevc

In FFmpeg, -preset, -tune, -crf, -profile:v, -g, -b:v, -maxrate/-bufsize and -pass map to x265 settings. Everything else goes through -x265-params using the CLI’s long option names without the dashes, separated by colons: -x265-params aq-mode=3:no-sao=1:deblock=-1,-1. For MP4 output, add -tag:v hvc1; Apple’s players (QuickTime, Safari, iOS) require that sample entry and will not play FFmpeg’s default hev1.

CRF is the mode to use unless you need a specific file size or bitrate. The default is 28, which targets small files. High-quality encodes usually sit somewhere around 16–22, and 4K sources tolerate higher values than 720p or 1080p. CRF values do not carry over from x264 or other encoders, and the preset changes the size you get at a given CRF.

Two-pass hits a target size. Unlike x264, x265 runs the first pass with the full settings by default (--slow-firstpass), because the second pass is better when the passes match:

Terminal window
x265 --preset slow --output-depth 10 --pass 1 --bitrate 4000 -o /dev/null input.y4m
x265 --preset slow --output-depth 10 --pass 2 --bitrate 4000 -o output.hevc input.y4m

With FFmpeg, use -b:v 4M -pass 1 -an -f null /dev/null, then -b:v 4M -pass 2 with your real output.

VBV caps the peak bitrate for streaming or device limits: --vbv-maxrate in kbit/s and --vbv-bufsize in kbit (-maxrate/-bufsize in FFmpeg). With CRF this gives “capped CRF”. --crf-max with VBV can cause buffer underflows, as the help warns.

Presets run ultrafast, superfast, veryfast, faster, fast, medium (default), slow, slower, veryslow and placebo. Pick the slowest preset you can live with before changing anything else. slow is where x265 starts doing serious RDO (rd 4, rdoq-level 2, psy-rdoq 1.0, rectangular partitions), so it is the usual minimum for quality-focused encodes; slower and veryslow add more B-frames, references and analysis. ultrafast is poor enough that x264 is usually the better choice at that speed, and placebo is much slower than veryslow for little gain.

TuneChangesUse for
animation--psy-rd 0.4 --aq-strength 0.4 --deblock 1:1, B-frames +2Animated content. Not listed in --fullhelp but accepted.
grain--aq-mode 0 --no-cutree --ipratio 1.1 --pbratio 1.0 --qpstep 1 --no-sao --psy-rd 4.0 --psy-rdoq 10.0 --rskip 0, plus --rc-grainHeavy grain at high bitrates, where grain must not pulse or clump between frames. It costs a lot of bitrate; for moderate grain, the manual settings below usually do better. Overriding AQ or CU-tree on top of it can bring back grain strobing.
psnrAQ strength 0, psy-rd and psy-rdoq offMetric benchmarking only
ssimAuto-variance AQ, psy-rd and psy-rdoq offMetric benchmarking only
fastdecodeNo deblock, no SAO, no weighted prediction, no intra in B-framesHigh-bitrate 4K for weak decoders
zerolatencyNo B-frames, no lookahead, no scenecut, no CU-tree, one frame threadReal-time streaming

Use 10-bit (Main 10) even for 8-bit sources. It reduces banding and is usually more efficient, and unlike 10-bit H.264, HEVC Main 10 is supported by most current hardware decoders (it is the profile HDR10 uses). Set --output-depth 10 (or --profile main10) in a multilib build, or -pix_fmt yuv420p10le in FFmpeg. 12-bit and 4:2:2/4:4:4 use range-extension profiles with little hardware support.

For HDR10, signal the colour description and copy the static metadata from the source; do not reuse another title’s values:

Terminal window
x265 --preset slow --crf 18 --output-depth 10 --colorprim bt2020 --transfer smpte2084 --colormatrix bt2020nc --master-display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)" --max-cll "1000,400" -o output.hevc input.y4m

--master-display primaries are in units of 0.00002 and luminance in 0.0001 cd/m². --hdr10-opt adds block-level QP tuning for HDR10 content. HDR10+ and Dolby Vision need extra metadata files (--dhdr10-info, --dolby-vision-rpu); see HDR and Preserve colour and HDR.

Defaults are for preset medium; where other presets change a value, it is noted. See Psychovisual optimization for the background.

For high-fidelity live action, a common starting point is to turn SAO off, lower deblocking, use dark-biased AQ and raise psy-rdoq:

Terminal window
x265 --preset slow --crf 18 --output-depth 10 --no-sao --deblock -2:-2 --aq-mode 3 --psy-rdoq 2 -o output.hevc input.y4m

For animation, start from --deblock -1:-1 --aq-strength 0.8, two more B-frames than the preset and --limit-sao or --no-sao. Raise --psy-rdoq further for grainy sources and lower --psy-rd if lines start to ring. These are starting points: adjust them per source by watching the result.

OptionDefaultWhat it does and when to change it
--psy-rd2.0Keeps the energy (detail, sharpness) of the source in mode decisions. Only active at --rd 3 and above. Range 0–5.
--psy-rdoq0.0 (1.0 from slow upward)Keeps energy during quantization, which mostly preserves grain and noise. Only active when --rdoq-level is 1 or 2. Values around 1–2 are common for high-fidelity live action and higher for heavy grain; the grain tune uses 10.
--aq-mode20 off, 1 uniform AQ, 2 auto-variance, 3 auto-variance with a bias toward dark scenes, 4 auto-variance with edge information. Upstream recommends 3 for 8-bit or low-bitrate 10-bit encodes to prevent banding. Mode 3 is a common choice for high-fidelity encodes too, but it can raise bitrate noticeably for little visible gain, so compare it against 2 on your source.
--aq-strength1.00How strongly AQ redistributes bits, 0–3. Commonly lowered to 0.7–0.8 for flat animation or already-compressed sources; the animation tune uses 0.4.
--no-cutreeCU-tree onCU-tree is x265’s version of x264’s MB-tree: blocks that later frames reference get more bits. Leave it on; disabling it costs a lot of efficiency. The grain tune turns it off together with AQ to keep grain stable.
--hevc-aqOffAn alternative AQ algorithm based on CU variance.
--no-strong-intra-smoothingSmoothing onStrong intra smoothing filters the reference samples of 32×32 intra blocks to avoid banding in flat areas. High-fidelity encodes often turn it off to keep detail.

--psy-rd favours specific detail and sharpness; --psy-rdoq favours overall noise and texture. Both depend heavily on the source, so change them in small steps and compare at playback speed as well as frame by frame.

OptionDefaultWhat it does and when to change it
--sao / --no-saoOn (off at ultrafast and superfast)Sample Adaptive Offset reduces ringing and banding but smooths fine detail and grain. Fine at moderate and low bitrates; at high quality (roughly CRF 18 and below) many encoders turn it off.
--limit-saoOffEarly-terminates SAO decisions, which in practice keeps somewhat more detail than full SAO. A middle ground before --no-sao.
--selective-sao4 when SAO is onApplies SAO only to some slice types: 1 I-slices, 2 I and P, 3 all reference slices, 4 all. Lower values are a middle ground between full SAO and --no-sao.
--deblock <tC>:<beta>0:0Deblocking offsets, -6 to 6. At high quality, -1:-1 for animation and -2:-2 for live action are common to keep detail and grain; the animation tune uses 1:1 for lower bitrates.
OptionDefaultWhat it does and when to change it
--rd3 (4 slow, 6 slower+)Rate-distortion optimization level in mode decision, 1–6. Levels 3/4 and 5/6 are currently the same pairs.
--rdoq-level0 (2 at slow+)RDO in quantization: 0 none, 1 levels, 2 levels and coding groups. Needed for --psy-rdoq to do anything.
--tskipOffTries transform skip on 4×4 blocks. Helps sharp synthetic content such as screen captures. Requires --rd 3 or above.
--rect / --ampOff (rect from slow, amp from slower)Rectangular and asymmetric motion partitions. Better efficiency, slower.
--bframes4 (8 at slower+)Maximum consecutive B-frames, 0–16. Animation benefits from about 2 more than the preset default.
--b-adapt2 (0 at veryfast to fast)B-frame placement: 0 none, 1 fast, 2 full trellis. Keep 2.
--bframe-bias0Makes B-frames more or less likely. Rarely worth changing.
--ref3 (4 slow, 5 slower+)Reference frames, 1–16.
--mehex (star at slow+)Motion search: dia, hex, umh, star, full.
--subme2 (3 slow, 4 slower and veryslow, 5 placebo)Subpixel motion refinement, 0–7.
--merange57Motion search range. Rarely needs changing.
--rc-lookahead20 (25 slow, 40 slower)Frames analysed for frame types and CU-tree. Longer helps scenecut detection and CU-tree; more than --keyint does not help.
--keyint / --min-keyint250 / autoMaximum and minimum keyframe interval in frames.
--open-gopOnUnlike x264, open GOP is the default. Use --no-open-gop if the stream will be cut or segmented at keyframes.

x265 parallelizes with Wavefront Parallel Processing (--wpp, on by default: rows start once the row above is two CTUs ahead, about 1% efficiency cost per the upstream docs) and frame threads (--frame-threads, automatic by default). A single frame thread compresses slightly better but is much slower. x265 does not saturate many-core CPUs on lower-resolution content, which is why chunked encoders such as Av1an are sometimes used to run several x265 instances in parallel.

--lossless (-x265-params lossless=1) bypasses transform, quantization and loop filters and reproduces the input exactly; rate-control options are ignored. It is not a common choice: lossless x264 (--qp 0) is much faster for intermediates, and FFV1 is usually preferred for archiving.

Every option the x265 4.3 CLI accepts, grouped as in x265 --fullhelp, followed by aliases, legacy spellings and options that exist only in builds with optional features. Defaults are for preset medium with no tune, which is also what you get without --preset (one exception is noted). Where x265 changes a value at startup, for example from the frame rate, core count or another option, the default cell says so. Full syntax is in the 4.3 CLI documentation.

Executable Options
ParameterDefaultMeaning
--help—Print the common options and exit (-h).
--fullhelp—Print every option, including those --help hides, and exit.
--version—Print the version, the bit depths built in and the detected CPU features, then exit (-V).
Output Options
ParameterDefaultMeaning
--outputunsetOutput file (-o); the second positional argument is used if omitted. Always a raw HEVC elementary stream, so mux it afterwards (FFmpeg, MKVToolNix, MP4Box).
--output-depth8Output and internal bit depth: 8, 10 or 12 (-D). The CLI loads the matching libx265 build; without it, a --profile name such as main10 sets the depth.
--log-levelinfoConsole verbosity: none, error, warning, info, debug (adds per-frame QP and bits) or full.
--no-progressprogress shownTurn off the periodic progress line.
--csvunsetWrite encode statistics to this CSV file (created if missing, otherwise appended).
--csv-log-level0CSV detail: 0 one summary line per run, 1 one line per frame, 2 per-frame lines with performance statistics.
Input Options
ParameterDefaultMeaning
--inputunsetInput file, raw YUV or Y4M; - reads stdin. The first positional argument is used if omitted.
--y4moff (implied by a .y4m name)Parse the input as Y4M whatever its name; needed when piping Y4M through stdin.
--fpsfrom Y4M headerFrame rate as a number or num/den (e.g. 24000/1001). Required for raw YUV; overrides the Y4M header.
--input-resfrom Y4M headerPicture size WxH; required for raw YUV.
--input-depth8 (raw YUV); Y4M header otherwiseBit depth of raw YUV input, 8–16. Deeper input is reduced to the output depth (see --dither).
--input-cspi420 (raw YUV); Y4M header otherwiseChroma format of raw input: i400, i420, i422, i444, nv12, nv16. x265 never resamples chroma, so this also sets the output format.
--dolby-vision-profile0 (off)Make the stream conform to Dolby Vision profile 5, 8.1, 8.2 or 8.4 (8.1 or 81). Requires 10-bit 4:2:0 and VBV; 8.1 also needs --master-display. The RPUs come from --dolby-vision-rpu.
--dolby-vision-rpuunsetBinary RPU file (for example extracted from the source with dovi_tool); one RPU is attached to each input frame in order. CLI only.
--nalu-fileunsetText file of extra prefix SEI messages, one per line: POC PREFIX NALtype/SEItype payload.
--framesallEncode at most this many frames (-f). Knowing the count also helps rate control.
--seek0Skip this many input frames before encoding.
--[no-]interlaceprogressiveInput is interlaced, tff or bff. HEVC codes each field as a picture: supply field-sized pictures and the field rate. Experimental.
--[no-]fieldoffField coding from interleaved frames: with --interlace, x265 halves the height and doubles the frame rate itself.
--ditheroffError-diffusion dither when reducing high-bit-depth input to the output depth. CLI only.
--[no-]copy-piconCopy input pictures into internal buffers. Only API users that supply padded buffers turn this off.
Quality reporting metrics
ParameterDefaultMeaning
--[no-]ssimoffReport SSIM against the source. Only meaningful with psy-rd/psy-rdoq off (--tune ssim); x265 warns otherwise.
--[no-]psnroffReport PSNR against the source. Only meaningful with psy and AQ off (--tune psnr); x265 warns otherwise.
Profile, Level, Tier
ParameterDefaultMeaning
--profileauto (from bit depth and chroma format)Enforce a profile such as main, main10, main12, main422-10, main444-8, main444-10, or an -intra/still-picture variant (-P). Aborts if the settings cannot meet it.
--level-idc0 (auto-detect)Minimum decoder level as 5.1 or 51. x265 constrains the encode to fit (enabling VBV for CRF), signals that level, and aborts if it cannot be met.
--[no-]high-tieronAllow High tier when the VBV rate or buffer exceeds the Main-tier limit for the level; Main tier is signaled otherwise. --no-high-tier stays in Main tier.
--uhd-bdoffApply Ultra HD Blu-ray constraints (level 5.1, closed GOP, keyint up to 1 s, at most 6 refs, AUD, HRD and repeated headers). Needs 1920×1080 or 3840×2160 with BT.709 or BT.2020 colour.
--[no-]allow-non-conformanceoffWrite streams that exceed profile/level limits (signaled as NONE) instead of aborting. Usual cause: too many references.
Threading, performance
ParameterDefaultMeaning
--poolsauto (all cores)Worker threads per NUMA node, comma-separated: a count, + (all cores on that node), - (none) or * (all remaining nodes). none disables the pool, leaving only frame threads. Alias --numa-pools.
--frame-threads0 (auto)Frames encoded in parallel (-F). Auto: 1 below 4 threads, 2 from 4, 3 from 8, 4 from 16, 5 from 32 (6 above 2000 lines). Fewer compress slightly better; more mostly add memory.
--[no-]wpponWavefront parallel processing: a CTU row starts once the row above is two CTUs ahead. Large speed-up for about 1% efficiency.
--slices1Full-width slices per picture. Costs efficiency; only useful when WPP and frame threads cannot fill the CPU.
--[no-]pmodeoffParallel mode decision. Deprecated since 4.1: the CLI rejects --pmode.
--[no-]pmeoffParallel motion estimation. Deprecated since 4.1: the CLI rejects --pme.
--[no-]threaded-meoffDedicated motion-estimation thread pool that works ahead across CTUs. Experimental; lowers efficiency and turns itself off below 32 threads or with VBV.
--[no-]asmauto (detected; AVX-512 off)Override CPU feature detection with names (avx2) or a bitmask; --no-asm disables SIMD. --asm avx512 enables the AVX-512 kernels that detection leaves off. Naming features the CPU lacks crashes the encoder.
Presets
ParameterDefaultMeaning
--presetmediumSpeed/efficiency preset (-p): ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo, or 0–9. Applied before every other option.
--tunenoneApplied after the preset (-t): psnr, ssim, grain, zerolatency, fastdecode, animation. grain turns off AQ, cuTree and SAO, flattens the frame-type QP ratios and raises psy-rd.
Quad-Tree size and depth
ParameterDefaultMeaning
--ctu64Largest coding unit: 64, 32 or 16 (-s). 64 compresses flat areas best; ultrafast and superfast use 32.
--min-cu-size8Smallest coding unit: 8, 16, 32 or 64. Larger is faster and costs bitrate.
--max-tu-size32Largest transform: 32, 16, 8 or 4; never larger than --ctu.
--tu-intra-depth1Extra transform-tree depth for intra CUs, 1–4 (1 = transform as large as the CU). slower and veryslow use 3, placebo 4.
--tu-inter-depth1Extra transform-tree depth for inter CUs, 1–4. slower and veryslow use 3, placebo 4.
--limit-tu0 (off)Early exit from inter transform recursion, 1–4 (heavier heuristics at higher levels). Needs --tu-inter-depth 2 or more; slower uses 4.
Analysis
ParameterDefaultMeaning
--rd3Rate-distortion level for mode decision, 1–6: 2 RDO for splits and merge/skip (ultrafast to fast), 3 RDO for mode and split, 4 same as 3 (slow), 5 adds RDO prediction decisions, 6 same as 5 (slower and above).
--[no-]psy-rd2.0Psychovisual RD strength, 0–5.0: keeps source energy (detail, grain) instead of the lowest distortion. Takes effect at --rd 3 and above.
--[no-]rdoq-level0 (off)Rate-distortion optimised quantisation: 1 per-coefficient level decisions, 2 also drops whole coefficient groups. slow and slower presets use 2.
--[no-]psy-rdoq0.0 (1.0 at slow and slower)Psychovisual strength inside RDOQ, 0–50: keeps more high-frequency energy. Forced to 0 when --rdoq-level is 0, so at medium it only works if you also raise rdoq-level.
--dynamic-rd0 (off)Raise RD effort where VBV forces quality down, strength 0–4. Only with VBV, AQ on and --rd 4 or lower.
--[no-]ssim-rdoffUse SSIM-based distortion in mode decision; turns psy-rd off. --rd 3 and above.
--[no-]rd-refineoffTry several QPs on the best partition of each CU to find the best rounding. --rd 5–6 with AQ on.
--[no-]early-skiponCheck 2N×2N merge first and stop if it leaves no residual. The fast preset and slow and above turn it off.
--rskip1Early exit from CU depth recursion: 0 off, 1 neighbour cost and homogeneity (or a 2N×2N inter comparison at --rd 5–6), 2 CU edge density. placebo and --tune grain use 0.
--rskip-edge-threshold5 (%)Edge density, in percent (0–100), below which --rskip 2 stops recursing.
--[no-]tskip-fastoffEvaluate transform skip only for 4×4 intra NxN blocks (chroma only where luma used it). Needs --tskip.
--[no-]splitrd-skipoffSkip split RD analysis of an intra CU once the split cost already exceeds the unsplit cost.
--nr-intra0 (off)Noise-reduction deadzone for intra blocks, 0–2000, applied to transform coefficients. Output then varies with the frame-thread count.
--nr-inter0 (off)Noise-reduction deadzone for inter blocks, 0–2000.
--ctu-info0 (off)API only: react to CTU information passed with x265_encoder_ctu_info (1, 2, 4 or 6). If set without calling it, the encoder waits forever.
Coding tools
ParameterDefaultMeaning
--[no-]weightponWeighted prediction in P slices (-w); large gains on fades and lighting changes.
--[no-]weightboffWeighted prediction in B slices. On at slower and above.
--[no-]cu-losslessoffAlso try lossless (transform and quantisation bypass) coding of each CU in RDO. --rd 3 and above.
--[no-]signhideonSign-bit hiding: one coefficient sign per TU is inferred from parity.
--[no-]tskipoffTry transform skip on 4×4 blocks; helps text and screen content. --rd 3 and above; placebo enables it.
Temporal / motion search options
ParameterDefaultMeaning
--max-merge3Merge candidates, 1–5. Faster presets use 2, slower 4, veryslow and placebo 5.
--ref3L0 reference frames, 1–16. With B-pyramid at most 6 stay within HEVC’s 8-picture limit; beyond that x265 aborts unless --allow-non-conformance.
--limit-refs1Reference pruning: 0 off, 1 use the references chosen by the four sub-CUs, 2 limit rect/AMP to the 2N×2N choice, 3 both.
--mehex (1)Integer-pel motion search: dia (0), hex (1), umh (2), star (3), sea (4), full (5). slow and above use star.
--subme2Sub-pixel refinement effort, 0–7 (-m). slow uses 3, slower and veryslow 4, placebo 5.
--merange57Motion search range in pixels; 57 fits a 64-pixel CTU without an extra row of latency. placebo uses 92.
--[no-]rectoffEvaluate rectangular partitions (N×2N, 2N×N). On at slow and above.
--[no-]ampoffEvaluate asymmetric 75/25 partitions; needs --rect. On at slower and above.
--[no-]limit-modesoffSkip rect/AMP modes that sub-CU costs mark as unlikely. On at slow and slower.
--[no-]temporal-mvponTemporal motion-vector predictors from the co-located picture.
--[no-]hmeoffThree-level hierarchical motion estimation (1/16, 1/4 and full resolution). Needs 540 or more lines; replaces --me/--merange with the level-2 values.
--hme-searchhex,umh,umhSearch method for each HME level (names or 0–5); one value applies to all levels. Setting it enables --hme.
--hme-range16,32,48Search range for each HME level. Setting it enables --hme.
Spatial / intra options
ParameterDefaultMeaning
--[no-]strong-intra-smoothingonBilinear smoothing of 32×32 intra reference samples; reduces banding in smooth gradients.
--[no-]constrained-intraoffIn inter slices, intra prediction uses only intra-coded neighbours, limiting error propagation. Alias --cip.
--[no-]b-intraonEvaluate intra modes in B slices. Off in ultrafast to fast and in slow.
--[no-]fast-intraoffCoarse-to-fine angular intra search (about 10 of 33 modes). Used by ultrafast to fast; --rd 4 and lower.
--rdpenalty0 (off)Penalise 32×32 intra transforms in P/B slices: 1 quadruples their bit cost, 2 avoids them unless depth limits require them. Needs --tu-intra-depth 2+ to affect 32×32 CUs.
Slice decision options
ParameterDefaultMeaning
--[no-]open-goponOpen GOP: keyframes after the first may be CRA pictures with leading pictures that reference the previous GOP. Use --no-open-gop when the stream is cut into independently decodable segments.
--cra-naloffCode every frame after the first as a CRA picture; only valid with --keyint 1.
--keyint250Maximum keyframe interval in frames (-I). -1 = a single keyframe, 1 = all-intra.
--min-keyintauto: min(fps, keyint/10), e.g. 24 at 24 fpsScene cuts closer than this to the previous keyframe become non-IDR I-frames (-i). Set it equal to --keyint for a fixed GOP.
--gop-lookahead0If a scene cut falls within this many frames after the --keyint limit, extend the GOP to it. Range 0 to --rc-lookahead minus the mini-GOP length.
--no-scenecutscene-cut detection onDisable adaptive I-frame insertion; same as --scenecut 0.
--scenecut40Scene-cut sensitivity; higher inserts more I-frames, 0 disables.
--scenecut-bias5Inter/intra cost difference, in percent, that marks a scene cut (5 = inter cost at least 95% of intra cost). Upstream recommends 5–15.
--hist-scenecutoffDetect scene cuts from histograms, intensity and variance of the picture.
--no-hist-scenecuthistogram detection offDisable histogram-based scene-cut detection.
--[no-]fadesoffDetect fade-ins and handle them in frame-type decisions.
--scenecut-aware-qp0 (off)Second pass only: raise the QP of inter frames after (1), before (2) or on both sides of (3) a scene cut, where the cut masks the loss.
--masking-strengthbuilt-in (1200 ms forward, 600 ms backward windows)Windows (ms) and QP offsets for --scenecut-aware-qp: window,refQpDelta,nonRefQpDelta per direction, or six such triples per direction.
--scenecut-qp-configunsetFile with --scenecut-aware-qp and --masking-strength settings for the second pass. CLI only.
--radl0RADL leading pictures before each IDR, 0 to --bframes. Closed GOP only; upstream suggests 2–3 when used.
--intra-refreshoffPeriodic intra refresh: a column of intra blocks sweeps across the picture every --keyint frames instead of IDR frames. For low-latency streams; forces one reference and turns off open GOP and scene cuts.
--rc-lookahead20Frames analysed ahead for frame types, cuTree and rate control, up to 250. Must exceed --bframes or x265 refuses to start. slow uses 25, slower and veryslow 40, placebo 60.
--lookahead-slices8 (0 below 720 lines)Split lookahead cost estimates into slices for parallelism, at some cost in decision accuracy. Capped by height (4 at 720p, 6 at 1080p); slow uses 4, slower and above 0.
--lookahead-threads0 (shared pool)Threads dedicated to the lookahead, up to half the hardware threads.
--bframes4Maximum consecutive B-frames, 0–16 (-b). slower and above use 8; 0 gives a low-latency I/P stream.
--bframe-bias0Bias toward B-frames in frame-type decisions, −90 to 100.
--b-adapt2B-frame placement: 0 fixed pattern, 1 fast, 2 full trellis. ultrafast to fast use 0.
--[no-]b-pyramidonUse B-frames as references.
--qpfileunsetForce frame types and optionally QPs: one frame type [QP] per line, types I i K P B b.
--force-flush0Flushing (API): 0 only at end of input, 1 flush all frames immediately, 2 flush frames whose type is decided.
--[no-]hrd-concatoffSet the concatenation flag in the first buffering-period SEI; for every chunk after the first in chunked encoding.
Rate control, Adaptive Quantization
ParameterDefaultMeaning
--bitrate0 (CRF mode)Average bitrate in kbit/s: one-pass ABR, or the target for --pass.
--qpunset (CRF mode)Constant QP for P frames, 0–51 (-q); I and B follow --ipratio/--pbratio. Turns off AQ and cuTree. QP 0 is not lossless.
--crf28.0Constant rate factor, 0–51; lower means higher quality and larger files. The default rate-control mode.
--[no-]losslessoffBypass transform, quantisation and loop filters for bit-exact output; rate-control options are ignored.
--crf-max0 (off)Highest rate factor a frame may reach under CRF with VBV; can cause VBV underflows.
--crf-min0 (off)Lowest rate factor a frame may get under CRF with VBV.
--vbv-maxrate0 (off)VBV maximum rate in kbit/s. With --vbv-bufsize it caps a CRF encode or constrains ABR.
--vbv-bufsize0 (off)VBV buffer size in kbit.
--vbv-init0.9Initial buffer fill: a fraction of the buffer (up to 1) or kbit.
--vbv-end0 (off)Required final buffer fill (fraction or kbit), so separately encoded chunks join without VBV violations.
--min-vbv-fullness50Minimum buffer fullness, in percent, that rate control tries to keep. Experimental.
--max-vbv-fullness80Maximum buffer fullness, in percent. Experimental.
--vbv-end-fr-adj0Fraction of the frames after which QP is steered toward --vbv-end; needs a known frame count.
--chunk-start0 (off)First frame written to the bitstream; earlier frames are encoded and discarded. Closed GOP only.
--chunk-end0 (off)Last frame written; later frames feed only the lookahead. Closed GOP only.
--pass0 (off)Multipass: 1 writes statistics, 2 reads them (final pass), 3 reads and rewrites them (middle passes).
--[no-]multi-pass-opt-analysisoffReuse first-pass analysis (MVs, depths, modes) in the final pass. Not with --analysis-save/--analysis-load.
--[no-]multi-pass-opt-distortionoffLower the QP of CTUs that had high distortion in the first pass, raise it for low-distortion CTUs.
--[no-]vbv-live-multi-passoffIn the second pass, adjust QP from the live VBV fill to reduce violations (ABR with VBV). Experimental.
--statsx265_2pass.logMultipass statistics file; a .cutree file is written next to it.
--[no-]analyze-src-picsoffRun motion estimation on source pictures instead of reconstructed ones.
--[no-]slow-firstpassonRun the first pass with full settings. --no-slow-firstpass uses a faster first pass (rd 2, dia search, one reference, no rect/AMP).
--strict-cbroffABR: hold the bitrate tightly, prioritising rate over quality (also sets --pbratio 1.0). For short segments that must not overshoot.
--analysis-saveunsetSave analysis data for a later encode of the same source; amount set by --analysis-save-reuse-level.
--analysis-loadunsetLoad analysis data saved by an earlier encode of the same source to skip work.
--analysis-reuse-filex265_analysis.datFile used by --multi-pass-opt-analysis and --multi-pass-opt-distortion.
--analysis-reuse-level0Deprecated: sets both save and load reuse levels.
--analysis-save-reuse-level0 (5 when saving)How much analysis to save, 1 (lookahead only) to 10 (everything). 0 becomes 5 with --analysis-save.
--analysis-load-reuse-level0 (5 when loading)How much saved analysis to reuse, 1–10. 0 becomes 5 with --analysis-load.
--refine-analysis-typeoffReuse analysis passed through the API from an avc or hevc encode.
--scale-factor0Resolution ratio between the saving and the loading encode (2 when 1080p reuses 540p analysis).
--refine-intra0Intra refinement when loading analysis: 0 reuse mode and depth, up to 4 re-analyse every intra block.
--refine-inter0Inter refinement when loading analysis: 0 reuse mode and depth, up to 3 re-evaluate all inter modes at the reused depth.
--[no-]dynamic-refineoffPick the --refine-inter level per CU from the content.
--refine-mv1MV refinement for scaled analysis reuse: 1 search around the scaled MV, 2 also the best AMVP candidate, 3 also the other candidate.
--refine-ctu-distortion01 stores CTU distortion with --analysis-save and normalises it on --analysis-load.
--aq-mode2Adaptive quantisation: 0 off, 1 uniform, 2 auto-variance, 3 auto-variance biased toward dark scenes (helps banding in 8-bit and low-bitrate encodes), 4 auto-variance with edge information. Constant QP turns AQ off; mode 0 with cuTree on becomes mode 1 at strength 0.
--[no-]hevc-aqoffAlternative AQ using the minimum variance of sub-blocks; replaces the other AQ modes.
--aq-strength1.0AQ strength, 0–3.0; 0 disables the AQ offsets.
--qp-adaptation-range1.0Maximum delta-QP range for --hevc-aq, 1.0–6.0.
--[no-]aq-motionoffRaise QP for blocks that move relative to the frame. Experimental.
--[no-]sbrcoffSegment-based rate control: capped CRF per keyframe-interval segment. Needs CRF with VBV; forces closed, fixed-length GOPs. Experimental.
--qg-size32Quantisation-group size (64, 32, 16 or 8): the smallest block that gets its own AQ offset. Clamped to the CU size range.
Foveated encoding options (gaze-contingent per-QG QP mapping)
ParameterDefaultMeaning
--fovea-gaze-1,-1 (frame centre)Gaze point in pixels; negative values use the frame centre.
--fovea-delta0 (off)QP increase at the periphery, 5–40; 0 disables foveated encoding.
--fovea-sigma0 (auto: 95 px)Gaussian radius of the sharp region in pixels; 0 uses 95 px (about 2.5° at 60 cm).
--fovea-gaze-fileunsetPer-frame gaze points, one frame x y per line; overrides --fovea-gaze.
Quantizer curve, chroma offsets and zones
ParameterDefaultMeaning
--[no-]cutreeonLower the QP of blocks that later frames reference heavily, using lookahead motion data. --tune grain and --tune zerolatency turn it off.
--[no-]rc-grainoffRate control that minimises QP fluctuation so grain does not pulse; part of --tune grain.
--ipratio1.4QP factor between I and P frames.
--pbratio1.3QP factor between P and B frames.
--qcomp0.6Quantiser curve compression, 0.5–1.0: lower holds bitrate steadier, 1.0 approaches constant QP. Also scales cuTree strength.
--qpstep4Largest QP change between frames allowed to rate control.
--qpmin0Lowest QP rate control may use.
--qpmax69Highest QP rate control may use.
--[no-]const-vbvoffMake VBV decisions repeatable between runs; part of --tune grain.
--cbqpoffs0Cb QP offset from luma, −12 to 12; negative spends more bits on chroma. With 4:4:4 input and psy-rd on, x265 sets 6 for both offsets if neither is given.
--crqpoffs0Cr QP offset from luma, −12 to 12.
--scaling-listoffQuantisation scaling lists: off, default (the HEVC default lists) or an HM-format file.
--zonesunsetPer-range overrides separated by /: start,end,q=QP or start,end,b=multiplier. Later zones win.
--zonefileunsetFile of frame options… lines that reconfigure the encoder from that frame on. Forces closed GOP and repeated headers. CLI only.
--no-zonefile-rc-initrate control reset per zoneKeep rate-control history across zonefile zones.
--lambda-fileunsetReplacement lambda tables (70 values each for lambda and lambda²). Process-global; for experiments.
--max-ausize-factor1.0Fraction (0.5–1.0) of the specification’s maximum access-unit size to allow.
Loop filters (deblock and SAO)
ParameterDefaultMeaning
--[no-]deblockon, 0:0Deblocking filter with optional tC:beta offsets from −6 to 6; negative values filter less (sharper, more blocking risk). --no-deblock disables it.
--[no-]saoonSample adaptive offset filter. Cleans ringing and banding but also softens fine texture; often turned off for high-quality and grainy encodes (--tune grain does).
--[no-]sao-non-deblockoffAnalyse SAO on non-deblocked pixels instead of skipping the right/bottom CTU edges.
--[no-]limit-saooffEnd SAO analysis early using mode and neighbour heuristics; faster, slightly less effective.
--selective-sao0 stored; 4 (all slices) when SAO is onSAO per slice type: 1 I only, 2 I and P, 3 all reference slices, 4 all slices. With SAO on, 0 is promoted to 4; with --no-sao it stays 0, and any non-zero value turns SAO back on.
VUI options
ParameterDefaultMeaning
--sar0 (undefined; Y4M header if present)Sample aspect ratio: index 1–16 (1 = 1:1) or w:h.
--display-windowunsetDefault display window: left,top,right,bottom pixels for the player to crop. Signaling only.
--overscannot signaledshow or crop overscan hint.
--videoformatnot signaledOriginal analog format: component, pal, ntsc, secam, mac, unknown.
--rangenot signaled (players assume limited)limited or full. Signaling only; samples are not converted.
--colorprimnot signaledColour primaries, e.g. bt709, bt2020, smpte432. Signaling only.
--transfernot signaledTransfer characteristics, e.g. bt709, smpte2084 (PQ), arib-std-b67 (HLG). Signaling only.
--colormatrixnot signaledMatrix coefficients, e.g. bt709, bt2020nc, ictcp. Signaling only.
--chromalocnot signaledChroma sample location type 0–5 (HDR10 4:2:0 normally uses 2).
--master-displayunsetSMPTE ST 2086 mastering display SEI: G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min), chromaticities in 0.00002 units and luminance in 0.0001 cd/m². Copy it from the source. Turns on HDR10 SEI.
--max-cll0,0 (unset)Content light level SEI as MaxCLL,MaxFALL in cd/m². Turns on HDR10 SEI.
--video-signal-type-presetunsetSet primaries, transfer, matrix, range and chroma location at once, e.g. BT709_YCC or BT2100_PQ_YCC, optionally with :P3D65x1000n0005 for the mastering display. Overrides the individual options.
--[no-]cllonInclude the content light level SEI (0,0 when --max-cll is unset) whenever HDR10 SEI is written.
--[no-]hdr10offForce HDR10 SEI even with zero values. Implied by --master-display or --max-cll; also turns on repeated headers.
--[no-]hdr-optoffDeprecated alias of --hdr10-opt.
--[no-]hdr10-optoffBlock-level luma and chroma QP adjustment for HDR10; only for 10-bit 4:2:0 BT.2020 PQ sources (otherwise disabled). Use with AQ.
--min-luma0Clip input luma below this value.
--max-lumabit-depth maximum (255 at 8-bit, 1023 at 10-bit)Clip input luma above this value.
Bitstream options
ParameterDefaultMeaning
--[no-]repeat-headersoffRepeat VPS/SPS/PPS at every keyframe, for raw streams that must be decodable from any keyframe. Turned on automatically for HDR metadata, zonefiles, all-intra and --uhd-bd.
--[no-]infoonWrite an SEI with the x265 version and full settings string.
--[no-]hrdoffSignal HRD parameters with buffering-period and picture-timing SEI. Needs VBV; ignored without it.
--[no-]idr-recovery-seioffRecovery point SEI at each IDR.
--temporal-layers0 (off)Temporal sub-layers, 2–5. 3, 4 and 5 fix the mini-GOP at 3, 7 and 15 B-frames and turn off adaptive B placement.
--[no-]audoffAccess unit delimiter NAL units.
--[no-]eoboffEnd-of-bitstream NAL unit at the end.
--[no-]eosoffEnd-of-sequence NAL unit after each coded video sequence.
--hash0 (off)Decoded picture hash SEI for decoder checks: 1 MD5, 2 CRC, 3 checksum.
--atc-seioffAlternative transfer characteristics SEI with this preferred transfer value; used for HLG (--atc-sei 18).
--pic-struct-1 (not signaled)pic_struct value, 0–12, in the picture timing SEI.
--log2-max-poc-lsb8Bits for the picture order count LSB in slice headers (minimum 4).
--[no-]vui-timing-infoonFrame-rate timing information in the VUI.
--[no-]vui-hrd-infoonHRD parameters in the VUI when --hrd is on.
--[no-]opt-qp-ppsoffSet the PPS initial QP from the previous GOP instead of 26; needs repeated headers.
--[no-]opt-ref-list-length-ppsoffSet the PPS L0/L1 list lengths from the previous GOP instead of 0.
--[no-]multi-pass-opt-rpsoffIn multipass encodes, store the most used reference picture sets in the SPS.
--[no-]opt-cu-delta-qpoffPull low CU QPs toward the frame mean to reduce delta-QP signaling. --rd 5–6.
Reconstructed output, temporal filter and ABR ladder
ParameterDefaultMeaning
--reconunsetWrite reconstructed pictures (-r): Y4M for a .y4m name, raw YUV otherwise. For debugging.
--recon-depthoutput bit depthBit depth of the --recon file.
--recon-y4m-execunsetPipe reconstructed Y4M to a viewer command, e.g. "ffplay -i pipe:0 -autoexit".
--lowpass-dctoffLow-pass subband DCT approximation for 16×16 and 32×32 blocks: up to about 10% faster with a small efficiency loss. Experimental.
--[no-]frame-dupoffReplace 2–3 near-identical frames with one and signal frame doubling/tripling in pic_struct. Needs VBV and --hrd.
--dup-threshold70Similarity threshold (PSNR) for --frame-dup, 1–99. A non-default value turns frame duplication on.
--[no-]mcstfoffMotion-compensated spatio-temporal filter: denoises I and P frames before encoding, saving bits on noisy sources.
--mcstf-ref-range2 (1 when --preset ultrafast–medium is given)Frames on each side used by --mcstf, 1–4. The ultrafast to medium preset definitions set 1, so an explicit --preset medium gives 1 while omitting --preset leaves 2.
--[no-]selective-mcstfoffApply MCSTF only to GOPs estimated as noisy; implies --mcstf.
--abr-ladderunsetConfig file listing several encodes ([id:reuse-level:ref-id] options per line) run together with analysis reuse. Experimental; CLI only.
SEI message options
ParameterDefaultMeaning
--film-grainunsetBinary film grain characteristics model to write as an FGC SEI; the decoder synthesises the grain. x265 does not estimate or remove grain.
--aom-film-grainunsetBinary AOM film grain parameters to carry in an SEI message.
--[no-]frame-rcoffAPI: allow per-frame QP, CRF or bitrate changes through x265_encoder_reconfig.
Additional accepted flags, aliases and legacy declarations
ParameterDefaultMeaning
--numa-poolsautoAlias of --pools.
--no-cu-statsoffTurn off the deprecated CU statistics flag.
--cu-statsoffDeprecated; 4.3 only prints a warning.
--frame-skip0Alias of --seek.
--no-fast-cbfrejectedDeclared by the CLI but rejected by the 4.3 parser (“invalid argument”).
--fast-cbfrejectedDeclared by the CLI but rejected by the 4.3 parser.
--cipoffAlias of --constrained-intra.
--no-cipoffAlias of --no-constrained-intra.
--no-b-adaptb-adapt 2Same as --b-adapt 0.
--ratetolrejectedDeclared by the CLI but rejected by the 4.3 parser.
--cplxblur20Temporal blur of frame complexity before the QP curve is built (ABR and multipass).
--qblur0.5Temporal blur of QPs after the curve is built.
--no-lftdeblocking onDeprecated alias of --no-deblock.
--lftdeblocking onDeprecated alias of --deblock.
--crop-rectunsetDeprecated alias of --display-window.
--no-ditherrejectedDeclared but rejected by the 4.3 parser; dithering is off unless --dither is given.
--analysis-reuse-mode0 (off)Deprecated and ignored; use --analysis-save/--analysis-load.
--hdroffDeprecated alias of --hdr10.
--no-hdroffDeprecated alias of --no-hdr10.
--no-dhdr10-optoffTurn off --dhdr10-opt.
--single-seioffPut all SEI messages of an access unit in one NAL unit. The HM decoder warns about this when HRD SEI is present.
--no-single-seioffOne NAL unit per SEI message.
--no-svtSVT-HEVC builds onlyUse x265’s own encoder instead of SVT-HEVC.
--no-svt-hmeSVT-HEVC builds onlyTurn off SVT-HEVC hierarchical motion estimation.
--no-svt-compressed-ten-bit-formatSVT-HEVC builds onlyTurn off SVT-HEVC packed 10-bit input.
--no-svt-speed-controlSVT-HEVC builds onlyTurn off SVT-HEVC speed control.
--no-svt-fps-in-vpsSVT-HEVC builds onlyLeave timing information out of the VPS (SVT-HEVC).
Conditional build features
ParameterDefaultMeaning
--dhdr10-infounset (HDR10+ builds)JSON file of HDR10+ (SMPTE ST 2094-40) dynamic metadata to insert per frame. Needs a build with ENABLE_HDR10_PLUS.
--dhdr10-optoff (HDR10+ builds)Insert HDR10+ SEI only at IDRs and when the metadata changes.
--alphaoff (ENABLE_ALPHA builds)Encode an alpha auxiliary layer; input must be YUVA 4:2:0.
--num-views1 (ENABLE_MULTIVIEW builds)Number of views for MV-HEVC; normally set in --multiview-config.
--multiview-configunset (ENABLE_MULTIVIEW builds)File with --num-views, --format and one --input per view.
--format0 (ENABLE_MULTIVIEW builds)Multiview input layout: 0 separate files, 1 side by side, 2 top and bottom.
--scc0 (ENABLE_SCC_EXT builds)Screen content coding with intra block copy: 1 limited search, 2 full search.
--svtoff (SVT-HEVC builds only)Encode with the SVT-HEVC library instead of x265’s encoder.
--svt-hmeon (SVT-HEVC builds only)SVT-HEVC hierarchical motion estimation.
--svt-search-widthresolution-dependent (SVT-HEVC builds only)SVT-HEVC motion search width, 1–256.
--svt-search-heightresolution-dependent (SVT-HEVC builds only)SVT-HEVC motion search height, 1–256.
--svt-compressed-ten-bit-formatoff (SVT-HEVC builds only)Accept SVT-HEVC’s packed 10-bit input format.
--svt-speed-controloff (SVT-HEVC builds only)Adjust SVT-HEVC speed to reach --fps in real time.
--svt-preset-tunerunset (SVT-HEVC builds only)With --preset placebo, select SVT-HEVC preset 0 or 1.
--svt-hierarchical-level3 (SVT-HEVC builds only)SVT-HEVC hierarchy: 0 flat to 3 four levels.
--svt-base-layer-switch-mode0 (SVT-HEVC builds only)SVT-HEVC base layer: 0 B-frames, 1 P-frames.
--svt-pred-struct2 (SVT-HEVC builds only)SVT-HEVC prediction structure: 0 low-delay P, 1 low-delay B, 2 random access.
--svt-fps-in-vpsoff (SVT-HEVC builds only)Timing information in the VPS (SVT-HEVC).

FFmpeg 9.0.2’s libx265 wrapper adds the private options below. Several x265 settings come from FFmpeg’s generic options instead: -b:v (ABR bitrate), -maxrate and -bufsize (VBV), -g, -keyint_min, -bf, -refs, -qmin/-qmax and -pass. The output bit depth follows -pix_fmt (for example yuv420p10le loads the 10-bit libx265). Anything else goes through -x265-params.

All libx265 private options
ParameterTypeDefaultRangeMeaning
-crffloat-1-1 to FLT_MAXx265 CRF (0–51). -1 passes nothing, so x265’s CRF 28 applies unless -b:v or -qp is set. Takes priority over -b:v and -qp.
-qpint-1-1 to INT_MAXConstant QP; used only when neither -crf nor -b:v is set.
-forced-idrbooleanfalse0 to 1Code forced keyframes (e.g. from -force_key_frames) as IDR instead of I/CRA frames.
-presetstringunsetx265 preset namex265 preset; unset gives x265’s defaults, which match medium.
-tunestringunsetx265 tune namex265 tune (psnr, ssim, grain, zerolatency, fastdecode, animation).
-profilestringunsetx265 profile nameEnforce a profile such as main10 or main422-10. It does not change the bit depth or chroma format; -pix_fmt does.
-x265-statsstringunsetfile nameStatistics file for -pass 1/-pass 2 (x265 --stats); x265 uses x265_2pass.log when unset.
-udu_seibooleanfalse0 to 1Copy user-data-unregistered SEI from the input frames into the output.
-a53ccbooleanfalse0 to 1Copy A/53 closed captions from the input frames into SEI.
-x265-paramsdictionaryunsetkey=value:key=valueAny x265 library option without the leading --, e.g. -x265-params aq-mode=3:sao=0. Applied after the preset, tune and generic options. CLI-only options (input, output, dither, seek…) do not exist here, and unknown names or bad values only log a warning.
-dolbyvisionbooleanauto-1 (auto) to 1Write Dolby Vision RPUs regenerated from the per-frame Dolby Vision metadata of the input (a decoded Dolby Vision source). auto enables it when that metadata is present, 0 disables it, 1 fails if it cannot. Profiles 5 and 8.x only (10-bit 4:2:0); profile 7 enhancement layers are not supported.