作业|H.264编码实验

一、实验要求

  • 将自行选择或老师给的两个264文件进行解码,得到相应的YUV文件
  • 将上述两个视频序列编码为.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,…
    
  • 用码流分析软件检查所生成的码流中各种编码模式和运动矢量等信息
  • 用播放器观看所生成码流的质量
  • 生成率失真曲线

二、实验内容

1、解码264文件,得到相应的YUV文件

修改ldecod方案中的decoder.cfg文件中的参数

InputFile             = "demo.264"       # H.264/AVC coded bitstream
OutputFile            = "demo.yuv"   # Output file, YUV/RGB
RefFile               = "demo_rec.yuv"   # Ref sequence (for SNR)
SourceWidth           = 854    # Source frame width
SourceHeight          = 480    # Source frame height
SourceResize          = 0      # Resize source size for output
OutputWidth           = 854    # Output frame width
OutputHeight          = 480    # Output frame height

运行程序,得到结果如下图
在这里插入图片描述
在这里插入图片描述

2、将上述两个视频序列编码为.264文件

1.固定码率,以不同的GOP长度及形状编码

(1)GOP=15,2B帧

修改encoder.cfg的下列信息:

FramesToBeEncoded     = 60 
IntraPeriod           = 15   # Period of I-pictures   (0=only first)
NumberBFrames          = 2  # Number of B coded frames inserted (0=not used)
HierarchicalCoding      =  0 
OutputFile            = "!out_demo.264"           # Bitstream
InputFile             = "!demo.yuv"       # Input sequence
SourceWidth           = 854    # Source frame width
SourceHeight          = 480    # Source frame height
SourceResize          = 0      # Resize source size for output
OutputWidth           = 854    # Output frame width
OutputHeight          = 480    # Output frame height

运行程序得到如下结果
在这里插入图片描述
Elecard StreamEye Tools进行验证:
在这里插入图片描述
可以发现IBBPBBPBBPBBPBBP为一个GOP

(2)GOP=1,全I帧
#########################################################################################
InputFile             = "demo.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     = 30      # Number of frames to be coded
...
SourceWidth           = 854    # Source frame width
SourceHeight          = 480    # Source frame height
SourceResize          = 0      # Resize source size for output
OutputWidth           = 854    # Output frame width
OutputHeight          = 480    # Output frame height
...
ReconFile             = "test_rec.yuv"       # Reconstruction YUV file
OutputFile            = "demo3.264"           # Bitstream
#########################################################################################
# Encoder Control
#########################################################################################
...
IntraPeriod           = 1   # Period of I-pictures   (0=only first)
...
#########################################################################################
# B Slices
#########################################################################################
NumberBFrames          = 0  # Number of B coded frames inserted (0=not 
disable, N <= NumberReferenceFrames)
...
HierarchicalCoding      =  0  # B hierarchical coding (0= off, 1= 2 layers, 2= 2 full hierarchy, 3 = explicit)
...

得到结果
在这里插入图片描述

2.相同的GOP长度及形状,不同的码率

GOP=15,2B帧,修改码率

增加调节以下参数

RateControlEnable       = 1     # 0 Disable, 1 Enable
Bitrate                 = 1000000 # Bitrate(bps)

3、用码流分析软件检查所生成的码流中各种信息

使用H264Visa进行分析:在这里插入图片描述

在这里插入图片描述

4、生成率失真曲线

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值