x265探索与研究(四):如何编码视频?

如何编码视频?

 

        本文介绍x265中的两种编码视频方法,一是采用命令行的方法;二是GUI的方式。

 

1命令行的方法

 

(1)、第一种方式生成*.265格式的视频文件

 

        第一种方式可以生成*.265格式的视频文件,对应的命令为:

x265 --input-res 352x288 --fps 30 hall_cif_352x288_300.yuv -o hall_cif_352x288_300.h265

 

2)、第二种方式可以生成*.bin格式的视频流文件

 

        第二种方式可以生成*.bin格式的视频流文件,对应的命令为:

x265.exe --preset fast --input hall_cif_352x288_300.yuv --fps 30 --input-res 352x288 --output out.bin --psnr --ssim --bitrate 128

 

两种方式生成的对应文件如下图所示:



        除了这两种经测试可以使用的方式外,网址:http://x265.ru/en/encode/还提供了两种略有区别的命令行方式,如下图所示:


(3)、第三种命令行的方式,可以生成*.x265*.csv

 

        下面对其进行测试,第三种命令行的方式,可以生成*.x265*.csv对应的命令为:

x265.exe hall_cif_352x288_300.yuv --input-res 352x288 --fps 30 -o out.x265 --csv results.csv --no-rect --max-merge 3 --rd 0 --tu-intra-depth 2 --tu-inter-depth 1 --no-tskip --frame-threads 2

 

        需要注意的是:该方式输入的视频必须是YUVY4M格式,帧的宽和高也必须指定且FPS也必须设定。测试过程如下图:


        测试结果如下图:


(4)、第四种命令行方式输出是*.hevc格式

 

        该命令行的方式,输入是*.y4m的视频,可以获得高质量的*.hevc格式视频,对应的命令为:

x265.exe hall_cif_352x288_300.y4m --q 17 --merange 64 --frames all --ref 4 --max-merge 3 --rect-hash 2 --me 3 --b 6 --b-adapt 1 --rd 2 --rc-lookahead 60 --input-depth 16 --tu-inter-depth 3 --tu-intra-depth 3 --no-tskip-fast --wpp --subme 2 --s 32 --F 6 -o video.hevc

 

(注:由于我这边没有*.y4m格式视频,故没有测试,后续测试,补充在此。


2GUI的方法

 

        采用“Baka Encoder”,下载网址:http://x265.ru/en/baka-encoder/



配置方式是修改Baka Encoder.config.xml,对应的代码如下所示:

<?xml version="1.0" encoding="utf-8"?>
<!-- Baka Encoder configuration file reference can be found at http://vtt.to/baka%20encoder%20configuration%20reference -->
<baka_encoder logging="0">
	<presets>
		<preset name="preview" suffix="_preview" on="1">
			<hint quality="7" compression="14" speed="6" streaming="1"/>
			<audio cmd="-br 60000"/>
			<video tool="x264" bit_depth="8" pass_count="2" max_width="480" max_height="360" resize_method="spline" base_bitrate="0" max_bitrate="0"
				cmd="--preset placebo --no-mbtree --ratetol 100.0 --keyint 60 --ref 3 --bitrate 500 --level 4.1 --vbv-bufsize 50000 --vbv-maxrate 62500"/>
			<muxing container="mp4" cmd=" --optimize-pd"/>
		</preset>
		<preset name="normal" suffix="_normal" on="1">
			<hint quality="11" compression="9" speed="3" streaming="1"/>
			<audio cmd="-q 0.6"/>
			<video tool="x264" bit_depth="8" pass_count="2" max_width="1280" max_height="960" resize_method="spline" base_bitrate="1500" max_bitrate="3500"
				cmd="--preset placebo --no-mbtree --ratetol 100.0 --keyint 60 --ref 4 --level 4.1 --vbv-bufsize 50000 --vbv-maxrate 62500"/>
			<muxing container="mp4" cmd=" --optimize-pd"/>
		</preset>
		<preset name="normal h265" suffix="_normal.h265" on="1">
			<hint quality="12" compression="9" speed="1" streaming="0"/>
			<audio cmd="-q 0.6"/>
			<video tool="x265" bit_depth="8" pass_count="2" max_width="1280" max_height="960" resize_method="spline" base_bitrate="1200" max_bitrate="10000"
				cmd="--preset slow --bframes 4 --ref 4"/>
			<muxing container="mp4" cmd=""/>
		</preset>
		<preset name="deluxe" suffix="_deluxe" on="0">
			<hint quality="14" compression="5" speed="4" streaming="0"/>
			<audio cmd="-q 1.0"/>
			<video tool="x264" bit_depth="10" pass_count="1" max_width="0" max_height="0" resize_method="" base_bitrate="0" max_bitrate="0"
				cmd="--crf 12 --preset placebo --no-mbtree --deblock 0:-1"/>
			<muxing container="mp4" cmd=""/>
		</preset>
		<preset name="deluxe h265" suffix="_deluxe.h265" on="0">
			<hint quality="15" compression="7" speed="1" streaming="0"/>
			<audio cmd="-q 1.0"/>
			<video tool="x265" bit_depth="10" pass_count="1" max_width="0" max_height="0" resize_method="" base_bitrate="0" max_bitrate="0"
				cmd="--crf 12 --preset slow"/>
			<muxing container="mp4" cmd=""/>
		</preset>
		<preset name="express" suffix="_express" on="0">
			<hint quality="7" compression="7" speed="10" streaming="0"/>
			<audio cmd="-q 0.5"/>
			<video tool="x264" bit_depth="8" pass_count="1" max_width="0" max_height="0" resize_method="" base_bitrate="1500" max_bitrate="5000"
				cmd="--preset fast --deblock 1:0 --bframes 4 --b-adapt 1 --rc-lookahead 36 --ref 3 --level 4.1 --vbv-bufsize 50000 --vbv-maxrate 62500"/>
			<muxing container="mp4" cmd=""/>
		</preset>
		<preset name="lossless" suffix="_lossless" on="0" console="0">
			<hint quality="16" compression="3" speed="8" streaming="0"/>
			<audio cmd="-q 1.0"/>
			<video tool="x264" bit_depth="8" pass_count="1" max_width="0" max_height="0" resize_method="spline" base_bitrate="0" max_bitrate="0"
				cmd="--crf 0 --preset placebo --log-level none --quiet"/>
			<muxing container="mp4" cmd=""/>
		</preset>
	</presets>
</baka_encoder>

大笑


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Open Source (GPL) H.265/HEVC video encoder 下载网址:https://bitbucket.org/multicoreware/x265/src x265 developer wiki To compile x265 you must first install Mercurial (or TortoiseHg on Windows) and CMake. Then follow these easy steps: (for the most definitive instructions, consult our build README) Linux Instructions # ubuntu packages: $ sudo apt-get install mercurial cmake cmake-curses-gui build-essential yasm # Note: if the packaged yasm is older than 1.2, you must download yasm-1.2 and build it $ hg clone https://bitbucket.org/multicoreware/x265 $ cd x265/build/linux $ ./make-Makefiles.bash $ make Windows (Visual Studio) Instructions $ hg clone https://bitbucket.org/multicoreware/x265 Then run make-solutions.bat in the build\ folder that corresponds to your favorite compiler, configure your build options, click 'configure', click 'generate', then close cmake-gui. You will be rewarded with an x265.sln file. Also see cmake documentation. Intel Compiler Instructions On Windows, you should open an Intel Compiler command prompt and within it run one of the make-makefiles.bat scripts in build/icl32 or build/icl64, then run nmake. On Linux, you can tell cmake to build Makefiles for icpc directly. This requires you to have configured Intel's compiler environment (by sourcing the appropriate shell script). For example: $ source /opt/intel/composer_xe_2013/bin/compilervars.sh intel64 $ cd repos/x265/build/linux $ export CXX=icpc $ export CC=icc $ ./make-Makefiles $ make Command line interface The Makefile/solution builds a static encoder.lib library and a standalone x265 executable that aims to be similar to x264 in its command line interface. Running without arguments shows you the command line help. Info Mission Statement Road Map TODO HOWTO add a new encoder performance primitive HOWTO Contribute patches to x265 HOWTO cross compile from Linux to Windows Coding Style Helpful links

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值