1

I have a c++ application that gets the video in RTSP and H264 format from a camera using gstreamer an re-sends the videos using webrtcbin. I have followed the example from this link and I can see the video trough firefox (with the tips suggested in this post), when use VP9 encoding.

The pipeline I have used is:

rtspsrc location=rtsp://192.168.1.162/z3-1.mp4 ! application/x-rtp,encoding-name=H264 ! rtph264depay ! nvv4l2decoder ! nvv4l2vp9enc ! video/x-vp9 ! rtpvp9pay ! application/x-rtp,media=video,clock-rate=90000,encoding-name=VP9,payload=96,framerate=25/1 ! webrtcbin async-handling=true name=sendrecv

Although I follow the suggestion from the post), I can not see the video using Chrome but from the statistics in chrome://webrtc-internals/ it is clear that i am getting the video but chrome does not show the video.

Independently of the browser i have some issues to stream and see the video in 4k. Therefeore, i have decided to remove the VP9 enconding (to speedup the processing) and re-send the data directly in H264 from the camera. To do that i use the pipeline:

rtspsrc location=rtsp://192.168.1.162/z3-1.mp4 ! application/x-rtp,encoding-name=H264 ! webrtcbin async-handling=true name=sendrecv

After using this pipeline, i do not see the video neither in firefox or chrome. The interesing point is that if i analyze the traffic with firefox it looks like the browser is not getting any data. However in this case with chrome is getting mbytes of data but i do not see the video.

The answers of the negotiation are:

Firefox

v=0
o=mozilla...THIS_IS_SDPARTA-95.0.2 5069762040601189414 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 ED:70:D8:AF:49:E9:B1:F8:47:83:1B:2B:13:D3:67:AD:F6:43:9D:36:59:8B:74:93:34:1D:AB:D5:67:1A:E4:07
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 0 UDP/TLS/RTP/SAVPF 120
c=IN IP4 0.0.0.0
a=inactive
a=mid:video0
a=rtpmap:120 VP8/90000

Chrome

v=0
o=- 2541702691192041899 2 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS
m=video 9 UDP/TLS/RTP/SAVPF 96
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:ssce
a=ice-pwd:eWXfMAvg/KEFxesG2nS3aNTt
a=ice-options:trickle
a=fingerprint:sha-256 E0:79:E1:50:F6:9F:CB:8B:80:8A:40:5A:B9:1B:35:27:EF:A2:45:EC:A1:A7:58:B5:24:98:0C:8D:B0:41:3B:1C
a=setup:active
a=mid:video0
a=recvonly
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 H264/90000
a=rtcp-fb:96 nack pli
a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f

any idea about there is no video in firefox or in chrome? Any tip would be really helpful. Many thanks!

VictorCB
  • 70
  • 10
  • Hello Victor, can you tell me how you got it to work with vp9? My firefox tells me that all the packets are discarded webrtc handshake finishes and the video would start. I looked at the links you posted but could not fix it. my pipeline looks like this: videotestsrc ! queue ! vp9enc ! rtpvp9pay ! application/x-rtp,media=video, encoding-name=VP9, payload=96 ! webrtcbin name=webrtcbin_send – Robert Driller Sep 27 '22 at 15:47
  • Sorry i do not remember how i did it and i can not access the code now. I would suggest to check the profile of your rstp source and may be trying different browsers. Check the answers below. – VictorCB Sep 29 '22 at 16:30

1 Answers1

2

One possible reason browsers support only baseline profile encoded h264 streams. You can try fool browsers by add something like capssetter caps=\"application/x-rtp,profile-level-id=(string)42c015\" in between rtph264pay and webrtcbin, but it will help only in some cases.

RSATom
  • 817
  • 6
  • 16
  • And btw, you can look to my implementation of task you are trying to solve: https://github.com/WebRTSP/ReStreamer – RSATom Jan 11 '22 at 11:08
  • thanks for your suggestion, i am not sure if i understood you correctly. waht do you mean by adding these lines? In the pipeline that i have used with only h264 there is no `rtph264pay`. Should i add it? I am not sure that my pipeline with only h264 is correct. – VictorCB Jan 11 '22 at 15:35
  • `webrtcbin` can work only with RTP buffers, so yes, you have to use `rtph264pay`. Something like here https://github.com/WebRTSP/RtStreaming/blob/a0d2b6641f4ae2f805e99f8d70f1396bda74836b/GstRtcStreaming/GstReStreamer.cpp#L90 – RSATom Jan 11 '22 at 15:56
  • I did not know that i must use RTP buffers. This means that i can not send directlly the RSTP comming from the camera to be consumed by a webrtc? I have tried different combination of pipelines and i could not make it work. A pipeline like that could work? `rtspsrc location=rtsp://192.168.1.162/z3-1.mp4 ! h264parse config-interval=-1 ! rtph264pay pt=96 ! capssetter caps=\"application/x-rtp,profile-level-id=(string)42c015\" ! webrtcbin async-handling=true name=sendrecv ` – VictorCB Jan 11 '22 at 17:22
  • I don't remember if it's possible to link `rtspsrc` with `h264parse` directly. I'm always used `pad-added` signal to link pipeline. Also, you should check if your rtsp source is really produces `baseline profile` h264 stream. – RSATom Jan 12 '22 at 02:26
  • 1
    btw, you can use https://snapcraft.io/rtsp-test-server as source of `baselin profile` h264 streams – RSATom Jan 12 '22 at 05:01
  • 1
    You are right, My stream has a high profile. Using [snapcraft.io/rtsp-test-server](https://snapcraft.io/rtsp-test-server) i can see the video by using this pipeline. `rtspsrc location=rtsp://localhost:8554/bars ! application/x-rtp,encoding-name=H264 ! webrtcbin async-handling=true name=sendrecv ` – VictorCB Jan 12 '22 at 09:54