View Full Version : x264 Profiles
flebber
12th September 2008, 15:58
I have created an x264 profile which creates a very good quality file(maybe I can get it better still experimenting). Which settings in the profile are going to be able to reduce file size without the biggest impact on quality ?
I have been running off these guides as well but just can't get it right for me yet. http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-x264.html Or if you have a guide which explains x264 profile options better I'd like to read it.
http://www.afterdawn.com/guides/archive/x264_options_explained_page_2.cfm
<?xml version="1.0"?>
<VideoProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>2P-HQ</Name>
<Settings xsi:type="x264Settings">
<EncodingMode>4</EncodingMode>
<BitrateQuantizer>1000</BitrateQuantizer>
<KeyframeInterval>250</KeyframeInterval>
<NbBframes>3</NbBframes>
<MinQuantizer>8</MinQuantizer>
<MaxQuantizer>51</MaxQuantizer>
<Turbo>false</Turbo>
<V4MV>true</V4MV>
<QPel>true</QPel>
<Trellis>1</Trellis>
<CreditsQuantizer>40</CreditsQuantizer>
<Logfile>.stats</Logfile>
<CustomEncoderOptions />
<FourCC>1</FourCC>
<Zones />
<MaxNumberOfPasses>3</MaxNumberOfPasses>
<NoDCTDecimate>false</NoDCTDecimate>
<PSNRCalculation>false</PSNRCalculation>
<noFastPSkip>false</noFastPSkip>
<NoiseReduction>0</NoiseReduction>
<MixedRefs>false</MixedRefs>
<X264Trellis>0</X264Trellis>
<NbRefFrames>3</NbRefFrames>
<AlphaDeblock>0</AlphaDeblock>
<BetaDeblock>0</BetaDeblock>
<SubPelRefinement>4</SubPelRefinement>
<MaxQuantDelta>4</MaxQuantDelta>
<TempQuantBlur>0</TempQuantBlur>
<BframePredictionMode>3</BframePredictionMode>
<VBVBufferSize>14000</VBVBufferSize>
<VBVMaxBitrate>25000</VBVMaxBitrate>
<METype>1</METype>
<MERange>16</MERange>
<MinGOPSize>25</MinGOPSize>
<Profile>1</Profile>
<Level>4.1</Level>
<IPFactor>1.4</IPFactor>
<PBFactor>1.3</PBFactor>
<ChromaQPOffset>0</ChromaQPOffset>
<VBVInitialBuffer>0.9</VBVInitialBuffer>
<BitrateVariance>1.0</BitrateVariance>
<QuantCompression>0.6</QuantCompression>
<TempComplexityBlur>20</TempComplexityBlur>
<TempQuanBlurCC>0.5</TempQuanBlurCC>
<SCDSensitivity>40</SCDSensitivity>
<BframeBias>0</BframeBias>
<Deblock>true</Deblock>
<Cabac>true</Cabac>
<WeightedBPrediction>true</WeightedBPrediction>
<AdaptiveBFrames>1</AdaptiveBFrames>
<BFramePyramid>weight_b</BFramePyramid>
<BRDO>true</BRDO>
<biME>false</biME>
<ChromaME>true</ChromaME>
<P8x8mv>true</P8x8mv>
<B8x8mv>true</B8x8mv>
<I4x4mv>false</I4x4mv>
<I8x8mv>true</I8x8mv>
<P4x4mv>false</P4x4mv>
<AdaptiveDCT>true</AdaptiveDCT>
<Interlaced>false</Interlaced>
<SSIMCalculation>false</SSIMCalculation>
<Width>false</Width>
<Sar>false</Sar>
<aud>false</aud>
<nal-hrd>false</nal-hrd>
<pulldown>0</pulldown>
<aq-strength>false</aq-strength>
<aq-sensitivity>false</aq-sensitivity>
<deadzone-inter>false</deadzone-inter>
<deadzone-intra>false</deadzone-intra>
<fpel-cmp>false</fpel-cmp>
<pre-scenecut>false</pre-scenecut>
<psy-rd>false</psy-rd>
<me-prepass>false</me-prepass>
<QuantizerMatrix />
<QuantizerMatrixType>0</QuantizerMatrixType>
</Settings>
</VideoProfile>
Dark Shikari
12th September 2008, 16:24
Quality and file size are the same thing--a setting that increases quality at a given bitrate also means you could lower the bitrate a bit and get the same quality.
flebber
12th September 2008, 23:53
Quality and file size are the same thing--a setting that increases quality at a given bitrate also means you could lower the bitrate a bit and get the same quality.
So then lowering bitrate and QP_min would equal a smaller size file but would also decrease quality wouldn't they ? But you are saying as long as change isn't drastic it wouldn't effect quality greatly.
The above x264 was based of the automkv 2pass Extreme profile.
<?xml version="1.0"?>
<VideoProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>HQ-Extreme</Name>
<Settings xsi:type="x264Settings">
<EncodingMode>4</EncodingMode>
<BitrateQuantizer>1000</BitrateQuantizer>
<KeyframeInterval>250</KeyframeInterval>
<NbBframes>8</NbBframes>
<MinQuantizer>10</MinQuantizer>
<MaxQuantizer>51</MaxQuantizer>
<Turbo>true</Turbo>
<V4MV>false</V4MV>
<QPel>false</QPel>
<Trellis>false</Trellis>
<CreditsQuantizer>40</CreditsQuantizer>
<Logfile>.stats</Logfile>
<CustomEncoderOptions />
<FourCC>1</FourCC>
<Zones />
<MaxNumberOfPasses>3</MaxNumberOfPasses>
<NoDCTDecimate>false</NoDCTDecimate>
<PSNRCalculation>false</PSNRCalculation>
<noFastPSkip>false</noFastPSkip>
<NoiseReduction>0</NoiseReduction>
<MixedRefs>true</MixedRefs>
<X264Trellis>1</X264Trellis>
<NbRefFrames>12</NbRefFrames>
<AlphaDeblock>-2</AlphaDeblock>
<BetaDeblock>-1</BetaDeblock>
<SubPelRefinement>6</SubPelRefinement>
<MaxQuantDelta>4</MaxQuantDelta>
<TempQuantBlur>0</TempQuantBlur>
<BframePredictionMode>3</BframePredictionMode>
<VBVBufferSize>14000</VBVBufferSize>
<VBVMaxBitrate>25000</VBVMaxBitrate>
<METype>3</METype>
<MERange>16</MERange>
<MinGOPSize>25</MinGOPSize>
<Profile>2</Profile>
<Level>4.1</Level>
<IPFactor>1.4</IPFactor>
<PBFactor>1.3</PBFactor>
<ChromaQPOffset>0</ChromaQPOffset>
<VBVInitialBuffer>0.9</VBVInitialBuffer>
<BitrateVariance>1.0</BitrateVariance>
<QuantCompression>0.6</QuantCompression>
<TempComplexityBlur>20</TempComplexityBlur>
<TempQuanBlurCC>0.5</TempQuanBlurCC>
<SCDSensitivity>40</SCDSensitivity>
<BframeBias>0</BframeBias>
<Deblock>true</Deblock>
<Cabac>true</Cabac>
<WeightedBPrediction>true</WeightedBPrediction>
<AdaptiveBFrames>2</AdaptiveBFrames>
<BFramePyramid>true</BFramePyramid>
<BRDO>true</BRDO>
<biME>true</biME>
<ChromaME>true</ChromaME>
<P8x8mv>true</P8x8mv>
<B8x8mv>true</B8x8mv>
<I4x4mv>true</I4x4mv>
<I8x8mv>true</I8x8mv>
<P4x4mv>true</P4x4mv>
<AdaptiveDCT>true</AdaptiveDCT>
<SSIMCalculation>false</SSIMCalculation>
<Interlaced>false</Interlaced>
<Width>false</Width>
<Sar>false</Sar>
<aud>false</aud>
<nal-hrd>false</nal-hrd>
<pulldown>0</pulldown>
<aq-strength>false</aq-strength>
<aq-sensitivity>false</aq-sensitivity>
<deadzone-inter>false</deadzone-inter>
<deadzone-intra>false</deadzone-intra>
<fpel-cmp>false</fpel-cmp>
<me-prepass>false</me-prepass>
<pre-scenecut>true</pre-scenecut>
<psy-rd>true</psy-rd>
<QuantizerMatrix />
<QuantizerMatrixType>0</QuantizerMatrixType>
</Settings>
</VideoProfile>
However the Extreme profile didn't quite give the quality result I wanted so I have fiddled. the quality is better but the file size is 3x larger Extreme profile resulted in a 30mb file and my above profile 90mb file.
My changes were
<NbBframes>3</NbBframes>
<MinQuantizer>8</MinQuantizer>
<V4MV>true</V4MV>
<QPel>true</QPel>
<Trellis>1</Trellis>
<NbRefFrames>3</NbRefFrames>
<AlphaDeblock>0</AlphaDeblock>
<BetaDeblock>0</BetaDeblock>
<METype>1</METype>
<MERange>16</MERange>
<MinGOPSize>25</MinGOPSize>
<Profile>1</Profile>
<AdaptiveBFrames>1</AdaptiveBFrames>
<BFramePyramid>weight_b</BFramePyramid>
<I8x8mv>true</I8x8mv>
<psy-rd>false</psy-rd>
What would maxquantdelta do ?
Dark Shikari
13th September 2008, 01:01
So then lowering bitrate and QP_min would equal a smaller size file but would also decrease quality wouldn't they ? But you are saying as long as change isn't drastic it wouldn't effect quality greatly.Lowering QPmin will do basically nothing--but note that higher QP is lower quality, and lower QP is higher quality.
My changes were
<NbBframes>3</NbBframes>
<MinQuantizer>8</MinQuantizer>
<V4MV>true</V4MV>
<QPel>true</QPel>
<Trellis>1</Trellis>
<NbRefFrames>3</NbRefFrames>
<AlphaDeblock>0</AlphaDeblock>
<BetaDeblock>0</BetaDeblock>
<METype>1</METype>
<MERange>16</MERange>
<MinGOPSize>25</MinGOPSize>
<Profile>1</Profile>
<AdaptiveBFrames>1</AdaptiveBFrames>
<BFramePyramid>weight_b</BFramePyramid>
<I8x8mv>true</I8x8mv>
<psy-rd>false</psy-rd>
What would maxquantdelta do ?Some of those don't even apply to x264... like v4mv and qpel, which are both xvid options. If you want even higher quality, try psy-rd (not recommended for 2D animation).
flebber
13th September 2008, 14:51
okay I am geting there I know have a good quality and slightly lower file size, except now encoding is slow is that psy-rd slowing it down ?
<?xml version="1.0"?>
<VideoProfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>1P-HQ</Name>
<Settings xsi:type="x264Settings">
<EncodingMode>0</EncodingMode>
<BitrateQuantizer>1300</BitrateQuantizer>
<KeyframeInterval>250</KeyframeInterval>
<NbBframes>4</NbBframes>
<MinQuantizer>20</MinQuantizer>
<MaxQuantizer>51</MaxQuantizer>
<Turbo>true</Turbo>
<V4MV>false</V4MV>
<QPel>false</QPel>
<Trellis>false</Trellis>
<CreditsQuantizer>40</CreditsQuantizer>
<Logfile>.stats</Logfile>
<CustomEncoderOptions />
<FourCC>1</FourCC>
<Zones />
<MaxNumberOfPasses>3</MaxNumberOfPasses>
<NoDCTDecimate>false</NoDCTDecimate>
<PSNRCalculation>true</PSNRCalculation>
<noFastPSkip>false</noFastPSkip>
<NoiseReduction>0</NoiseReduction>
<MixedRefs>false</MixedRefs>
<X264Trellis>1</X264Trellis>
<NbRefFrames>6</NbRefFrames>
<AlphaDeblock>-1</AlphaDeblock>
<BetaDeblock>-1</BetaDeblock>
<SubPelRefinement>4</SubPelRefinement>
<MaxQuantDelta>4</MaxQuantDelta>
<TempQuantBlur>0</TempQuantBlur>
<BframePredictionMode>3</BframePredictionMode>
<VBVBufferSize>14000</VBVBufferSize>
<VBVMaxBitrate>25000</VBVMaxBitrate>
<METype>2</METype>
<MERange>32</MERange>
<MinGOPSize>25</MinGOPSize>
<Profile>1</Profile>
<Level>4.1</Level>
<IPFactor>1.4</IPFactor>
<PBFactor>1.3</PBFactor>
<ChromaQPOffset>0</ChromaQPOffset>
<VBVInitialBuffer>0.9</VBVInitialBuffer>
<BitrateVariance>1.0</BitrateVariance>
<QuantCompression>0.6</QuantCompression>
<TempComplexityBlur>20</TempComplexityBlur>
<TempQuanBlurCC>0.5</TempQuanBlurCC>
<SCDSensitivity>40</SCDSensitivity>
<BframeBias>0</BframeBias>
<Deblock>true</Deblock>
<Cabac>true</Cabac>
<WeightedBPrediction>true</WeightedBPrediction>
<AdaptiveBFrames>1</AdaptiveBFrames>
<BFramePyramid>weight_b</BFramePyramid>
<BRDO>true</BRDO>
<biME>false</biME>
<ChromaME>true</ChromaME>
<P8x8mv>true</P8x8mv>
<B8x8mv>true</B8x8mv>
<I4x4mv>false</I4x4mv>
<I8x8mv>true</I8x8mv>
<P4x4mv>false</P4x4mv>
<AdaptiveDCT>true</AdaptiveDCT>
<Interlaced>false</Interlaced>
<SSIMCalculation>false</SSIMCalculation>
<Width>false</Width>
<Sar>false</Sar>
<aud>false</aud>
<nal-hrd>false</nal-hrd>
<pulldown>0</pulldown>
<aq-strength>false</aq-strength>
<aq-sensitivity>false</aq-sensitivity>
<deadzone-inter>false</deadzone-inter>
<deadzone-intra>false</deadzone-intra>
<fpel-cmp>false</fpel-cmp>
<pre-scenecut>false</pre-scenecut>
<psy-rd>true</psy-rd>
<me-prepass>false</me-prepass>
<QuantizerMatrix />
<QuantizerMatrixType>0</QuantizerMatrixType>
</Settings>
</VideoProfile>
Apologies I found the answer in the link of your signature.
Thus, it strongly biases against blurring, and for that matter, any significant loss of detail. Even on non-grainy sources, this generally results in a reduction of banding, increased sharpness, and better retention of fine details. The speed cost is relatively low, though Psy RDO requires regular RD to be enabled.
Anything special need to be done to enable regular RD ?
Dark Shikari
13th September 2008, 20:36
Now you've disabled i4x4, a really bad idea... it would be much better if you were dealing with a commandline instead of a completely unreadable XML file :p
flebber
14th September 2008, 03:13
CRF encoding X264: C:\Rip\exe\encoder\x264.exe --pass 1 --crf 19 --stats "C:\Rip\Video\temp\.stats" --progress --keyint 250 --bframes 4 --qpmin 16 --qpmax 51 --no-psnr --mixed-refs --trellis 1 --ref 8 --filter -1,-1 --subme 8 --direct auto --vbv-maxrate 25000 --me umh --psy-rd 1.000 --no-ssim --level 4.1 --weightb --b-rdo --bime --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --threads auto --thread-input --aq-mode 2 --aq-strength 1.00 --sar 6666667:10000000 --output "C:\Rip\Video\temp\resmovie.mp4" "C:\Rip\Video\temp\resmovie.avs"
ABR encoding X264: C:\Rip\exe\encoder\x264.exe --bitrate 964407 --progress --keyint 250 --bframes 4 --qpmin 16 --qpmax 51 --no-psnr --mixed-refs --trellis 1 --ref 8 --filter -1,-1 --subme 8 --direct auto --vbv-maxrate 25000 --me umh --psy-rd 1.000 --no-ssim --level 4.1 --weightb --b-rdo --bime --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --threads auto --thread-input --aq-mode 2 --aq-strength 1.00 --sar 6666667:10000000 --output "C:\Rip\Video\temp\movie.264" "C:\Rip\Video\temp\movie.avs"
No problems at all.
Dark Shikari
14th September 2008, 03:22
CRF encoding X264: C:\Rip\exe\encoder\x264.exe --pass 1 --crf 19 --stats "C:\Rip\Video\temp\.stats" --progress --keyint 250 --bframes 4 --qpmin 16 --qpmax 51 --no-psnr --mixed-refs --trellis 1 --ref 8 --filter -1,-1 --subme 8 --direct auto --vbv-maxrate 25000 --me umh --psy-rd 1.000 --no-ssim --level 4.1 --weightb --b-rdo --bime --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --threads auto --thread-input --aq-mode 2 --aq-strength 1.00 --sar 6666667:10000000 --output "C:\Rip\Video\temp\resmovie.mp4" "C:\Rip\Video\temp\resmovie.avs"
Quote:
ABR encoding X264: C:\Rip\exe\encoder\x264.exe --bitrate 964407 --progress --keyint 250 --bframes 4 --qpmin 16 --qpmax 51 --no-psnr --mixed-refs --trellis 1 --ref 8 --filter -1,-1 --subme 8 --direct auto --vbv-maxrate 25000 --me umh --psy-rd 1.000 --no-ssim --level 4.1 --weightb --b-rdo --bime --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --threads auto --thread-input --aq-mode 2 --aq-strength 1.00 --sar 6666667:10000000 --output "C:\Rip\Video\temp\movie.264" "C:\Rip\Video\temp\movie.avs"Don't mess with qpmin/qpmax without good reason.
Subme 8 doesn't exist, the max is 7.
Thread-input is implied by --threads auto.
AQ-mode 2 is the default, you don't need to specify it. Same with --psy-rd 1.0, your partitions line, your aq-strength line, and your keyint line.
Bitrate is specified in kilobits, not bits. 964407 is ridiculously high; 964 megabits per second.
J_Darnley
14th September 2008, 12:07
--sar 6666667:10000000
What sample aspect ratio is that supposed to be? That is not close to any of the four I am familiar with.
[EDIT] Oh I see that you are having more problems than your post implies: http://forum.doom9.org/showthread.php?p=1183381#post1183381
flebber
14th September 2008, 13:38
What sample aspect ratio is that supposed to be? That is not close to any of the four I am familiar with.
[EDIT] Oh I see that you are having more problems than your post implies: http://forum.doom9.org/showthread.php?p=1183381#post1183381
Yeah the sar is determined by the Automkv script.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.