LeMaker Guitar:Video encoder framework

From BananaPro/Pi
Jump to: navigation, search

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

Introduction

GStreamer is an open source library of multimedia framework that used to build streaming media application, its goal is to simplify the development of audio/video applications, can now be used to handle like MP3, Ogg, MPEG1, MPEG2, AVI, Quicktime format of multimedia data.

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

Install OMX encoder and decoder Library

Refer this link: http://wiki.lemaker.org/LeMaker_Guitar:Video_decoder_engine

Install gstreamer_decoder

Download and unzip

Download link: http://mirror.lemaker.org/gstreamer_decoder.tar.bz2

Install

  • Create /config/belagio and add the environment variable
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

If you want to auto add the environment when system start, add the export ... to file .bashrc.
For example: add this line to /root/.bashrc.

export GST_OMX_CONFIG_DIR=/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/config/bellagio
  • Copy some configure files and library
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
  • Test
    • Display some information about 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
………………
    • Compression the bus_vga.yuv into out.avc(h.264)
#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

This is the test video:http://mirror.lemaker.org/bus_vga.7z
Now you can see a video named out.avc(coded by h.264).