Skip to content

WebRTC: Off-sync audio/video in DVR files #3993

Open
@S0mbre

Description

@S0mbre

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:

  1. Use the following bare-bones server config:
server_id           srs-server;
listen              1935;
max_connections     1000;
daemon              on;
disable_daemon_for_docker off;
utc_time            on;
ff_log_dir          /data/ffmpeg_logs;

rtc_server {
    enabled         on;
    listen          8000;          
    candidate       $CANDIDATE;
    protocol        udp;            
    reuseport       5;
    use_auto_detect_network_ip off;
    api_as_candidates off;    
}

vhost __defaultVhost__ {

    # General settings
    tcp_nodelay         on;
    min_latency         on;

    # WebRTC
    rtc {
        enabled         on;
        nack            on;
        twcc            on;
        rtmp_to_rtc     off;
        rtc_to_rtmp     on;
    }

    # Digital Video Recording
    dvr {
        enabled         on;
        dvr_apply       all;
        dvr_plan        session;
        dvr_path        /data/record/[app]/[stream].[timestamp].mp4;    # tried also ...flv, but no effect
        dvr_wait_keyframe       on;
        time_jitter             full;  # full / zero
    }
}
  1. Create a WebRTC stream by publishing to https://MY-HOST.com/rtc/v1/whip/?app=live&stream=100&secret=SRS_PUB_SECRET
  2. Go to your DVR path (/data/record/live) and download the resulting video(s), e.g. 100.TIMESTAMP.mp4
  3. Observe off-sync audio/video.
  4. Replace 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.

Metadata

Metadata

Assignees

Labels

EnglishNativeThis issue is conveyed exclusively in English.WebRTCWebRTC, RTC2RTMP or RTMP2RTC.good first issueEasy to fix issues, good for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions