RV1126-RV1109 MPP使用说明

2021-01-06  本文已影响0人  Mr_Michael

一、MPP 简介

Media Process Platform(简称 MPP) 是适用于瑞芯微芯片系列的通用媒体处理软件平台。

该平台对应用软件屏蔽了芯片相关的复杂底层处理, 其目的是为了屏蔽不同芯片的差异, 为使用者提供统一的视频媒体处理接口(Media Process Interface, 缩写 MPI)。

1.MPP的功能

2.MPP系统架构

image

3.平台支持

二、MPI 接口

MPI(Media Process Interface)是 MPP 提供给用户的接口,用于提供硬件编解码功能,以及一些必要的相关功能。

1.MPI接口数据结构

MPI 接口使用的主要数据结构

2.MPI 接口使用

MPI 是通过 C 结构里的函数指针方式提供给用户, 用户可以通过 MPP 上下文结构MppCtx 与 MPI 接口结构 MppApi 组合使用来实现解码器与编码器的功能。

三、MPP 库编译与使用

1.下载编译MPP 库

目前以RV1126为例使用MPP SDK

$ git clone -b release https://github.com/rockchip-linux/mpp.git
# linux 平台编译,假设处理器结构为arm
$ cd mpp/build/linux/arm
$ sudo apt-get -y install cmake
$ bash make-Makefiles.bash
$ make -j4
$ sudo make install

$ tree -L 2
.
├── arm.linux.cross.cmake
├── CMakeCache.txt
├── CMakeFiles
│   ├── 3.10.2
│   ├── cmake.check_cache
│   ├── CMakeDirectoryInformation.cmake
│   ├── CMakeError.log
│   ├── CMakeOutput.log
│   ├── CMakeTmp
│   ├── feature_tests.bin
│   ├── feature_tests.c
│   ├── feature_tests.cxx
│   ├── Makefile2
│   ├── Makefile.cmake
│   ├── progress.marks
│   └── TargetDirectories.txt
├── cmake_install.cmake
├── Makefile
├── make-Makefiles.bash
├── mpp
│   ├── base
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   ├── codec
│   ├── hal
│   ├── legacy
│   ├── librockchip_mpp.so -> librockchip_mpp.so.1
│   ├── librockchip_mpp.so.0
│   ├── librockchip_mpp.so.1 -> librockchip_mpp.so.0
│   ├── Makefile
│   └── vproc
├── osal
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   ├── libosal.a
│   ├── Makefile
│   └── test
│       ├── CMakeFiles
│       ├── cmake_install.cmake
│       ├── Makefile
│       ├── mpp_env_test
│       ├── mpp_eventfd_test
│       ├── mpp_log_test
│       ├── mpp_mem_test              # 测试C库的内存分配器是否正常
│       ├── mpp_platform_test      # 读取和测试芯片平台信息是否正常
│       ├── mpp_runtime_test        # 测试一些软硬件运行时环境是否正常
│       ├── mpp_thread_test
│       └── mpp_time_test
├── rockchip_mpp.pc
├── rockchip_vpu.pc
├── test
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   ├── Makefile
│   ├── mpi_dec_mt_test       # 多线程解码测试
│   ├── mpi_dec_multi_test  # 多实例解码测试【n线程同时解码n份数据帧】
│   ├── mpi_dec_test                # 单线程解码测试
│   ├── mpi_enc_multi_test  # 多实例编码测试
│   ├── mpi_enc_test                # 单线程编码测试
│   ├── mpi_rc2_test
│   ├── mpi_rc_test
│   ├── mpi_test
│   ├── mpp_info_test               # 读取和打印MPP库的版本信息
│   └── vpu_api_test
└── utils
    ├── CMakeFiles
    ├── cmake_install.cmake
    ├── libutils.a
    └── Makefile

mpp测试程序说明

2.获取芯片平台相关信息

$ cd mpp/build/linux/arm/osal/test

