[jitsi-dev] H264 bugs and (possible) fixes



I've been using Jitsi for some time and have to say that it works very
well. One thing though is that when using H264, bitrate is not
respected. I had a look at JNIEncoder and found some problems:

- bitrate is fixed at 128000
- bitrate_tolerance is set which is useless for x264
- quantizer is set so CBR is not respected
- camera fps is not returned (from v4l2 and directshow) and framerate is
set to 15, however most cameras are at 30fps by default

Here is a patch that makes use of CRF that I find really efficient. It
removes qcompress, bitrate, bitrate_tolerance and defines crf and
buffer_size (vbv-bufsize). It also gets user defined bitrate and set
default framerate at 30.

Next thing is intra-refresh has changed in recent versions of ffmpeg, it
has to be defined in x264 private options (add "intra-refresh", "1").

Last thing is FFmpeg.CODEC_FLAG_LOOP_FILTER flag is, from what I
understand, to enable the loop filter. However, "ultrafast" preset
disables it. I think setting "deblock" at "0:0" enables it again but may
have an effect on sliced threads (I have to check).

Best regards,

h264-crf.patch (2.96 KB)