Skip to content
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

DVR: The video frame rate is not normal after DVR WebRTC to FLV. #3809

Open
HappyManYun opened this issue Sep 23, 2023 · 3 comments
Open

DVR: The video frame rate is not normal after DVR WebRTC to FLV. #3809

HappyManYun opened this issue Sep 23, 2023 · 3 comments
Assignees
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.

Comments

@HappyManYun
Copy link

HappyManYun commented Sep 23, 2023

Note: Please read FAQ before file an issue, see #2716

Description

Please description your issue here

  1. SRS Version: 5 (This is about starting RTC to RTMP, DVR in a Docker environment)

  2. SRS Log:

No abnormalities

  1. SRS Config:
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

http_api {
    enabled         on;
    listen          1985;
}
stats {
    network         0;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
    candidate $CANDIDATE;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        rtmp_to_rtc on;
        rtc_to_rtmp on;
        pli_for_rtmp 0.5;
    }
    dvr {
        enabled         on;
        dvr_path        ./objs/nginx/html/dvr/[timestamp].flv;
    }
}

Replay

Please describe how to replay the bug?

Step 1: Add a canvas

<canvas id='canvasId' width='800px' height='500px'></canvas>

Step 2: Draw the animation

 setInterval(() => {
            var canvas = document.getElementById('canvasId');
            var canvasRenderingContext2D = canvas.getContext("2d");
            canvasRenderingContext2D.clearRect(0, 0, 800, 500);
            canvasRenderingContext2D.font = "20px Arial";
            canvasRenderingContext2D.fillStyle = "black";
            canvasRenderingContext2D.fillRect(0, 0, 800, 500);
            canvasRenderingContext2D.fillStyle = "white";
            canvasRenderingContext2D.fillText(new Date().toString(), 150, 240);
        }, 1000/30);

Step 3: Replace the video track with WebRTC

self.constraints = {
        audio: true,
        // video: {
        //     width: {ideal: 320, max: 576}
        // }
    };

var mediaStreamTrack = document.getElementById('canvasId').captureStream(30).getTracks()[0];
self.pc.addTrack(mediaStreamTrack);
self.ontrack && self.ontrack({track: mediaStreamTrack});

Expect

The VLC player is playing an RTMP stream at a frame rate of 1000, and the recorded video file also shows a frame rate of 1000 in VLC. If the recording length is ten minutes, you might not be able to drag the progress bar when playing it with flvjs.

TRANS_BY_GPT4

@winlinvip winlinvip changed the title 视频帧率异常 The video frame rate is not normal Sep 23, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Sep 23, 2023
@HappyManYun
Copy link
Author

HappyManYun commented Sep 23, 2023

This is the added canvas <canvas id='canvasId' width='800px' height='500px'></canvas>.

TRANS_BY_GPT4

@winlinvip
Copy link
Member

winlinvip commented Sep 24, 2023

Could you please submit a complete HTML+JS code? You can compress it into a zip file and upload it here as an attachment.

TRANS_BY_GPT4

@HappyManYun
Copy link
Author

players.zip

@winlinvip winlinvip self-assigned this Mar 30, 2024
@winlinvip winlinvip added the WebRTC WebRTC, RTC2RTMP or RTMP2RTC. label Mar 30, 2024
@winlinvip winlinvip changed the title The video frame rate is not normal DVR: The video frame rate is not normal after DVR WebRTC to FLV. Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT. WebRTC WebRTC, RTC2RTMP or RTMP2RTC.
Projects
None yet
Development

No branches or pull requests

2 participants