12/22/2016

Gstreamer의 Elements

1. Gstreamer 기본분석 

아래는 IP Camera 에서 전송하는 H.264 Stream을 받아 Gstreamer로 재생하는 예제이다
각 부분의 Elements와 부분을 간단히 분석해보자. 

  • Gstreamer RTSP 관련부분 TEST 예제 

$ gst-launch rtspsrc location=rtsp://192.168.1.168:8556/PSIA/Streaming/channels/2?videoCodecType=H.264  ! queue ! \
'application/x-rtp,payload=96,encoding-name=H264,framerate=(fraction)30/1' ! \
rtph264depay ! \
h264parse access-unit=true ! queue ! \
omx_h264dec ! omx_scaler ! \
'video/x-raw-yuv, width=(int)1920, height=(int)1080' ! queue ! \
omx_ctrl display-mode=OMX_DC_MODE_1080P_30 ! \
gstperf print-fps=true print-arm-load=true ! \
omx_videosink sync=false enable-last-buffer=false

https://en.wikipedia.org/wiki/GStreamer

  • Elements의 구성

Properties

이  Element 에서 제공해주는 속성 즉 설정들을 말한다.
아래와 같이 Manual을 보면, Elements 내부에 기능의 설정값을 이 속성을 이용하여
변경이 가능하다.

Signal  

이 Element 들은 기본적으로 Pipeline 통신을 하며, 이 사용시 발생되는 Signal Message // Programming 하면 Callback

Element Pads:

Element 내부에는 pad라는 것이 존재하며,본인도 초반에 잠시 헷갈렸지만, 이름에서 알수 있듯이,
그림을 보면 쉽게 이해를 할수 있다. 말그대로 Element의 Pad 기능이다.
Element들의 연결은 Pipeline을 통하여 Source와 Sink 방식으로 연결이 된다.
Source의 Pad가 존재 할수 있고, Sink 에 Pad Interface가 존재 할수도 있는 것이다.
이를 이용하여 Programming 에서는 Call back Function을 구현을 할 수도 있다.

Pad 기능에서 중요하게 봐야 할 부분이 Manual에서 Pad의 방향
발생빈도

  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html
    https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstElement.html

URIDECODEBIN
  https://yujuwon.tistory.com/entry/%ED%8C%8C%EC%9D%B4%ED%94%84%EB%9D%BC%EC%9D%B8-%EC%83%81%ED%83%9C-%ED%99%95%EC%9D%B8

Ghost Pad
  https://yujuwon.tistory.com/entry/Ghost-pads-1?category=637930

에는 이름과 방향 발생빈도 및 자세한 내용이 나온다.
                 Element인 경우 source or sink 방향이 있다.
                 이 경우,  source에만 해당하거나, sink에만 해당하는 기능을 말하는 것 같다.

Tee Command 관련 예제(optee가 아님)
  https://gist.github.com/crearo/a49a8805857f1237c401be14ba6d3b03


  • PAD관련 Manual 
  https://gstreamer.freedesktop.org/documentation/application-development/basics/pads.html


  • Plug-in rtspsrc 설명 
  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtspsrc.html

  • Plug-in rtph264depay 설명 
  https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-rtph264depay.html


동영상 Encode/Decode에 있어서는 Gstreamer가 다루는 것은 두가지로 볼수 있다.

  1. OpenMax  : 주로 HW와 함께 연동이 되어 동작이 되며, 관련 MPU Manual 참조 
  2. FFmpeg : SW Codec으로  Interface도 동일하다. 

OpenMax도 거의 동일하게 동작이 되도록 유지되게 했지만, 조금씩 다르다.


2. Plug-In 개발 방법 

만약 Plug-IN을 직접 개발해보고 싶다면, 아래의 Manual을 보고 한번 해보자.
본인도 궁금하고 해보고 싶다.

 https://gstreamer.freedesktop.org/documentation/plugin-development/index.html
 https://gstreamer.freedesktop.org/documentation/tutorials/basic/multithreading-and-pad-availability.html?gi-language=c

댓글 없음 :