0

I could use some help with construction of a Gstreamer pipeline. The intention is to capture video from a RaspiCam, then stream the video to another RPi, do image processing(object tracking) with OpenCV on the transmitting RPi in between. But I'm having troubles with the encoding and I don't really know much about witch I should use.

I have looked at this Adding opencv processing to gstreamer application and is trying to get gst-rpicamsrc to capture the cam for use in the pipeline. But I can't seem to figure out how to decode(?) the video so that I can use it in OpenCV. It's fine with videotestsrc but rpicamsrc has apparently other properties.

"rpicamsrc ! " "h264parse ! " "tee name=cam ! " "video/x-h264, width=640, height=480, format=RGB ! " "omxh264dec ! " "videoconvert ! " "appsink name=sink sync=true ! " ".cam rtph264pay ! " "rtprtxqueue ! " "udpsink host=127.0.0.1 sync=false port=5000"

I have also experimented with shorter pipelines, but only got it working with videotestsrc.

I do fear that the queue is adding a nasty delay to the image processing, and since I want to track objects it may not be good enough.

I have also tried to use VideoCapture cap("rpicamsrc ! appsink") and cap("v4l2src ! videodecode ! video/x-raw ! appsink) and so on.. And I have done my best to match the receiving side with decoders in the opposite direction, but my knowledge is just too limited..

Any recommendations of would be appreciated!

Community
  • 1
  • 1
  • first of all you do not have to use double quotes (") around element names.. queue is just buffering data in order to provide smooth playback and also passes processing of following elements to different thread - its very useful, usually adding queues everywhere only help things (but dont take me literally) can you just play localy with rpicamsrc? also I have to warn you tee is very dangerous element with h264 stuff (especially [x264enc](http://gstreamer-devel.966125.n4.nabble.com/Pipeline-Freezes-When-Adding-In-Tee-With-x264enc-td4301890.html) ) so try first without it – nayana May 09 '16 at 06:53
  • can you try this (or similar - with some other sink) `GST_DEBUG=3 gst-launch-1.0 rpicamsrc name=src preview=0 fullscreen=0 ! h264parse ! omxh264dec ! glimagesink sync=0`? – nayana May 09 '16 at 06:56

1 Answers1

0

According to the docs for VideoCapture:

  • The 'filename' parameter is not limited to filesystem paths, and may be one of the following: *
      • a normal filesystem path:
    • e.g. video.avi or /path/to/video.avi or C:\video.avi
      • an uri:
    • e.g. file:///path/to/video.avi or rtsp:///path/to/stream.asf
      • a gstreamer pipeline description:
    • e.g. videotestsrc ! videoconvert ! appsink
    • the appsink name should be either 'appsink0' (the default) or 'opencvsink'

Note that the name of the appsink MUST be one or appsink0 or opencvsink, whereas you have called it simply sink.

KDawg
  • 61
  • 1
  • 1