Open S0mbre opened 3 months ago
Does this issues exists, when play the rtmp stream? You can play by ffplay or VLC, the url should be rtmp://MY-HOST.com/live/100
as such.
And, could you help to enable HLS, and check whether the HLS files is sync or not?
The HLS was in sync, but very, very slow. Actually, I couldn't manage to get HLS to play with satisfactory speed, so had to disable it. As to RTMP, I will check, but the live FLV streams are OK, video and audio is in sync. I also tried to switch to RTC via TCP, but it didn't help. There seems to be something wrong with transcoding from RTMP.
Update: I've checked RTMP - no sync issues found. So my previous guess appears right - something is wrong with DVR.
After converting RTC to RTMP, DVR muxes RTMP to FLV or MP4 file.
If RTMP is synced and FLV/MP4 is not synced, the most possible root cause may be:
BTW: What's your WebRTC client? Did you try Chrome, Firefox, or Safari? Did you try another different PC, like Mac or Windows? This can help us to reproduce the problem.
I use Chrome as client, but the problem persists even when using mobile clients (including Android Chrome and Apple Safari). As t recording to FLV, what code should I add to srs.conf to do that? I suppose, it should be somewhere in transcode
?
Not transcode of SRS, no need to change the config for SRS, you only need to record the RTMP by FFmpeg, for example:
ffmpeg -i rtmp://your-stream -c copy -f flv -y output.flv
Then you can check the output file.
Here's an example of off-sync DVR that I recorded just now.
https://github.com/ossrs/srs/assets/5337394/eb6e507f-cff4-474d-984b-b12ca20c74c9
As you can see, the audio is ahead of video.
Not transcode of SRS, no need to change the config for SRS, you only need to record the RTMP by FFmpeg, for example:
ffmpeg -i rtmp://your-stream -c copy -f flv -y output.flv
Then you can check the output file.
This method produces well-sync videos, I've checked both FLV and MP4 encoding. No issues found except for poor quality (maybe just my browser outputs a small picture size).
Thank you, I believe this issue is in the DVR module, not about streaming or even HLS.
OK, so the bug is accepted? I've managed to make DVR using manual ffmpeg in the stream on_publish
callback. I suggest making the same change in the SRS code. The ffmpeg command I use:
ffmpeg -i rtmp://<MY-STREAM> -async 1 -c:v copy -c:a copy -y OUTFILE.mp4
The -async 1
is required to cope with out-of-sync audio.
@S0mbre Indeed, the bug is accepted, and I appreciate your assistance. :)
Regrettably, I cannot commit to a specific deadline for resolving this bug, as it depends on the developers' time availability and interest. In summary, due to my lack of time and interest in this issue, I will not be rectifying it.
Everyone is welcome to address this bug, and if you wish to do so, please submit a pull request. The reproduction steps and background information on this issue are crucial, so thank you for clarifying this bug.
Describe the bug In SRS Stack 5, enabling DVR with any settings (including default) for the default vhost results in off-sync audio/video files when trying to record WebRTC streams. The problem is especially conspicuous for small video fragments (10 sec or less).
Version SRS Stack 5 (latest) via Docker:
ossrs/srs-stack:5
To Reproduce Steps to reproduce the behavior:
rtc_server { enabled on; listen 8000;
candidate $CANDIDATE; protocol udp;
reuseport 5; use_auto_detect_network_ip off; api_as_candidates off;
}
vhost defaultVhost {
}