x265

关于x265编码使用CBR流控码率不达标问题的处理

之前在使用x264编码时所谓的CBR流控其实是通过abr流控+vbv码率、缓冲参数设置的(vbv-maxrate,vbv-bufsize,也可以是ffmpeg的minrate,maxrate,如“ffmpeg -re -stream_loop -1 -i test.mp4 -c:v libx264 -x264-params “nal-hrd=cbr:force-cfr=1” -b:v 4M -minrate 4M -maxrate 4M -bufsize 1M -f flv rtmp://127.0.0.1/live/test,即控制了波动范围的vbr,而到了x265编码时,发现如法炮制的参数并不好使了,码率还是会有较大范围的波动,最后搜索研究了很久后发现,原来x265有这么个参数:

–[no-]strict-cbr Enable stricter conditions and tolerance for bitrate deviations in CBR mode. Default %s\n”, OPT(param->rc.bStrictCbr));

实测加上这个参数后,编码输出码率几乎就是目标码率很小范围内波动了,ffmpeg命令如下:

ffmpeg -re -stream_loop -1 -i <input> -c:v libx265 -b:v 25M -muxrate 30M -x265-params strict-cbr=1:vbv-bufsize=25000:vbv-maxrate=25000 -c:a aac -ac 2 -b:a 128k -f mpegts udp://239.3.3.3:5000

关于x265的high-tier启用问题

最近研究x265编码时如何启用high profile(后来才了解到对x265来说应该是high tier),之前接触x264的时候了解到的是直接在编码指定profile时就会有main和high的profile之分,如main、high、high10、high422等,但到了x265时却发现可指定的profile只有这么几个:

static const char * const x265_profile_names[] = {
    /* HEVC v1 */
    "main", "main10", "mainstillpicture", /* alias */ "msp",

    /* HEVC v2 (Range Extensions) */
    "main-intra", "main10-intra",
    "main444-8",  "main444-intra", "main444-stillpicture",

    "main422-10", "main422-10-intra",
    "main444-10", "main444-10-intra",

    "main12",     "main12-intra",
    "main422-12", "main422-12-intra",
    "main444-12", "main444-12-intra",

    "main444-16-intra", "main444-16-stillpicture", /* Not Supported! */
    0
};

并没有像x264的各种high,后经研究发现x265的high profile是通过另一个参数:“high-tier”来控制的,于是用ffmpeg命令行作了如下测试:

Continue reading…