I'm trying to get lowest file size with specified CRF value in x264 ( I know CRF is quality mode and 2-pass is for file size so please don't......)
Which parameters should i play with to get high compression rate/low file size?
+ Reply to Thread
Results 1 to 11 of 11
If you raise the RF value, you will get a smaller file, but also lose more quality. Find your personal threshold when the loss gets obvious enough to be annoying.
Most other parameters will have rather little impact on the encoding efficiency, compared to the impact of the target RF. More elaborate presets may improve the compression (not guaranteed), but will increase the required encoding time (quite certainly).
To improve the compressibility, you may have to consider some pre-filtering of the video as well (e.g. denoising, and if you had to scale the video, possibly use a not too sharp kernel).
Last edited by ben45; 24th Aug 2016 at 04:10.
The encoding mode "CRF" = "Constant Rate Factor" emphasizes that the RF = Rate Factor (the value inside the encoding algorithm to be measured) will be rather constant during the whole movie, as long as there are no other constraints.
Command line option --crf 23 means: Encoding mode "constant rate factor" with a target rate factor value of 23.
Try playing with the settings a bit. If you use a slower preset (e.g. --preset veryslow) compression efficiency will be increased in return for longer encoding time. But there is a limit to how far you can improve this way. Don't try to manually fiddle with e.g. bframe number, you will not make good use of time that way.
Here's x264's log
---[Information] [8/24/2016 2:18:48 AM] x264 [info]: consecutive B-frames: 1.6% 2.4% 7.6% 88.4% ---[Information] [8/24/2016 2:18:48 AM] x264 [info]: Weighted P-Frames: Y:0.9% UV:0.3% ---[Information] [8/24/2016 2:18:48 AM] x264 [info]: ref P L0: 55.7% 7.9% 17.0% 5.1% 4.6% 3.9% 3.9% 1.8% 0.2% 0.0% ---[Information] [8/24/2016 2:18:48 AM] x264 [info]: ref B L0: 74.0% 12.5% 7.1% 2.4% 1.8% 1.4% 0.8% ---[Information] [8/24/2016 2:18:48 AM] x264 [info]: ref B L1: 93.6% 6.4%
Correctly i use 3 b-frames
If there was a way to set it, it would be a choice among these presets:
ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
If you could find setting that is acceptable for playback that gives no issues on any device, except placebo (max number of reference frames) or veryslow (higher ref frame number etc.) The authors would create such a setting for sure, why would they hide it. If encoding time is no problem, choose veryslow. You might set --ref 4 manually as well, because veryslow might crank it up outside of specs, not sure now.
some ideas encoding CRF (getting rid of 2pass setting thinking)
1) You might improve some details but it depends on actual video. Pro's use zones on discs, so that what you'd need to do as well. To encode different parts of video with different setting, like in your case lowering CRF for scenes that gives you trouble. You cannot have miraculous setting for a lengthy video with different scenes. If that was true Pro's would use it as well, but they don't. That takes time though. But you can do it beforehand actually, using zones for some computer graphic parts or low light scenes or parts with gradients in your video.
--crf 18 --preset slow --tune film --zones 3000,4000,crf=14
where frames 3000 to 4000 get crf 14 instead of 18
2) use very low CRF but cut peaks. This is good for internet streaming encoding, using low bitrates, but you can use it anyway if for some reason saving bitrate:
--crf 16 --ref 3 --vbv-bufsize 2000 --vbv-maxrate 2000
this will boost bitrate for low light scenes, scenes with gradients to avoid banding etc. but it will not produce bitrates higher than about 2300kbps or so. So downside for this method is, that for very bitrate demanding scenes your bitrate might get cut off or that cut offs are present almost all the time, but that quality is satisfactory for you, considering bitrate. So you might check videos a bit beforehand if those cut offs are not visible or that it is satisfactory.
Last edited by _Al_; 24th Aug 2016 at 09:52.
Yes, since you're only using 3 b-frames using more b-frames will reduce the file size a bit. You will lose compatibility with some players if you use too many.
Not really sure what you mean here.
A VBV maximum bitrate is not equal to an absolute bitrate limit. Don't underestimate modern encoders, test before you blame.