关于x265的high-tier启用问题

最近研究x265编码时如何启用high profile(后来才了解到对x265来说应该是high tier),之前接触x264的时候了解到的是直接在编码指定profile时就会有main和highprofile之分,如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命令行作了如下测试:

ffmpeg.exe -i test_rot.mp4 -c:v hevc -profile:v main -preset veryfast -bitrate 20000 -c:a:0 copy -f mp4 ./ttt.mp4

profile指了main,码率指定了20M,外带了个快点的preset,可以看到输出为main level4的视频码流,接下来:

ffmpeg.exe -i test_rot.mp4 -c:v hevc -x265-params vbv-maxrate=20000:vbv-buffersize=20000 -profile:v main -preset veryfast -bitrate 20000 -c:a:0 copy -f mp4 ./ttt.mp4

这次加上了vbv,可以看到自动变成了high level4,那么配合上no-high-tier=1(等价于high-tier=0):

ffmpeg.exe -i test_rot.mp4 -c:v hevc -x265-params no-high-tier=1:vbv-maxrate=20000:vbv-buffersize=20000 -profile:v main -preset veryfast -bitrate 20000 -c:a:0 copy -f mp4 ./ttt.mp4

可以看到,这次的输出变成了main level4.1!研究了下high-tier参数的说明,发现其实这个参数配合vbv会根据码率、profile选择合适的level和high-tier,当然,如果指定了level-idc的话,会额外再加上一级条件,最后,关于level,profile,bitrate的对照关系,可以参考这里:

https://en.wikipedia.org/wiki/High_Efficiency_Video_Coding_tiers_and_levels

博主友情提示:

如您在评论中需要提及如QQ号、电子邮件地址或其他隐私敏感信息,欢迎使用>>博主专用加密工具v3<<处理后发布,原文只有博主可以看到。