一、实验目的
1、将自行选择或老师给的两个264文件进行解码,得到相应的YUV文件
2、将上述两个视频序列编码为.264文件
- 固定码率,以不同的GOP长度及形状编码
GOP=15,2B帧;GOP=12,2B帧,GOP=9,2B帧
GOP=4,1B帧;GOP=12,无B帧;GOP=1,全I帧 - 相同的GOP长度及形状,不同的码率
例:1000kb/s, 800kb/s,400kb/s,…
3、用码流分析软件检查所生成的码流中各种编码模式和运动矢量等信息
4、用播放器观看所生成码流的质量
5、生成率失真曲线
二、实验过程
1、对highway_qcif.264和test.264进行解码,以得到yuv文件
decoder.cfg修改为:
得到输出图像:
2、将YUV文件编码为264文件。
以GOP=15,无B帧,码率=1Kbps为例,修改encoder.cfg如下:
InputFile = "highway_qcif_dec.yuv" # Input sequence
InputHeaderLength = 0 # If the inputfile has a header, state it's length in byte here
StartFrame = 0 # Start frame for encoding. (0-N)
FramesToBeEncoded = 60 # Number of frames to be coded
...
OutputFile = "highway_qcif_GOP15_2B_1k.264" # Bitstream
IntraPeriod = 15 # Period of I-pictures (0=only first)
NumberBFrames = 0 # Number of B coded frames inserted (0=not used)
...
HierarchicalCoding = 0 # B hierarchical coding (0= off, 1= 2 layers, 2= 2 full hierarchy, 3 = explicit)
RateControlEnable = 1 # 0 Disable, 1 Enable
Bitrate = 1000000 # Bitrate(bps)
SourceWidth = 176 # Source frame width
SourceHeight = 144 # Source frame height
SourceResize = 0 # Resize source size for output
OutputWidth = 176 # Output frame width
OutputHeight = 144 # Output frame height
得到输出:
在码流分析软件中验证,无B帧;
固定GOP,改变码率:
当GOP=15 2B帧,比特率=100Kbps时:
在码流分析软件中验证:
当GOP=15 2B帧,比特率=400Kbps时:
当GOP=15 2B帧,比特率=800Kbps时:
当GOP=15 2B帧,比特率=1200Kbps时:
得到表格:
以比特率为横坐标,以PSNR为纵坐标,生成率失真曲线:
综上:随着比特率的升高,编码后的图像质量也有所提升。
固定码率400Kbps,改变GOP:
当GOP=12 2B帧,比特率=400Kbps时:
当GOP=9 2B帧,比特率=400Kbps时:
GOP=4,1B帧,比特率=400Kbps时:
GOP=12,无B帧,比特率=400Kbps时:
GOP=1,全I帧,比特率=400Kbps时:
在码流分析软件中验证:
综上:
得到视频质量:GOP=12,无B帧 > GOP=15,2B帧 > GOP=12,2B帧 > GOP=4,1B帧 >GOP=9,2B帧 > GOP=1,全I帧。