Simple video stream not working

1,393 views
Skip to first unread message

Jean-Baptiste Braun

unread,
Dec 6, 2020, 10:41:27 AM12/6/20
to meetecho-janus
Hi,

I just installed a janus-gateway on a raspberry pi (raspbian buster). My ultimate goal is to stream the pi's camera in a web application.

I am able to start janus on the Pi with the default configuration files generated by `make configs`.

I also have an nginx server with a very simple configuration serving janus's html example pages in order to access the equivalent of https://janus.conf.meetecho.com/streamingtest.html locally.

With the package `gstreamer1.0-tools` installed and running the `share/janus/streams/test_gstreamer_1.sh` script, I am able to stream both VP8 video and sound.

I have errors when I change the gstreamer command to stream h264 (costs less resources for the Pi), with something like :
gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! omxh264enc target-bitrate=1000000 control-rate=variable ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=8004

or (using the camera as the source)

gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,width=1280,height=720,framerate=30/1 ! omxh264enc target-bitrate=1000000 control-rate=variable ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=8004

or (feeding from my laptop, trying an adaptating from the test_gstreamer_1.sh)

gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoscale ! videorate ! videoconvert ! timeoverlay ! x264enc ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=<rpi.local> port=8004

The configuration section I added to etc/janus/janus.plugin.streaming.jcfg
rtp-sample2: {
        type = "rtp"
        id = 4
        description = "h264 live stream coming from external source"
        metadata = "You can use this metadata section to put any info you want!"
        audio = false
        video = true
        videoport = 8004
        videopt = 96
        videortpmap = "H264/90000"
        secret = "adminpwd"
        # videofmtp = "profile-level-id=42e01f;packetization-mode=1"
        videofmtp = "packetization-mode=1"
}

When I click on "Watch or Listen" on the local streamingtest.html page, the behavior differs between chromium and firefox, but basically I get an error and "No video available" in the video placeholder.

On chromium :
A popup appears "WebRTC error... Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Failed to set local answer sdp: Failed to set local video description recv parameters."
In the console : streamingtest.js:174 WebRTC error: DOMException: Failed to execute 'setLocalDescription' on 'RTCPeerConnection': Failed to set local answer sdp: Failed to set local video description recv parameters.
Janus logs :
[3029108292704470] Creating ICE agent (ICE Full mode, controlling)


On firefox :
In the console : "Ooops: 465 Error processing SDP"
Janus logs :
[3294557005159135] Creating ICE agent (ICE Full mode, controlling)
[ERR] [sdp.c:janus_sdp_process:387] [3294557005159135] SDP missing mandatory information
[ERR] [sdp.c:janus_sdp_process:388] [3294557005159135] (nil), (nil), 0x71a06298, 0x71a05678
[ERR] [janus.c:janus_process_incoming_request:1458] Error processing SDP


What I find weird in firefox is those console debug lines :
untitled(4).png

I tried a lot of different ways to feed janus streaming plugin with h264 video but nothing seems to work. I really don't understand where I messed up switching from VP8 to h264 and I have little WebRTC knowledge.

Jbb

Mirko Brankovic

unread,
Dec 6, 2020, 2:11:07 PM12/6/20
to meetecho-janus
I think that choosing the correct profile of h264 is important here and also mandatory in sdp for the browser, so maybe look how to force it with gst

--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/bb989d08-8235-4b91-9eb4-e478a4464395n%40googlegroups.com.

Lorenzo Miniero

unread,
Dec 7, 2020, 6:53:01 AM12/7/20
to meetecho-janus
Not sure why you commented out the "profile-level-id=42e01f" part, that's what keeps most browsers happy no matter the original profile.

Lorenzo

Jean-Baptiste Braun

unread,
Dec 8, 2020, 6:00:40 AM12/8/20
to meetecho-janus
Le lun. 7 déc. 2020 à 12:53, Lorenzo Miniero <lmin...@gmail.com> a écrit :
Not sure why you commented out the "profile-level-id=42e01f" part, that's what keeps most browsers happy no matter the original profile.
I tried with and without it, errors are the same

Il giorno domenica 6 dicembre 2020 alle 20:11:07 UTC+1 mirkobr...@gmail.com ha scritto:
I think that choosing the correct profile of h264 is important here and also mandatory in sdp for the browser, so maybe look how to force it with gst
 I don't have enough knowledge to understand the depth or simplicity of the things implied here. It puzzles me that I would have to force a profile with gst. I checked a lot of examples of people providing gst pipelines examples and I never saw anyone forcing anything here.

What I don't get is that I feel I'm not even able to make work an h264 streaming "hello world". I installed janus on my laptop (debian buster), I am using firefox version 83, html/js files provided by the janus project, a simple configuration and a gst pipeline inspired by the one in test_gstreamer_1.sh
gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoscale ! videorate ! videoconvert ! timeoverlay ! x264enc ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=localhost port=8004

Can someone please try to reproduce and confirm I didn't miss something ? Because it feels like something is broken in the demo/examples. Either demos should be easy to setup and work with close to no adaptation, or it shouldn't be included in the demo at all (ie the h264-sample mountpoint).

Is there an out-of-the-box tool to stream this h264 endpoint so that I can confirm everything is alright on the server side ?

Jbb

Jean-Baptiste Braun

unread,
Jan 1, 2021, 12:32:46 PM1/1/21
to meetecho-janus

