I try to make a H264 RTP stream from a Raspberry Pi 3 with a camera module to a video tag.
Using the following code to start the stream
raspivid -t 0 -h 720 -w 1080 -fps 25 -hf -b 2000000 -o - | \
gst-launch-1.0 -v fdsrc \
! h264parse \
! rtph264pay \
! gdppay \
! udpsink host="192.168.0.11" port=5000
Then I provide a simple webpage with a video tag:
<video id="videoTag" src="h264.sdp" autoplay>
<p class="warning">Your browser does not support the video tag.</p>
</video>
The src references the following SDP file:
v=0
m=video 5000 RTP/AVP 96
c=IN IP4 192.168.0.51
a=rtpmap:96 H264/90000
When I load the webpage nothing happens, and the js console is completely empty.
So I tried to view the stream with VLC, and got the following error:
[00007efd80c03ea8] es demux error: cannot peek
[00007efd80c03ea8] es demux error: cannot peek
[00007efd80c03ea8] live555 demux error: no data received in 10s, aborting
I thought that there had been no UDP communication at all, So I tested it from a remote machine:
gst-launch-1.0 udpsrc port=5000 \
caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" \
! fakesink dump=true
ans received UDP packets. So I researched forward and found this:
https://cardinalpeak.com/blog/the-many-ways-to-stream-video-using-rtp-and-rtsp/
Now it is clear that I need 2 ports one to stream data and to establish RTP Control Protocol. However I have no idea how can I do it with gstreamer.
Worst of all when I run:
gst-inspect-1.0 | grep -i rtcp
I get nothing.
How can start video stream with gstreamer-1.0 to a video tag inside a webpage using the RTP protocol?
update
Using videotestsrc as gstreamer videosoruce and removing gdppay (it caused invalid RTP payload error) I was able to view the video stream from a remote client with VLC and with this gstreamer code:
gst-launch-1.0 udpsrc port=5000 \
caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" \
! rtph264depay \
! avdec_h264 \
! autovideosink