[x264-devel] one question about two-pass rate control

qw applemax82 at 163.com
Thu May 12 07:55:33 CEST 2016


Hi Simon,


I want to select the two-pass rate control method, which can hit exact file size. But I'm satisfied with the redundancy incurred by encoding video sequence twice.

i'm reading x264 source code, and want to change the algorithm of two-pass rate control. But I haven't followed the x264 update for long time, and need some person's advice. Is it possible to change rc algorithm so that video sequence is encoded once with two-pass option and without obvious deviation of file size?


Thanks!

Andrew



At 2016-05-12 11:59:33, "Simon Horlick" <simonhorlick at gmail.com> wrote:

Hi Andrew,


x264 adopts several rate control methods, one of which is of two pass. For 1st pass, x264 encoder will generate two files, i.e. rate control file and mb tree file. For 2nd pass, x264 encoder will read the two files, and estimate qp value to encode each frame.

It's redundant to encode video sequence twice, one for each pass. Is it possible to encode video sequence once without making big change into rate control algorithm?



Perhaps consult the documentation before posting here? x264 supports constant quality mode, constant quantiser and constant bitrate:


From x264 --help:


Ratecontrol:


  -B, --bitrate <integer>     Set bitrate (kbit/s)
      --crf <float>           Quality-based VBR (0-51) [23.0]
      --vbv-maxrate <integer> Max local bitrate (kbit/s) [0]
      --vbv-bufsize <integer> Set size of the VBV buffer (kbit) [0]
  -p, --pass <integer>        Enable multipass ratecontrol
                                  - 1: First pass, creates stats file
                                  - 2: Last pass, does not overwrite stats file


If you aren’t bothered about hitting an exact file size then there is no need to use two-pass encoding.


For example, the default is --crf 23, which aims to keep constant quality and bitrate depends only on the complexity of the source material. This is done in a single pass.


Regards,


Simon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20160512/f932c162/attachment.html>


More information about the x264-devel mailing list