$ ./mpp_platform_test
mpp[2493]: mpp_plat_test: chip name: rockchip,rv1126-ds-v10 rockchip,rv1126
mpp[2493]: mpp_plat_test: 
mpp[2493]: mpp_plat_test: chip vcodec type 00050202
mpp[2493]: mpp_plat_test: found vpu2 codec
mpp[2493]: mpp_plat_test: found rkvdec decoder  # rk video decoder
mpp[2493]: mpp_plat_test: found rkvenc encoder  # rk video encoder
mpp[2493]: mpp_plat_test: found vpu2 encoder
mpp[2493]: mpp_plat_test: 
mpp[2493]: mpp_plat_test: start probing decoder device name:
mpp[2493]: mpp_plat_test: H.264 decoder: /dev/mpp_service   # h264解码
mpp[2493]: mpp_plat_test: H.265 decoder: /dev/mpp_service   # h265解码
mpp[2493]: mpp_plat_test: MJPEG decoder: /dev/mpp_service   # MJPEG解码
mpp[2493]: mpp_plat_test: VP9   decoder: (null)
mpp[2493]: mpp_plat_test: avs   decoder: (null)
mpp[2493]: mpp_plat_test: 
mpp[2493]: mpp_plat_test: start probing encoder device name:
mpp[2493]: mpp_plat_test: H.264 encoder: /dev/mpp_service # h264编码
mpp[2493]: mpp_plat_test: H.265 encoder: /dev/mpp_service # h265编码
mpp[2493]: mpp_plat_test: MJPEG encoder: /dev/mpp_service # MJPEG编码
mpp[2493]: mpp_plat_test: mpp platform test done

$ ./mpp_runtime_test
mpp[2596]: mpp_rt: NOT found ion allocator
mpp[2596]: mpp_rt: found drm allocator
mpp[2596]: mpp_rt_test: mpp found ion buffer is invalid
mpp[2596]: mpp_rt_test: mpp found drm buffer is valid

$ ./mpp_mem_test 
mpp[2034]: mpp_mem_test: calloc  success ptr 0x0x59080
mpp[2034]: mpp_mem_test: realloc success ptr 0x0x5b548
mpp[2034]: mpp_mem_test: mpp_mem_test done

3.MPP视频解码测试

$ cd mpp/build/linux/arm/test

$ ./mpi_dec_test
mpp[671]: mpi_dec_test: usage: mpi_dec_test [options]
mpp[671]: utils: -i  input_file         input bitstream file
mpp[671]: utils: -o  output_file        output bitstream file, 
mpp[671]: utils: -c  ops_file           input operation config file
mpp[671]: utils: -w  width              the width of input bitstream
mpp[671]: utils: -h  height             the height of input bitstream
mpp[671]: utils: -t  type               input stream coding type
mpp[671]: utils: -f  format             output frame format type    # 无效,只输出YUV420SP, NV12颜色格式
mpp[671]: utils: -d  debug              debug flag
mpp[671]: utils: -x  timeout            output timeout interval
mpp[671]: utils: -n  frame_number       max output frame number
mpp[671]: mpi: mpp coding type support list:
mpp[671]: mpi: type: dec id 0 coding: mpeg2            id 2
mpp[671]: mpi: type: dec id 0 coding: mpeg4            id 4
mpp[671]: mpi: type: dec id 0 coding: h.263            id 3
mpp[671]: mpi: type: dec id 0 coding: h.264/AVC        id 7
mpp[671]: mpi: type: dec id 0 coding: h.265/HEVC       id 16777220
mpp[671]: mpi: type: dec id 0 coding: vp8              id 9
mpp[671]: mpi: type: dec id 0 coding: VP9              id 10
mpp[671]: mpi: type: dec id 0 coding: avs+             id 16777221
mpp[671]: mpi: type: dec id 0 coding: jpeg             id 8
mpp[671]: mpi: type: enc id 1 coding: h.264/AVC        id 7
mpp[671]: mpi: type: enc id 1 coding: jpeg             id 8
mpp[671]: mpi: type: enc id 1 coding: h265             id 16777220
mpp[671]: mpi: type: enc id 1 coding: vp8              id 9

