Mittwoch, 2. April 2014

Olinuxino A20 H264 Encoding

This Blogpost is about the Hardware h264 Encoder on the A20 and how to use it.
After searching around,i found this Encoder(https://github.com/jemk/cedrus/tree/master/h264enc) but was not able to use it. After contacting the Author,i finally got it working,and the author told me,that there is another library,which was forked of his project,and should work well. I tried both. So enought Talk,here ist the instruction

1. git clone https://github.com/ebutera/gst-plugin-cedar
2. For Compiling youll need
apt-get install gstreamer0.10-tools libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

2. compile using the autogen.sh script & make
3.  On my Installation(Stock Debian 7 Image of Olinuxino A20 ) i had to put the two Files(libgstcedar.la & libgstcedar.so) to the right path. Trough "make install" they were copied to /usr/local/lib/gstreamer-0.10/ but in my Installation,the gstreamer path was  /usr/lib/arm-linux-gnueabihf/gstreamer-0.10/
4. Test if the Library is recognized correctly by  "gst-inspect cedar_h264enc". If you get no errors you have managed it.
5. Before using it,ensure you have a /dev/cedar_dev . if not,just make a modprobe sunxi_cedar_mod
for having it everytime use: put sunxi_cedar_mod in  /etc/modules 

Now to the Encoding Commands
1 Get Testoutput:
gst-launch -ve videotestsrc ! cedar_h264enc ! h264parse ! matroskamux ! filesink location="test.mkv"
2. Convert from some format to h264 (maybe with an error)
gst-launch -ve filesrc location=input.avi ! ffmpegcolorspace ! cedar_h264enc ! h264parse ! matroskamux ! filesink location="output.mkv" 
 3. Stream from your Webcam on Justin.Tv(you can also use ustream or twitch,or any other rtmp server)
gst-launch -ve v4l2src device=/dev/video0 ! ffmpegcolorspace ! video/x-raw-yuv, width=1280, height=720, format=(fourcc)NV12 ! cedar_h264enc ! h264parse ! flvmux streamable=true ! rtmpsink location=rtmp://live-fra.justin.tv/app/$STREAMKEY



For now the Cpu is going to 100% but i have read,its because of the Color Converting Routines.
There is some discussion about using a custom Filter(not the ffmpegcolorspace) here:
http://processors.wiki.ti.com/index.php/GstTIPlugin_Elements#TIPrepEncBuf
Havent tried it yet,but i think its possible to use. 
 The Cpu is going to 100% with or without the color conversion. The Plugin is experemental,maybe thats why.


For Overlays you can use:
Also consider about using https://developer.ridgerun.com/wiki/index.php/Fast_GStreamer_overlay_element for overlays.



Keine Kommentare:

Kommentar veröffentlichen