2

I'm working on a streaming solution and I want to combine two sources into one output stream, a Pi Camera and a webcam. Rather than decode the h264 output and then encode it again after it gets mixed together I'm trying to figure out how to get the raw output to work with gstreamer. I'm having a hard time figuring out what the proper format is supposed to be. I've tried switching it to 'rgb' on both sides but when I view the output I get a matrix of 6 copies all in grayscale, 3 on top and 3 on the bottom and I don't know what to choose for the 'yuv' from raspivid.

What is the correct gstreamer format for any of the pi camera raw formats?

Anyone have a sample pipeline?

Edit: Currently I'm using the rapsivid | gst-launch-1.0 style input and wondering if that's still the proper way to access the pi or if there's a gstreamer plugin that is capable like v4l2 or something.

  • It would be helpful if you could edit your question to include at least one example of the command(s) you're currently using - no sense retreading ground you've already covered. – goobering Feb 21 '17 at 21:16
1

If you load the v4l2 driver sudo modprobe bcm2835-v4l2

instead of raspivid and try

gst-launch-1.0 v4l2src ! "video/x-raw,height=640,width=480,framerate=30/1" ! ximagesink`

you'll get the raw output - this needs a GUI for the ximagesink, I seem to recall you can encourage fbdevsink to jam the video straight onto the screen even from the terminal but i've forgotten the threats you need to make to get it to co-operate.

you can test this (crudely :) ) by comparing outputs of

gst-launch-1.0 v4l2src num-buffers=100 ! "video/x-raw,height=640,width=480,framerate=30/1" ! filesink location=video.raw

gst-launch-1.0 v4l2src num-buffers=100 ! "video/x-h264,height=640,width=480,framerate=30/1" ! filesink location=video.h264

and marvel at the file size difference (i got 0.4MB (h264) vs 13MB (raw)). I believe the mediainfo package can be used to interrogate the files although the raw one isn't very interesting.

if you add the bcm2835-v4l2 line to /etc/modules-load.d/modules.conf it'll be available from boot without the modprobe need.

Also: My noir model in raw mode has some colour space issues - you should be able to mitigate these (at least in RGBA and BGRA modes) via ! videoconvert ! between the format selection and the sink.

  • If you check out the videomixer element you might be able to combine both sources that way - looks like its a bit finiky to get right though. – tobyd Feb 21 '17 at 23:19
  • That's what I'm using but needed the pi source raw for the input. I combine multiple inputs and then tee and crop on the receiver side after a udpsink. – ahanson Feb 22 '17 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.