# 将h.264/AVC视频文件解码成yuv格式raw data视频文件
# 输出图像颜色默认为YUV420SP, NV12格式,-f选择其他参数无效
$ sudo ./mpi_dec_test -i test.h264 -o test.yuv -w 160 -h 128 -t 7
mpp[311]: mpi_dec_test: cmd parse result:
mpp[311]: mpi_dec_test: input  file name: test.h264
mpp[311]: mpi_dec_test: output file name: test.yuv
mpp[311]: mpi_dec_test: config file name: 
mpp[311]: mpi_dec_test: width      :  160
mpp[311]: mpi_dec_test: height     :  128
mpp[311]: mpi_dec_test: type       : 7
mpp[311]: mpi_dec_test: debug flag : 0
mpp[311]: mpi_dec_test: max frames : 0
mpp[311]: mpi_dec_test: mpi_dec_test start
mpp[311]: mpi_dec_test: input file size 3032275
mpp[311]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[311]: mpi_dec_test: 0x329a0 mpi_dec_test decoder test start w 160 h 128 type 7
mpp[311]: mpp_rt: NOT found ion allocator
mpp[311]: mpp_rt: found drm allocator
mpp[311]: mpi_dec_test: 0x329a0 decode_get_frame get info changed found
mpp[311]: mpi_dec_test: 0x329a0 decoder require buffer w:h [160:128] stride [160:128] buf_size 40960
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 0
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 1
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 2
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 3
......
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 7192
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 7193
mpp[311]: mpi_dec_test: 0x329a0 decode get frame 7194
mpp[311]: mpi_dec_test: 0x329a0 found last packet
mpp[311]: mpi_dec_test: test success max memory 0.27 MB

# 测试RV1126编码极限,将多路h.264/AVC视频文件解码成yuv格式raw data视频【7路 1080P视频解码】
# 注意:编码极限测试时不能用-o,否则会影响测试效果
$ sudo ./mpi_dec_multi_test  -i video-1920x1080.h264  -w 1920 -h 1080 -t 7 -n 7
mpp[3975]: mpi_dec_multi_test: cmd parse result:
mpp[3975]: mpi_dec_multi_test: input  file name: video-1920x1080.h264
mpp[3975]: mpi_dec_multi_test: output file name: 
mpp[3975]: mpi_dec_multi_test: width      : 1920
mpp[3975]: mpi_dec_multi_test: height     : 1080
mpp[3975]: mpi_dec_multi_test: type       : 7
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpp_rt: NOT found ion allocator
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpp_rt: found drm allocator
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpi_dec_multi_test: mpi_dec_test decoder test start w 1920 h 1080 type 7
mpp[3975]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode_get_frame get info changed found
mpp[3975]: mpi_dec_multi_test: decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 4177920
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45613 ms frm rate 32.88
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45673 ms frm rate 32.84
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45738 ms frm rate 32.80
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45753 ms frm rate 32.78
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45770 ms frm rate 32.77
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45782 ms frm rate 32.76
mpp[3975]: mpi_dec_multi_test: decode 1500 frame use time 45782 ms frm rate 32.76
mpp[3975]: mpi_dec_multi_test: payload 0 frame rate: 32.84 first delay 180 ms
mpp[3975]: mpi_dec_multi_test: payload 1 frame rate: 32.88 first delay 145 ms
mpp[3975]: mpi_dec_multi_test: payload 2 frame rate: 32.78 first delay 150 ms
mpp[3975]: mpi_dec_multi_test: payload 3 frame rate: 32.77 first delay 181 ms
mpp[3975]: mpi_dec_multi_test: payload 4 frame rate: 32.76 first delay 166 ms
mpp[3975]: mpi_dec_multi_test: payload 5 frame rate: 32.76 first delay 227 ms
mpp[3975]: mpi_dec_multi_test: payload 6 frame rate: 32.80 first delay 165 ms
mpp[3975]: mpi_dec_multi_test: average frame rate 32
# RV1126 MPP解码测试结果:7路 1080P 32fps H.264

4.MPP视频编码测试

