-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebRTC: Off-sync audio/video in DVR files #3993
Comments
Does this issues exists, when play the rtmp stream? You can play by ffplay or VLC, the url should be 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 |
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. livestream.1710817176050.1.mp4 |
As you can see, the audio is ahead of video. |
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 ffmpeg -i rtmp://<MY-STREAM> -async 1 -c:v copy -c:a copy -y OUTFILE.mp4 The |
@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. |
@winlinvip same issue |
Same issue here. |
CauseThe cause is the incorrect first stts entry value. check the doc:
srs/trunk/src/kernel/srs_kernel_mp4.hpp Lines 1573 to 1583 in 7951bf3
#4230 fixed this issue, try it. |
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:
https://MY-HOST.com/rtc/v1/whip/?app=live&stream=100&secret=SRS_PUB_SECRET
/data/record/live
) and download the resulting video(s), e.g.100.TIMESTAMP.mp4
dvr_path
in config for.....flv
and do steps 2-5 above. Same issue remains.Expected behavior
Expected fully-sync DVR files (mp4 or flv), with no data loss.
Additional context
For small videos, 10 sec or less, even video data is often lossy: the resulting DVR files get frozen or scrambled, with audio completely off-sync.
The text was updated successfully, but these errors were encountered: