I am trying to pipe raspivid over ssh to my main computer, and then via gstreamer send the stream to a dummy video device (thanks to V4l2loopback)
environment :
v4l2loopback version: 0.12.0
kernel version: 4.15.0-43-generic
Distribution (+version): Ubuntu 18.04.1
So far, I have no issue with simple commands like :
gst-launch-1.0 videotestsrc ! v4l2sink device=/dev/video1
I can see the result without any error on VLC via /dev/video1
Sending stuff to the dummy video device works
So far I am piping the output of my raspicams to my main computer, via this command, that works fine :
ssh user@mypi "raspivid -fps 25 -w 1920 -h 1080 -t 0 -o -" | tee test.h264 | mplayer -fps 200 -xy 800 -geometry 1920:0 -cache 1024 -
records the file and displays the stream fine.
I now wanted to replace mplayer by gstreamer to pipe the output to /dev/video1, and process it via opencv.
ssh user@mypi "raspivid -fps 25 -w 1920 -h 1080 -t 0 -o -" | gst-launch-1.0 -v fdsrc ! h264parse ! avdec_h264 ! v4l2sink device=/dev/video1
I have tried several sets of arguments, to no avail.
I keep getting errors :
Définition du pipeline à PAUSED...
Le pipeline est en phase de PREROLL…
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)01640028ffe1001027640028ac2b403c0113f2c03c489a8001000528ee025cb0
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:sink: caps = video/x-h264, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)4, codec_data=(buffer)01640028ffe1001027640028ac2b403c0113f2c03c489a8001000528ee025cb0
/GstPipeline:pipeline0/avdec_h264:avdec_h264-0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)bt709, framerate=(fraction)0/1
ERREUR : de l’élément /GstPipeline:pipeline0/GstFdSrc:fdsrc0 : Internal data stream error.
Information de débogage supplémentaire :
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstFdSrc:fdsrc0:
streaming stopped, reason not-negotiated (-4)
ERREUR : le pipeline refuse de passer en phase de préparation.
From what I read, gstreamer seems to be able to read the input stream, except maybe the framerate, but somehow it does not work.
I am no expert in gstreamer attributes, so i would appreciate any help or hints. (I have been googling this for hours ...)
thanks.
[update]
I finally went for ffmpeg instead.
ssh user@mypi "raspivid -fps 25 -w 1920 -h 1080 -t 0 -o -" | ffmpeg -i pipe: -s 1920x1080 -vcodec rawvideo -f v4l2 /dev/video1
I got 4 pi cameras streamed to 4 local dummy devices. (with reasonable processor loads) And opencv reads it nicely.
I can now record in full resolution the pi camera, and process the stream for movement detection, and shape identification with tensor flow.