$ ./mpi_enc_test
mpp[2628]: mpi_enc_utils: usage: mpi_enc_test [options]
mpp[2628]: utils: -i  input_file        input bitstream file
mpp[2628]: utils: -o  output_file       output bitstream file, 
mpp[2628]: utils: -w  width             the width of input picture
mpp[2628]: utils: -h  height            the height of input picture
mpp[2628]: utils: -f  format            the format of input picture
mpp[2628]: utils: -t  type              output stream coding type
mpp[2628]: utils: -n  max frame number  max encoding frame number # 最大编码帧数量,默认是全部帧
mpp[2628]: utils: -g  gop_mode          gop reference mode
mpp[2628]: utils: -d  debug             debug flag
mpp[2628]: utils: -b  bps target:min:max    set tareget bps
mpp[2628]: utils: -r  in/output fps     set input and output frame rate
mpp[2628]: utils: -l  loop count        loop encoding times for each frame
mpp[2628]: mpi: mpp coding type support list:
mpp[2628]: mpi: type: dec id 0 coding: mpeg2            id 2
mpp[2628]: mpi: type: dec id 0 coding: mpeg4            id 4
mpp[2628]: mpi: type: dec id 0 coding: h.263            id 3
mpp[2628]: mpi: type: dec id 0 coding: h.264/AVC        id 7
mpp[2628]: mpi: type: dec id 0 coding: h.265/HEVC       id 16777220
mpp[2628]: mpi: type: dec id 0 coding: vp8              id 9
mpp[2628]: mpi: type: dec id 0 coding: VP9              id 10
mpp[2628]: mpi: type: dec id 0 coding: avs+             id 16777221
mpp[2628]: mpi: type: dec id 0 coding: jpeg             id 8
mpp[2628]: mpi: type: enc id 1 coding: h.264/AVC        id 7
mpp[2628]: mpi: type: enc id 1 coding: jpeg             id 8
mpp[2628]: mpi: type: enc id 1 coding: h265             id 16777220
mpp[2628]: mpi: type: enc id 1 coding: vp8              id 9
mpp[2628]: mpi: mpp color support list: #   the format of input picture
mpp[2628]: mpi: color: id 0     0x00000 YUV420SP,      NV12
mpp[2628]: mpi: color: id 1     0x00001 YUV420SP-10bit
mpp[2628]: mpi: color: id 2     0x00002 YUV422SP,      NV24
mpp[2628]: mpi: color: id 3     0x00003 YUV422SP-10bit
mpp[2628]: mpi: color: id 4     0x00004 YUV420P,       I420
mpp[2628]: mpi: color: id 5     0x00005 YUV420SP,      NV21
mpp[2628]: mpi: color: id 6     0x00006 YUV422P,       422P
mpp[2628]: mpi: color: id 7     0x00007 YUV422SP,      NV42
mpp[2628]: mpi: color: id 8     0x00008 YUV422-YUYV,   YUY2
mpp[2628]: mpi: color: id 10    0x0000a YUV422-UYVY,   UYVY
mpp[2628]: mpi: color: id 12    0x0000c YUV400-Y8,     Y800
mpp[2628]: mpi: color: id 65536 0x10000 RGB565
mpp[2628]: mpi: color: id 65537 0x10001 BGR565
mpp[2628]: mpi: color: id 65538 0x10002 RGB555
mpp[2628]: mpi: color: id 65539 0x10003 BGR555
mpp[2628]: mpi: color: id 65542 0x10006 RGB888
mpp[2628]: mpi: color: id 65543 0x10007 BGR888
mpp[2628]: mpi: color: id 65546 0x1000a ARGB8888
mpp[2628]: mpi: color: id 65547 0x1000b ABGR8888

# 将yuv raw data编码成h264视频文件,输入图像颜色选择YUV420SP, NV12 格式
$ sudo ./mpi_enc_test -i test.yuv -o output.h264  -w 160 -h 128 -f 0 -t 7
mpp[3181]: mpi_enc_utils: cmd parse result:
mpp[3181]: mpi_enc_utils: input  file name: test.yuv
mpp[3181]: mpi_enc_utils: output file name: (null)
mpp[3181]: mpi_enc_utils: width      : 160
mpp[3181]: mpi_enc_utils: height     : 128
mpp[3181]: mpi_enc_utils: format     : 0
mpp[3181]: mpi_enc_utils: type       : 7
mpp[3181]: mpi_enc_test: mpi_enc_test start
mpp[3181]: mpp_rt: NOT found ion allocator
mpp[3181]: mpp_rt: found drm allocator
mpp[3181]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[3181]: mpi_enc_test: 0x359c0 mpi_enc_test encoder test start w 160 h 128 type 7
mpp[3181]: h264e_api_v2: MPP_ENC_SET_PREP_CFG w:h [160:128] stride [160:128]
mpp[3181]: h264e_api_v2: MPP_ENC_SET_RC_CFG bps 76800 [4800 : 81600] fps [30:30] gop 60
mpp[3181]: mpp_enc_v2: send header for set cfg change input/format 
mpp[3181]: mpp_enc_v2: mode vbr bps [4800:76800:81600] fps fix [30/1] -> fix [30/1] gop i [60] v [0]
mpp[3181]: mpi_enc_test: 0x359c0 encoded frame 0    size 5478   
mpp[3181]: mpi_enc_test: 0x359c0 encoded frame 1    size 1705   
mpp[3181]: mpi_enc_test: 0x359c0 encoded frame 2    size 2182   
......
mpp[1966]: mpi_enc_test: 0x35b60 encoded frame 25292 size 14     
mpp[1966]: mpi_enc_test: 0x35b60 encoded frame 25293 size 14     
mpp[1966]: mpi_enc_test: 0x35b60 found last frame. feof 1
mpp[1966]: mpi_enc_test: 0x35b60 encoded frame 25294 size 0      
mpp[1966]: mpi_enc_test: 0x35b60 found last packet
mpp[1966]: mpi_enc_test: 0x35b60 mpi_enc_test success total frame 25295 bps 147396


