Open TLexYuW opened 1 year ago
Hi,
Any update with this issue? I know Kurento is in low mantainance mode, but I think there are a possible compatibility issue in Kurento with new H264/X264 releases of 2024.
I reproduce same behaviour in iOS 17.4 devices in Safari. It happens 80% of connections. When everything works fine, there are no WARN/ERROR logs related to this, but sometimes, Kurento in latest version (7.0.1) prints:
(enabling MKV):
ERROR KurentoMediaElementImpl MediaElementImpl.cpp:456:processBusMessage:<kmsrecorderendpoint43> Error code 10: Could not multiplex stream., source: kmsrecorderendpoint43, element: kmsrecorderendpoint43, debug info: matroska-mux.c(991): gst_matroska_mux_can_renegotiate_caps (): /GstPipeline:pipeline59/GstMatroskaMux:avmuxer_matroskamux37:
Most caps changes are not supported by Matroska
Current: video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0164001effe100132764001eac131470781469b81010103c22119e01000428ee3cb0, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, framerate=(fraction)0/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
New: video/x-h264, codec_data=(buffer)0164001effe1001d6764001eacb40b077c44f80b706010540000030005dcd650003c58ba8001000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)338, height=(int)452, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
Enabling MP4:
0:12:09.842125763 12 0x7f21dde0f2a0 WARN qtmux gstqtmux.c:5118:gst_qt_mux_can_renegotiate:<avmuxer_mp4mux12> pad video_0 refused renegotiation to video/x-h264, codec_data=(buffer)0164001effe1001f6764001eacb40f028dff80a900a9b706010540000003005dcd650003c58ba801000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, pixel-aspect-ratio=(fraction)338/339, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
0:12:09.843460714 12 0x7f21dde0f2a0 WARN qtmux gstqtmux.c:5118:gst_qt_mux_can_renegotiate:<avmuxer_mp4mux12> pad video_0 refused renegotiation to video/x-h264, codec_data=(buffer)0164001effe1001f6764001eacb40f028dff80a900a9b706010540000003005dcd650003c58ba801000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, pixel-aspect-ratio=(fraction)338/339, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
0:12:09.843517636 12 0x7f21dde0f2a0 WARN basesrc gstbasesrc.c:3072:gst_base_src_loop:<avMuxerVideoSrc> error: Internal data stream error.
0:12:09.843527036 12 0x7f21dde0f2a0 WARN basesrc gstbasesrc.c:3072:gst_base_src_loop:<avMuxerVideoSrc> error: streaming stopped, reason not-negotiated (-4)
0:12:09.844702412 12 0x7f21dde0f2a0 WARN qtmux gstqtmux.c:5118:gst_qt_mux_can_renegotiate:<avmuxer_mp4mux12> pad video_0 refused renegotiation to video/x-h264, codec_data=(buffer)0164001effe1001f6764001eacb40f028dff80a900a9b706010540000003005dcd650003c58ba801000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, pixel-aspect-ratio=(fraction)338/339, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
0:12:09.844930737 12 0x7f22132bdb50 ERROR KurentoMediaElementImpl MediaElementImpl.cpp:456:processBusMessage:<kmsrecorderendpoint12> Error code 1: Internal data stream error., source: kmsrecorderendpoint12, element: kmsrecorderendpoint12, debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline15/GstAppSrc:avMuxerVideoSrc:
streaming stopped, reason not-negotiated (-4)
0:12:09.846331946 12 0x7f21dde0f2a0 WARN qtmux gstqtmux.c:5118:gst_qt_mux_can_renegotiate:<avmuxer_mp4mux12> pad video_0 refused renegotiation to video/x-h264, codec_data=(buffer)0164001effe1001f6764001eacb40f028dff80a900a9b706010540000003005dcd650003c58ba801000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, pixel-aspect-ratio=(fraction)338/339, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
0:12:09.847353331 12 0x7f21dde0f2a0 WARN qtmux gstqtmux.c:5118:gst_qt_mux_can_renegotiate:<avmuxer_mp4mux12> pad video_0 refused renegotiation to video/x-h264, codec_data=(buffer)0164001effe1001f6764001eacb40f028dff80a900a9b706010540000003005dcd650003c58ba801000468ef3cb0, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)high, width=(int)480, height=(int)640, pixel-aspect-ratio=(fraction)338/339, framerate=(fraction)0/1, interlace-mode=(string)progressive, colorimetry=(string)1:4:5:4, chroma-site=(string)mpeg2, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono
Curiously, we receive correctly images in our custom OpenCV filter (we're saving all frames Kurento receive for testing purposes) but final video is pixelated, trimmed, partially black... Could be related to transcoding or something like that?
According to GStreamer errors, it seems an incompatibility issue. Any light on that? By the way, I reproduce same behaviour in OpenVidu demo with Kurento backend.
Regards.
Could it be related to old issue https://github.com/Kurento/bugtracker/issues/535? As far as I saw in @j1elo comments, no fix was implemented (because matroska and VP8). I don't know if at least, you have a workaround.
Regards.
The problem is exactly issue https://github.com/Kurento/bugtracker/issues/535, as mentioned above, and it stems from this:
Current: video/x-h264, width=(int)480, height=(int)640
New: video/x-h264, width=(int)338, height=(int)452
Problem was that Kurento got upgraded to use the GStreamer dependency that comes with Ubuntu 20.04 (GStreamer 1.16), but it turns out that this came with breaking changes in behaviors (I guess at some point they considered it a bug but then changed their mind and considered it a regression, but in the meantime a release was cut, published, and ended up being part of Ubuntu).
Solution is not small as it would consist on researching a bit about that GStreamer issue, see which commits fixed the problem, then locate which releases already contain the commit(s) to be clear on what GStreamer version needs to be used. And then, the major part, upgrading Kurento to make it work with that version. It's not a trivial thing to do because GStreamer sometimes changes internals such that old code needs to be changed in order to use newer versions of the library.
I'd like to get some of my own time at some point to do the upgrade. For now, may I suggest you try using the latest available version of Kurento 6.x?
Seems that I had done the initial part that I mentioned:
https://github.com/Kurento/bugtracker/issues/535#issuecomment-1280626392
So GStreamer >= 1.20 seems to contain the fixes already. But as the next comment in that issue points out, there seem to be some other additional issues when using those newer versions of GStreamer!
No doubt, those corruption issues come probably from the fact that the user who tested with GStteamer 1.21 tried to use Kurento 7 as-is, without the work to adapt it to possible breaking changes. As expected, some work needs to be done explicitly to support newer versions of the library, it cannot be used as-is like nothing bad would happen.
Hi @j1elo
Thanks for your quick response. I think I 've understood properly root cause of problem.
I got your advice to rollback to previos Kurento versión (6.18.0) but I've been looking for a quick solution and I found (already deprecated) degradationPreference parameter (https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/setParameters#degradationpreference) and I think it could be a mitigation and possible cause of behaviour we're experiencing since iOS 17.4.
According to iOS 17.4 release notes, they "fixed" degradationPreference's "mantain-framerate" option (https://developer.apple.com/documentation/safari-release-notes/safari-17_4-release-notes#WebRTC) and It seems they fixed "balanced" option too (which is default value), so probable it's related to our recent problem.
When I have a chance to test It, I'll come back to share my results.
Regards.
Hi all,
In case it helps to anyone, issue for me is solved setting "degradationPreference" parameter to "mantain-resolution". Sample code:
private addMediaStreamTracks(stream: MediaStream, webRtcPeer: RTCPeerConnection) {
const tracksResponse = stream.getTracks();
tracksResponse.forEach((track: MediaStreamTrack) => {
if (webRtcPeer) {
const sender = webRtcPeer.addTrack(track, stream);
if(track.kind == 'video') {
track.contentHint = 'text';
const parameters = sender.getParameters();
parameters.degradationPreference = "maintain-resolution";
sender.setParameters(parameters);
}
}
});
}
Anyway, this is a mitigation because Kurento shouldn't crash. Do you have plans to upgrade it to latest version of Gstreamer? I think I could help in case is needed.
Regards.
Prerequisites
These are MANDATORY, otherwise the issue will be automatically closed.
Issue description
Context
I'm trying to accomplish this:
Application Server: Demo Project revised from Tutorial-GroupCall & focal-gstreamer-build-from-source (docker image)
GStreamer Core Library version 1.16.3
I pull media server image for test recording:
docker pull kurento/kurento-media-server
, and setup my own media server on AWS EC2 test recording separately.At Fisrt, I thought was Browser or JS WebRTC API problem, use different client to call application server
Browser Result: When first participant join room and room Created immediately recording Application Server Log & Media info
ERROR 26856 --- [EventExec-e2-t7] o.k.t.helloworld.HelloWorldRecHandler : [RecorderEndpoint::ErrorEvent] Error code 1: 'STREAM_ERROR_FAILED', source: d9431e68-3a83-46e3-b50b-ecfcde68d2e3_kurento.MediaPipeline/640aeaa9-a655-4066-b5c9-f6103d819010_kurento.RecorderEndpoint, timestamp: 1689673935353, tags: [], description: Error code 1: Internal data stream error., source: kmsrecorderendpoint2, element: kmsrecorderendpoint2, debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline4/GstAppSrc:videoSrc: streaming stopped, reason not-negotiated (-4)
Build my own docker image for Upgrade GStreamer Core Library Version to 1.20 / 1.22 Only: With this approach, it's challenging for me, especially I'm not familiar C programming language and Linux. I'm unsure if it will work or not, but I give it a try. However, still unable to recording and identify the root cause of the issue. with 1.20 / 1.22, Group-Call, media server same Log info:
with 1.20, media server Log info:
with 1.22, media server Log info:
I trace similar issues from past to present, I can't find any solution, or perhaps my issues not like these? :
#359, #372, #535, #641, #642
;How to reproduce?
Expected & current behavior
(Optional) Possible solution
Info about your environment
configs
WebRtcEndpoint.conf.ini
SdpEndpoint.conf.json
MediaElement.conf.ini
encoderBitrate=6000000
//...
minEncoderBitrate=2000000
//...
maxEncoderBitrate=6000000