Gstreamer stuff - MDHSRobotics/TeamWiki GitHub Wiki
All testing done on ubuntu-based machine running linuxmint 18.1 Cinnamon 3.2.6
All of the stack overflow pages I have visited when working on this-
- https://stackoverflow.com/questions/34088035/gstreamer-webcam-stream-from-raspberry-to-vlc-pc
- https://stackoverflow.com/questions/13154983/gstreamer-rtp-stream-to-vlc
- https://stackoverflow.com/questions/31111327/stream-webcam-video-with-gstreamer-1-0-over-udp-to-vlc-player
- https://stackoverflow.com/questions/37511395/using-gstreamer-to-stream-from-webcam-over-udp
- https://stackoverflow.com/questions/7669240/webcam-streaming-using-gstreamer-over-udp
- https://stackoverflow.com/questions/27969541/stream-webcam-video-with-gstreamer-1-0-over-udp-to-pc
- https://stackoverflow.com/questions/10464658/how-can-i-encode-a-video-to-h264
- https://stackoverflow.com/questions/23399419/gstreamer-ffdec-h264-missing
- https://stackoverflow.com/questions/17359579/gstreamer-x264enc-not-found
Input- gst-launch-1.0 -vv -e autovideosrc ! "video/x-raw,width=352,height=288,framerate=25/1"\ ! queue ! x264enc speed-preset=1 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5004
Output- WARNING: erroneous pipeline: could not parse caps "video/x-raw,width=352,height=288,framerate=25/1\"
Input- gst-launch-1.0 -vv -e v4l2src device=/dev/video0 ! "video/x-raw,width=352,height=288,framerate=25/1"\ ! queue ! x264enc speed-preset=1 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.255.10.41 port=5004
Output- WARNING: erroneous pipeline: could not parse caps "video/x-raw,width=352,height=288,framerate=25/1\"
Input- gst-launch-1.0 -v videotestsrc ! tee name=tee tee. ! autovideosink tee. ! queue ! x264enc tune=4 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5004
This gave me a preview window of the colored bars and a snow thing in the bottom corner, however it was not moving and I was unable to tune into it with VLC. For VLC, I did Open Network-->rtp://127.0.0.1 . Doing this gave me the VLC cone on a black screen (but no error codes so that's nice). I also tried rtp://@5004 and this didn't work either.
Input- gst-launch videotestsrc ! ffenc_mpeg4 ! rtpmp4vpay ! udpsink host=127.0.0.1 port=5004
Output- Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
So then I tried to receive it on VLC (network stream rtp://@127.0.0.1) but it didn't like it, giving me the error code
SDP required: A description in SDP format is required to receive the RTP stream. Note that rtp:// URIs cannot work with dynamic RTP payload format (96).
Input- gst-launch-1.0 -vv -e v4l2src device=/dev/video0 \ ! videoscale \ ! "video/x-raw,width=1280,height=720,framerate=10/1" \ ! queue \ ! x264enc \ ! h264parse \ ! rtph264pay config-interval=10 pt=96 \ ! udpsink host=127.0.0.1 port=5004
I tested this again and got a syntax error so this command is a huge question
This got the camera to turn on, however I was still unable to open it in VLC using any of the previous network addresses (rtp://@127.0.0.1 , rtp://127.0.0.1 , rtp://@127.0.0.1:5004 , rtp://@5004 , udp://@:5004 , udp://@0.0.0.0:5004). All gave the same SDP Required... error from above.
Success? Sorta
This input gst-launch-1.0 -vv -e autovideosrc ! queue ! x264enc speed-preset=1 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink host=127.0.0.1 port=5004
started up the camera and I was able to "view" it in VLC using this as the network udp://@127.0.0.1:5004
. However the video I recieved looked like a corrupt video was playing.
edit: replacing autovideosrc
with videotestsrc
got the preview to play however the bandwidth appeared to be way too low to stream even the corner where the snow thing is
success!
gst-launch-1.0 -vv -e videotestsrc ! queue ! x264enc bitrate=5000 ! mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink host=127.0.0.1 port=5004
resulted in a 5mb/s stream that was clear.
Todo:
-
Reduce delay
-
Do UDP multicast