数据压缩(十五)——H.264编码

一、H.264编码实验

1.1 H.264文件解码得到YUV文件

1. 将MP4格式文件转成264文件
  MP4to264
2. 将264文件进行解码得到YUV文件
  修改decoder.cfg文件中的输入文件和输出文件。

InputFile             = "mov.264"       # H.264/AVC coded bitstream
OutputFile            = "mov.yuv"   # Output file, YUV/RGB

3. 实验结果
  MP4和yuv截取的帧并不是同一帧。命令行代码为ldecod.exe -d decoder.cfg

mov.mp4 mov.yuv trailer.mp4 trailer.yuv
在这里插入图片描述 在这里插入图片描述 在这里插入图片描述 在这里插入图片描述

1.1 YUV文件编码得到H.264文件(GOP=15,2B)

  以上文中生成的mov.yuv作为实验材料。命令行代码为lencod.exe -d encoder.cfg
  修改配置文件修改encoder.cfg。

...
##########################################################################################
# Files
##########################################################################################
InputFile             = "mov.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           = 320    # Source frame width
SourceHeight          = 176    # Source frame height
SourceResize          = 0      # Resize source size for output
OutputWidth           = 320    # Output frame width
OutputHeight          = 176    # Output frame height
...
ReconFile             = "mov_test1_rec.yuv"       # Reconstruction YUV file
OutputFile            = "mov_test1.264"           # Bitstream
##########################################################################################
# Encoder Control
##########################################################################################
...
IntraPeriod           = 15   # Period of I-pictures   (0=only first)
...
##########################################################################################
# B Slices
##########################################################################################
NumberBFrames          = 2  # 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,
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值