# 将YUV420P的raw data视频文件编码成jpeg图片,输入图像颜色选择YUV420SP, NV12 格式
# 默认编码一帧,如果编码多帧则会叠加到同一张图片,size增大
$ ./mpi_enc_test -i test.yuv  -o output.jpeg  -w 160 -h 128 -f 0 -t 8 -n 1
mpp[2417]: mpi_enc_utils: cmd parse result:
mpp[2417]: mpi_enc_utils: input  file name: test.yuv
mpp[2417]: mpi_enc_utils: output file name: output.jpeg
mpp[2417]: mpi_enc_utils: width      : 160
mpp[2417]: mpi_enc_utils: height     : 128
mpp[2417]: mpi_enc_utils: format     : 4
mpp[2417]: mpi_enc_utils: type       : 8
mpp[2417]: mpi_enc_test: mpi_enc_test start
mpp[2417]: mpi_enc_test: jpege default encode only one frame. Use -n [num] for rc case
mpp[2417]: mpp_rt: NOT found ion allocator
mpp[2417]: mpp_rt: found drm allocator
mpp[2417]: mpp_info: mpp version: a75c5ed author: Herman Chen    2020-11-06 [legacy]: Remove vpu dependence on mpp_service cmd
mpp[2417]: mpi_enc_test: 0x35b60 mpi_enc_test encoder test start w 160 h 128 type 8
mpp[2417]: mpi_enc_test: 0x35b60 encoded frame 0    size 4149   
mpp[2417]: mpi_enc_test: 0x35b60 encode max 1 frames
mpp[2417]: mpi_enc_test: 0x35b60 mpi_enc_test success total frame 1 bps 995760

5.视频文件比较

$ sudo apt-get install mediainfo

# 原始测试h264视频文件
$ mediainfo test.h264 
General
Complete name                            : test.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 2.89 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L5.1
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Width                                    : 160 pixels
Height                                   : 128 pixels
Display aspect ratio                     : 5:4
Frame rate                               : 29.970 (29970/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
$ du -h test.h264 
2.9M    test.h264

# h264视频文件解码得到的yuv raw data文件
$ mediainfo test.yuv 
General
Complete name                            : test.yuv
File size                                : 211 MiB  # raw data数据比h264编码的数据大72倍,所以网络传输时,编码是很有必要的

# yuv raw data文件再次编码得到的h264视频文件
$ mediainfo output.h264 
General
Complete name                            : output.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 2.14 MiB

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=60
Width                                    : 160 pixels
Height                                   : 128 pixels
Display aspect ratio                     : 5:4
Frame rate                               : 30.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressiv

# yuv raw data文件再次编码得到的jpeg图片
$ mediainfo output.jpeg 
General
Complete name                            : output.jpeg
Format                                   : JPEG
File size                                : 4.05 KiB

Image   # 是一张图片
Format                                   : JPEG
Width                                    : 160 pixels
Height                                   : 128 pixels
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Compression mode                         : Lossy
Stream size                              : 4.05 KiB (100%)

# 播放H264视频
$ ffplay -i test.h264

# 播放yuv raw data video
$ ffplay -f rawvideo -pixel_format yuv420p -video_size 160x128 test.yuv

# 播放编码得到的H264视频
$ ffplay -i output.h264

# 打开jpeg图片
$ ffplay -i output.jpg
上一篇下一篇

猜你喜欢

热点阅读