This repository has been archived by the owner on Jul 12, 2023. It is now read-only.
Duration of recordings is not consistent #570
Labels
enhancement
Potential improvement or feature request
known-issues
Known issues that users find frequently
RecorderEndpoint
Prerequisites
These are MANDATORY, otherwise the issue will be automatically closed.
Issue description
Original report & technical details:
recording duration not consistent
https://groups.google.com/g/kurento/c/yVMyJNUP1JU/m/Bou842wsDQAJ
Kurento 6.15.0 fixed an issue that affected how RecorderEndpoint generates files from incomplete RTP streams: Fixed Recorder synchronization on streaming gaps.
The issue here was that incoming RTP streams (from WebRTC, RTSP, or RTP) can suffer from packet loss when the network is congested. The NACK mechanisms in WebRTC try to help with this, by asking for packet retransmissions, but at the end of the day some RTP packets are definitely lost and not recoverable.
This, when stored into a local file, would yield a recording which contained "gaps" within the media streams. And these gaps were able to cause synchronization issues, depending on the player used. The player included in Chrome is most sensible to these gaps, and they would make the audio and video in the file to go out of sync.
However other players such as FFplay (which uses FFmpeg) were fine and able to dynamically adapt the playback rate and/or "fill in the blanks" to provide a smooth playback.
After the fix, Kurento adjusts the timestamps of all buffers, so that gaps are taken into account and removed from the resulting file. This produces recordings that are perfectly playable directly in Chrome, but on the other hand, the total duration of these files has been reduced by an amount equal to the cumulative time of the gaps.
This poses a problem for users who expect to do individual recordings of each participant, with the intention of playing them back all at the same time. With the previous recording method, these would all have the same length and would somewhat keep a reasonable synchronization between them; with the new method, each file has a different duration, so it is not possible to play them back together and obtain a coherent conversation.
Also, the issue with gaps was not a problem for those users who would anyway perform a post-processing step with FFmpeg or similar tools, in order to convert formats. This kind of post-processing would naturally remove all gaps that might exist within the file.
Due to this, we're going to add a user-settable configuration option that allows choosing between gap-less recording, or ignoring gaps. This way users can choose their own compromise.
Context
An example can make it much clear:
Assume a stream that plays for 5 seconds, then there is a 5 seconds gap (in practice, it is more common to have lots of very small, milliseconds gaps), then recovers again for 5 seconds. In total, the resulting video should take 15 seconds. Also, for simplicity, assume a 1 frame per second stream. As it was until Kurento 6.15, the RecorderEndpoint would store each frame with its timestamp as follows:
Technically, this was a bug in the RecorderEndpoint, because local files should never contain gaps, and this could be perfectly considered an invalid file that should not be playable.
The changes introduced in Kurento 6.15 would store the file as follows:
Thus providing a correct file without gaps, but reducing its length to 10 seconds instead of 15.
About Kurento Media Server
The text was updated successfully, but these errors were encountered: