LeMaker Guitar:视频编码框架

From BananaPro/Pi
Jump to: navigation, search
This page is a translated version of the page LeMaker Guitar:Video encoder framework and the translation is 83% complete.

Other languages:
English • ‎中文(简体)‎

简介

GStreamer 是用来构建流媒体应用的开源多媒体框架(framework),其目标是要简化音/视频应用程序的开发,目前已经能够被用来处理像 MP3、Ogg、MPEG1、MPEG2、AVI、Quicktime 等多种格式的多媒体数据。

Install Librarys

Install gstreammer1.0

apt-get install gstreamer1.0-gnonlin \
gstreamer1.0-gnonlin-dbg \
gstreamer1.0-gnonlin-doc \
gstreamer1.0-fluendo-mp3 \
gstreamer1.0-libav \
gstreamer1.0-libav-dbg \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-bad-dbg \
gstreamer1.0-plugins-bad-doc \
libgstreamer-plugins-bad1.0-0 \
libgstreamer-plugins-bad1.0-dev \
gir1.2-gst-plugins-base-1.0 \
gstreamer1.0-alsa \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-base-apps \
gstreamer1.0-plugins-base-dbg \
gstreamer1.0-plugins-base-doc \
gstreamer1.0-x \
libgstreamer-plugins-base1.0-0 \
libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-good-dbg \
gstreamer1.0-plugins-good-doc \
gstreamer1.0-pulseaudio \
gstreamer1.0-plugins-ugly \
gstreamer1.0-plugins-ugly-dbg \
gstreamer1.0-plugins-ugly-doc

OMX编解码库安装

主要是需要OMX解码库中libOMX_Core.so库,参考:
http://wiki.lemaker.org/LeMaker_Guitar:Video_decoder_engine

安装 gstreamer_decoder

下载解压 gstreamer_decoder

下载链接: http://mirror.lemaker.org/gstreamer_decoder.tar.bz2

安装

  • 创建/config/bellagio目录并添加环境变量
mkdir -p /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/config/bellagio
export GST_OMX_CONFIG_DIR=/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/config/bellagio

如果需要在系统启动时自动添加环境变量,可在用户目录的.bashrc文件中加入export ……,如在/root/.bashrc的最后一行加入:

export GST_OMX_CONFIG_DIR=/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/config/bellagio
  • 拷贝相关配置文件与库
cp ./gstomx.conf  /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/config/bellagio
cp ./libgstomx.so  /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/
cp ./libOMX.Action.Video.Encoder.so  /usr/lib
cp ./libACT_EncAPI.so /usr/lib
  • 测试
    • 显示omxh264enc element相关信息
# gst-inspect-1.0 omxh264enc
Factory Details:
  Rank                     none (0)
  Long-name                OpenMAX H.264 Video Encoder
  Klass                    Codec/Encoder/Video
  Description              Encode H.264 video streams
  Author                   Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
Plugin Details:
  Name                     omx
  Description              GStreamer OpenMAX Plug-ins
  Filename                 /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstomx.so
  Version                  1.2.0
  License                  LGPL
  Source module            gst-omx
  Source release date      2014-07-23
  Binary package           GStreamer OpenMAX Plug-ins source release
  Origin URL               Unknown package origin
………………
    • 编码测试指令,压缩bus_vga.yuv成一个h.264编码的out.avc
#gst-launch-1.0 --gst-debug-level=1 filesrc location=./bus_vga.yuv blocksize=460800 \
num-buffers=1000 ! video/x-raw,format=I420,width=640,height=480,framerate=25/1 ! \
omxh264enc periodicty-idr=20 control-rate=1 target-bitrate=3000000 ! filesink location=./out.avc

测试所用的bus_vag.yuv视频如下:http://mirror.lemaker.org/bus_vga.7z
测试指令运行结束后,可在当前目录下看到生成一个out.avc的视频文件,可用视频播放器去播放。