一、实验要求
自行选择或老师给的两个264文件进行解码,得到相应的YUV文件
将上述两个视频序列编码为.264文件
1、固定码率,以不同的GOP长度及形状编码
■GOP=15,2B帧; GOP=12,2B帧, GOP=9,2B帧
■GOP=4, 1B帧; GOP=12,无B帧; GOP=1,全I帧
2、相同的GOP长度及形状,不同的码率
例:1000kb/s, 800kb/s,400kb/s。
用码流分析软件检查所生成的码流中各种编码模式和运动矢量等信息
用播放器观看所生成码流的质量
生成率失真曲线
二、实验过程
1、将.264文件转换成yuv文件
2、将yuv文件编码为.264文件
InputFile = "highway_qcif_dec.yuv" # Input sequence
...
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
...
TraceFile = "trace_enc.txt" # Trace file
ReconFile = "test_rec.yuv" # Reconstruction YUV file
OutputFile = "highway_out1.264" # Bitstream
...
IntraPeriod = 15 # Period of I-pictures (0=only first)
...
##########################################################################################
# B Slices
##########################################################################################
NumberBFrames = 2 # Number of B coded frames inserted (0=not used)3
;
//3)GOP长度和形状一定,修改码率的值//
RateControlEnable = 1 # 0 Disable, 1 Enable
Bitrate = 400 # Bitrate(bps)
运行结果
在这里插入图片描述
GOP=12,2B帧,GOP=9,2B帧,GOP=4,1B帧;GOP=12,无B帧;GOP=1,全I帧,修改IDRPeriod、NumberBFrames、RCUpdateMode
(3)率失真曲线
实验结论
从上图可知,当有相同的GOP长度及形状时,码率越小,YPSN越小,视频质量越差。