The SDP offer (https://github.com/meetecho/janus-gateway/blob/master/html/streamingtest.js#L153) that I get from Janus seems complete:
v=0
o=- 1609517272696586 1 IN IP4 192.168.0.19
s=Mountpoint 10
t=0 0
a=group:BUNDLE video
a=msid-semantic: WMS janus
m=video 9 UDP/TLS/RTP/SAVPF 126 127
c=IN IP4 192.168.0.19
a=sendonly
a=mid:video
a=rtcp-mux
a=ice-ufrag:Je5V
a=ice-pwd:SU8SpnlHx9CXZUOQMQKVho
a=ice-options:trickle
a=fingerprint:sha-256 5A:F3:E1:F7:AC:90:77:74:84:0A:1E:44:78:3F:67:BF:0F:7D:F1:03:8A:4C:98:78:83:77:67:FD:6D:99:41:AE
a=setup:actpass
a=rtpmap:126 H264/90000
a=fmtp:126 profile-level-id=42e01f;packetization-mode=1
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 goog-remb
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=rtpmap:127 rtx/90000
a=fmtp:127 apt=126
a=ssrc-group:FID 2116215110 2582257693
a=msid:janus janusv0
a=ssrc:2116215110 cname:janus
a=ssrc:2116215110 msid:janus janusv0
a=ssrc:2116215110 mslabel:janus
a=ssrc:2116215110 label:janusv0
a=ssrc:2582257693 cname:janus
a=ssrc:2582257693 msid:janus janusv0
a=ssrc:2582257693 mslabel:janus
a=ssrc:2582257693 label:janusv0
a=candidate:1 1 udp 2013266431 192.168.0.19 54054 typ host
a=end-of-candidates

But the answer (https://github.com/meetecho/janus-gateway/blob/master/html/streamingtest.js#L167) doesn't make any sense compared to the offer. On firefox:
v=0
o=mozilla...THIS_IS_SDPARTA-78.6.0 796498317747695147 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 2F:13:48:66:39:0C:F6:0C:1E:5E:C7:DE:AC:6C:7E:34:92:E9:94:3D:20:40:F8:74:60:54:0C:93:77:31:5E:6E
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:video
a=rtpmap:120 VP8/90000

On chromium:
v=0
o=- 7587618216793098402 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE video
a=msid-semantic: WMS
m=video 9 UDP/TLS/RTP/SAVPF 0
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:HMSW
a=ice-pwd:NMd5TAw9UCc/VTonsvhRWLyO
a=ice-options:trickle
a=fingerprint:sha-256 4F:43:5C:6D:40:60:B2:9B:21:9A:C4:A1:A5:14:9C:E8:F7:2F:AC:65:D1:31:DE:34:ED:E9:B7:5C:24:72:C3:A5
a=setup:active
a=mid:video
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=recvonly
a=rtcp-mux

I've been looking in the code where the answer is crafted but I don't find it.

Jbb

Alessandro Toppi

unread,
Jan 4, 2021, 9:56:14 AM1/4/21
to meetecho-janus
I have just tried and everything works as expected with this pipeline

gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoscale ! videorate ! videoconvert ! timeoverlay ! x264enc tune=zerolatency ! "video/x-h264,profile=baseline" ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=8004

Notice that I have added the zerolatency tuning and the baseline profile.

My mountpoint is configured as following

h264-sample : 
{
  type = "rtp";
  id = "10";
  description = "H.264 live stream #1";
  audio = "false";
  video = "true";
  videoport = "8004";
  videopt = "126";
  videortpmap = "H264/90000";
  videofmtp = "profile-level-id=42e01f;packetization-mode=1";
  secret = "adminpwd";
};

Jean-Baptiste Braun

unread,
Jan 8, 2021, 11:41:46 AM1/8/21
to Alessandro Toppi, meetecho-janus
Le lun. 4 janv. 2021 à 15:56, Alessandro Toppi <topp...@gmail.com> a écrit :
I have just tried and everything works as expected with this pipeline

gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1280,height=720,framerate=30/1 ! videoscale ! videorate ! videoconvert ! timeoverlay ! x264enc tune=zerolatency ! "video/x-h264,profile=baseline" ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=8004
Thank you very much. I've tried your pipeline and it works fine, on windows, no matter which browser I use (chrome, firefox, even opera !).

My initial tests were made on a debian bullseye, where firefox and chromium send back SDPs that don't seem to make sense. For the record on firefox :
v=0
o=mozilla...THIS_IS_SDPARTA-78.6.0 796498317747695147 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 2F:13:48:66:39:0C:F6:0C:1E:5E:C7:DE:AC:6C:7E:34:92:E9:94:3D:20:40:F8:74:60:54:0C:93:77:31:5E:6E
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:video
a=rtpmap:120 VP8/90000

Any clue why the OS would be an issue ? In what direction should I look for ?

Jbb

Lorenzo Miniero

unread,
Jan 10, 2021, 5:06:40 AM1/10/21
to meetecho-janus
That Firefox instance doesn't support H.264 in WebRTC. Probably you didn't download the openh264 library from where it's configured.

L.

Jean-Baptiste Braun

unread,
Jan 29, 2021, 11:08:15 AM1/29/21
to meetecho-janus
Thank you sooo much, people who replied and helped me figured it out. Indeed, for some reason the "OpenH264 Video Codec provided by Cisco Systems" plugin, which was installed by default, was also turned off by default.

I'm so happy right now :)

Jbb

--
You received this message because you are subscribed to a topic in the Google Groups "meetecho-janus" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/meetecho-janus/zcIqJplL0WI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to meetecho-janu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/meetecho-janus/64ea41ad-f3f1-4562-b171-9a4c8e1c20dfn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages