A311D芯片集成了一个H.264/H.265 encoder,可以配置它的bit rate,frame rate等参数。
按照下面的步骤来实现你的第一个h264 encoder:
1) 请参考文章:开发环境准备
2)h264 encode的示例程序在目录 encoder下面
cd encoder/src
make
<正常编译后,会生成可执行文件:test_h264encode>
scp test_h264encode root@<xhiviai board ip address>
在板子侧执行:chmod +x test_h264encode
3) 压缩输入的yuv文件成h264的流
你可以下载example yuv文件来快速测试一下encoder功能
链接: https://pan.baidu.com/s/11Mpkm7froo6z8YLlQ4mUsg
提取码: ttrj
执行如下命令:
test_h264encode /tmp/1080p.yuv /var/1080p.h264 1920 1080 10 30 2000000 100
4)命令的详细格式如下:
./test_h264encode srcfile outfile width height gop framerate bitrate num fmt
Parameter Description:
srcfile: source yuv data url
outfile: encoded h264 stream url
width: source yuv width
height: source yuv height
gop: I frame refresh interval(N=0: only one I frame; N>0: one I frame per N frames)
framerate: framerate(fps)
bitrate bitrate(bps)
num encode frame count
fmt source yuv format( 0:nv12 1:nv21 2:yv12 3:rgb888 4:bgr888 )