x265支持hdr10编码

问题

编译过x265和ffmpeg之后,用以下命令对hdr10编码:

ffmpeg -i input.mp4 -c:v libx265 -x265-params "hrd=1:aud=1:no-info=1:sar='1:1':colorprim='bt2020':transfer='smpte2084':colormatrix='bt2020nc':master-display='G(8500,39850)B(6500,2300)R(35400,14600)WP(15635,16450)L(0,0)':max-cll='0,0':no-open-gop=1:qp=12:bframes=3" -pix_fmt yuv420p10le enc.mp4

查看得到的视频,发现pix_fmt并不是yuv420p10le而是yuv420p的

解决

查看ffmpeg编码log发现:

Incompatible pixel format 'yuv420p10le' for codec 'libx265', auto-selecting format 'yuv420p'

google发现x265在编译时,默认是不开启10bit的,需要将x265/source/CMakeLists.txt的

option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" OFF)

修改为

option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" ON)

然后重新

cd x265/build;cmake ../source;make -j8;make install

注意在重新编译前需要把build里的CMakeCache.txt删掉

编译成功后使用以下命令验证是否成功:

x265 --help |grep 'x265 [info]'

如果显示如下说明支持10bit了:

x265 [info]: HEVC encoder version 3.4+2-73ca1d7be377
x265 [info]: build info [Linux][GCC 4.8.5][64 bit] 10bit

猜你喜欢

转载自blog.csdn.net/BigerBang/article/details/106648999