[x264-devel] Question about changing x.264 bitrate on the fly

Mark Sauer mark at skitter.tv
Tue Mar 3 01:25:31 CET 2009


I am looking at creating an application of x.264, but I would like to be 
able to specify the bit rate of different sections of the video sequence. 

IE, I'd like to be able to say

frames 1-300 are at 600 kbps
frames 301-450 are at 1200 kbps
frames 451-900 are at 900 kbps

and so on.  I noticed there is an interface to the library 
"x264_encoder_reconfig", but the body doesn't seem to allow for changes 
to the bitrate.

Would it be safe to do something like:

x264_encoder_open( set bitrate to 600 );

for(i=0;i<300;i++) {
   x264_encoder_encode( frame i );
   store the nal blocks in a file, etc
}

x264_encoder_close();
x264_encoder_open( set bitrate to 1200 );

for(i=300;i<450;i++) {
   x264_encoder_encode( frame i );
   store the nal blocks in a file, etc
}

x264_encoder_close();
x264_encoder_open( set bitrate to 900 );

for(i=451;i<900;i++) {
   x264_encoder_encode( frame i );
   store the nal blocks in a file, etc
}

x264_encoder_close();

Or would there possibly be some issues with this approach? 

Thanks
Mark Sauer


More information about the x264-devel mailing list