Prerequisites
These are MANDATORY, otherwise the issue will be automatically closed.
Issue description
There appears to be a serious issue with RTP transmission in Kurento 7.2.0. When sending WebRTC input to FFmpeg via RTP endpoints for HLS output, the resulting TS files have severely corrupted metadata. In particular, the timestamps and duration information are completely wrong.
Specifically:
- The metadata duration is vastly different from the actual content length (metadata shows several hours for content that is only a few seconds long)
- Audio and video timestamps are significantly out of sync (approximately 22 hours difference)
- Timestamp continuity between consecutive segments is not maintained
This issue did not occur in Kurento 6 and only appeared after migrating to Kurento 7, suggesting that the change in timestamp units from seconds to milliseconds might be the root cause.
Context
We are developing a service that composites WebRTC calls and sends them to streaming servers (like Wowza) via RTP for HLS distribution. Everything worked correctly with Kurento 6, but after upgrading to Kurento 7, these issues have emerged.
This severely impacts the quality of our generated HLS streams and affects our service quality.
How to reproduce?
- Prepare the following SDP and save it to a file (test.sdp):
v=0
o=- 0 0 IN IP4 192.168.1.217
s=Streaming Session
c=IN IP4 192.168.1.217
t=0 0
m=video 5004 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42e01f;packetization-mode=1
a=recvonly
m=audio 5006 RTP/AVP 97
a=rtpmap:97 opus/48000/2
a=recvonly
- Run the following FFmpeg command to listen for RTP connections:
ffmpeg -protocol_whitelist file,udp,rtp -i test.sdp \
-map 0:v -c:v copy \
-map 0:a -c:a aac -b:a 128k \
-f hls \
-hls_time 4 \
-hls_playlist_type event \
-hls_segment_filename "hls/stream_%03d.ts" \
hls/playlist.m3u8
-
Build one of the following pipelines in Kurento:
a. WebRtcEndpoint -> RtpEndpoint (sending to IP and ports specified in the SDP)
b. WebRtcEndpoint -> Composite -> RtpEndpoint (sending to IP and ports specified in the SDP)
-
Connect a WebRTC client to Kurento and start streaming
-
Analyze the generated HLS TS files with ffprobe to observe timestamp and duration anomalies
Expected & current behavior
Expected behavior:
- Each TS segment's metadata matches the actual content length
- Audio and video timestamps are synchronized
- Timestamp continuity is maintained between consecutive segments
Actual behavior:
- Metadata duration is abnormal (e.g., showing 22 hours 33 minutes for 6-second content)
- Large discrepancy between audio and video timestamps (approximately 22 hours difference)
- Bitrates are recorded with abnormally low values
Example ffprobe output:
Input #0, mpegts, from 'stream_001.ts':
Duration: 22:33:06.22, start: 14281.163922, bitrate: 0 kb/s
...
Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(progressive), 800x600, 15 fps, 15 tbr, 90k tbn
start_time=14281.163922
duration=6.000011
Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 130 kb/s
start_time=95461.388522
duration=5.994667
Possible solution
The timestamp handling in Kurento 7 needs to be examined, particularly during WebRTC to RTP conversion. The issue may be related to the change in timestamp units from seconds to milliseconds that occurred when migrating from Kurento 6 to 7.
A review of the RtpEndpoint implementation, especially the parts handling timestamp and PTS calculation/conversion, may be necessary.
Info about your environment
Pipeline configuration:
- WebRtcEndpoint -> RtpEndpoint (direct connection)
- Or WebRtcEndpoint -> Composite -> RtpEndpoint (connection after composition)
Network configuration:
- All components are located within the same local network
- No STUN or TURN is used (all local connections)
About Kurento Media Server
- Kurento version: 7.2.0
- Server OS: Ubuntu 24.04
- Installation method:
About your Application Server
- Programming Language: Scala
- Kurento Client version: 7.2.0
About end-user clients
- Device(s): iPhone
- OS(es): iOS 16.7.8
hls_composite.zip
hls_direct.zip
Prerequisites
These are MANDATORY, otherwise the issue will be automatically closed.
Issue description
There appears to be a serious issue with RTP transmission in Kurento 7.2.0. When sending WebRTC input to FFmpeg via RTP endpoints for HLS output, the resulting TS files have severely corrupted metadata. In particular, the timestamps and duration information are completely wrong.
Specifically:
This issue did not occur in Kurento 6 and only appeared after migrating to Kurento 7, suggesting that the change in timestamp units from seconds to milliseconds might be the root cause.
Context
We are developing a service that composites WebRTC calls and sends them to streaming servers (like Wowza) via RTP for HLS distribution. Everything worked correctly with Kurento 6, but after upgrading to Kurento 7, these issues have emerged.
This severely impacts the quality of our generated HLS streams and affects our service quality.
How to reproduce?
Build one of the following pipelines in Kurento:
a. WebRtcEndpoint -> RtpEndpoint (sending to IP and ports specified in the SDP)
b. WebRtcEndpoint -> Composite -> RtpEndpoint (sending to IP and ports specified in the SDP)
Connect a WebRTC client to Kurento and start streaming
Analyze the generated HLS TS files with ffprobe to observe timestamp and duration anomalies
Expected & current behavior
Expected behavior:
Actual behavior:
Example ffprobe output:
Possible solution
The timestamp handling in Kurento 7 needs to be examined, particularly during WebRTC to RTP conversion. The issue may be related to the change in timestamp units from seconds to milliseconds that occurred when migrating from Kurento 6 to 7.
A review of the RtpEndpoint implementation, especially the parts handling timestamp and PTS calculation/conversion, may be necessary.
Info about your environment
Pipeline configuration:
Network configuration:
About Kurento Media Server
About your Application Server
About end-user clients
hls_composite.zip
hls_direct.zip