You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 12, 2023. It is now read-only.
KMS 6.61, GST 1.18.4 - RecorderEndpoint refuses to record H.264 to MP4 or MKV #641
The browser negotiates a H.264 connection successfully with KMS. After connecting a RecorderEndpoint to the WebRtcEndpoint the recording session is closed several seconds later.
Context
Browser let's KMS offer
Agrees on H.264. WebRtcEndpoint receives MediaTranscodingStateChange as NOT_TRANSCODING
Connecting prepared RecorderEnpoint (to local file, MP4_VIDEO_ONLY) on MediaFlowOutStateChange of WebRtcEndpoint.
RecorderEndpoint MediaFlowInStateChanged fires with FLOWING
RecorderEnpoint receives Recording event
The trace below appears in the KMS log 15 seconds later
RecordingEndpoint receives NOT_FLOWING event and is stopped then
Kurento Media Server version: 6.16.0
Found modules:
'core' version 6.16.1~15.gcf111ef4
'elements' version 6.16.1~19.gb38df49
'filters' version 6.16.1~3.gec9da10
'webrtcarucocode' version 0.1.6~14.g7bb9038
'webrtcbarcode' version 0.1.6~5.gfd167d4
'webrtccbr' version 0.1.6~7.gb9ddf5e
Hello @neilyoung! 👋 we're sorry you found a bug... so first of all, thank you very much for reporting it.
To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.
Additional observation: If the browser/KMS connection runs VP8, the recording starts. But the recorded file does not follow the resolution changes from 640x360 over 960x540 to 1280x720, but is stuck at 640x360 seemingly. And it contains an intra frame every 5 seconds as it seems.
changed the title [-]KMS 6.61, GST 1.18.4 - RecorderEndpoint refuses to record H.264 to MP4[/-][+]KMS 6.61, GST 1.18.4 - RecorderEndpoint refuses to record H.264 to MP4 or MKV[/+]on Nov 23, 2022
And - as with the recent RTSP client/server issue: The a.m. KMS log does NOT appear, if I feed the KMS with a constant resolution H.264 stream, coming e.g. from a drone. Perfect video as MP4. No transcoding. No resolution change. But most likely also no flexibility for changing conditions. The encoder on the other side is GStreamer v4l2h264enc.
Would it be possible to have a comment? I mean it is impossible to record H.246 to MP4 or MKV when the input stream changes resolution. Nobody concerned?
This might be something similar to what we found with GStreamer 1.18, while developing Kurento 7.0: #535
The issue was that, at some point, GStreamer stopped allowing renegotiation of resolution, thus it would halt the stream when one of those changes happened.
The ancient version of GStreamer 1.8 (which is what Kurento 6.x uses) didn't have this limitation, however according to your comments, it might be that the limitation didn't exist for WEBM, but it did actually exist for MP4 and MKV (albeit that'd surprise me because the MKV and WEBM codebases are practically the same).
You commented here #484 (comment) that this is precisely the issue. If that's the case, I guess the solution would be to see if GStreamer ended up adding more flexibility to the caps renegotiation, to allow for resolution changes, such as what they did for WEBM/Matroska as I linked here #535 (comment)
Yes, I agree. This is definitely a GStreamer qtmux thing.
For me it is now no longer an issue, because I completely dropped using KMS RecorderEndpoint (which relies on GStreamer). Instead I'm - depending on the video format of the publisher WebRtc stream - negotiating either a local VP8 or H.264 session with the publisher WebRtcEndpoint. Those RTP endpoints then internally feed spawned FFMPEG processes, which do the conversion to either MP4 or WEBM. Works perfectly, follows each caps change.
Activity
github-actions commentedon Nov 23, 2022
Hello @neilyoung! 👋 we're sorry you found a bug... so first of all, thank you very much for reporting it.
To know about progress, check in Triage. All issues are considered Backlog Candidates until work priorities align and the issue is selected for development. It will then become part of our official Backlog.
neilyoung commentedon Nov 23, 2022
Additional observation: If the browser/KMS connection runs VP8, the recording starts. But the recorded file does not follow the resolution changes from 640x360 over 960x540 to 1280x720, but is stuck at 640x360 seemingly. And it contains an intra frame every 5 seconds as it seems.
[-]KMS 6.61, GST 1.18.4 - RecorderEndpoint refuses to record H.264 to MP4[/-][+]KMS 6.61, GST 1.18.4 - RecorderEndpoint refuses to record H.264 to MP4 or MKV[/+]neilyoung commentedon Nov 23, 2022
And - as with the recent RTSP client/server issue: The a.m. KMS log does NOT appear, if I feed the KMS with a constant resolution H.264 stream, coming e.g. from a drone. Perfect video as MP4. No transcoding. No resolution change. But most likely also no flexibility for changing conditions. The encoder on the other side is GStreamer v4l2h264enc.
Does that all make sense?
neilyoung commentedon Nov 30, 2022
Would it be possible to have a comment? I mean it is impossible to record H.246 to MP4 or MKV when the input stream changes resolution. Nobody concerned?
j1elo commentedon Dec 27, 2022
This might be something similar to what we found with GStreamer 1.18, while developing Kurento 7.0: #535
The issue was that, at some point, GStreamer stopped allowing renegotiation of resolution, thus it would halt the stream when one of those changes happened.
The ancient version of GStreamer 1.8 (which is what Kurento 6.x uses) didn't have this limitation, however according to your comments, it might be that the limitation didn't exist for WEBM, but it did actually exist for MP4 and MKV (albeit that'd surprise me because the MKV and WEBM codebases are practically the same).
You commented here #484 (comment) that this is precisely the issue. If that's the case, I guess the solution would be to see if GStreamer ended up adding more flexibility to the caps renegotiation, to allow for resolution changes, such as what they did for WEBM/Matroska as I linked here #535 (comment)
j1elo commentedon Dec 27, 2022
Yeah, I found that something similar happened to the MP4 muxer, and they added a patch to allow resolution changes, around last year:
I'll do some tests and see if a similar patch is needed and can be integrated for Kurento 7.0, then look into backporting it to 6.x
neilyoung commentedon Dec 27, 2022
Yes, I agree. This is definitely a GStreamer qtmux thing.
For me it is now no longer an issue, because I completely dropped using KMS RecorderEndpoint (which relies on GStreamer). Instead I'm - depending on the video format of the publisher WebRtc stream - negotiating either a local VP8 or H.264 session with the publisher WebRtcEndpoint. Those RTP endpoints then internally feed spawned FFMPEG processes, which do the conversion to either MP4 or WEBM. Works perfectly, follows each caps change.