WebRTC:webrtc推流,2-3s才推送1帧的视频流录制的flv视频播放失败
视频推流部分时间是1s20多帧,部分时间2-3s1帧,这部分2-3s才推送1帧的会播放失败
Description(描述)
2-3s才推送1帧的视频流,能录制,webrtc能实时播放,但是录制的视频会播放失败,推送5分钟,播放一瞬间。
-
SRS Version(版本):
4.0.212 -
SRS Log(日志):
附件
- SRS Config(配置):
listen 13425;
max_connections 1000;
daemon on;
srs_log_tank file;
http_server {
enabled on;
listen 13423;
# 配置一个空目录,以禁止使用
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
raw_api {
enabled on;
allow_reload on;
allow_query on;
allow_update on;
}
}
stats {
network 0;
}
rtc_server {
enabled on;
listen 13427; # UDP port
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#config-candidate
# candidate $CANDIDATE;
candidate 192.168.3.90;
}
vhost __defaultVhost__ {
rtc {
enabled on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
http_hooks {
enabled on;
on_unpublish http://cc-web-1:8090/web/srs/actionSrs; # ucare的回调,断开这个推流的其他的流
}
}
vhost saveVhost {
rtc {
enabled on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
dvr {
enabled on;
dvr_path /usr/local/stuff/srs/srs.oschina-4.0release/trunk/objs/nginx/html/dvrfile/saveVhost/[app]/[stream]/[timestamp].flv;
dvr_plan segment;
dvr_duration 3600; # 1时一个视频
dvr_wait_keyframe on;
dvr_apply all;
}
http_hooks {
enabled on;
on_unpublish http://cc-web-1:8090/web/srs/actionSrs; # ucare的回调,断开这个推流的其他的流
on_dvr http://cc-web-1:8090/web/srs/actionSrs; # ucare的回调,断开这个推流的其他的流
}
}
vhost test {
rtc {
enabled on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtmp-to-rtc
rtmp_to_rtc on;
# @see https://github.com/ossrs/srs/wiki/v4_CN_WebRTC#rtc-to-rtmp
rtc_to_rtmp on;
}
http_remux {
enabled on;
mount [vhost]/[app]/[stream].mp4;
}
dvr {
enabled on;
dvr_path /usr/local/stuff/srs/srs.oschina-4.0release/trunk/objs/nginx/html/dvrfile/test/[app]/[stream]/[timestamp].mp4;
dvr_plan segment;
dvr_duration 3600; # 1时一个视频
dvr_wait_keyframe on;
dvr_apply all;
}
http_hooks {
enabled on;
}
}
Replay(重现)
推送视频的时候,2-3s推送1帧,录制的视频无法播放
Expect(期望行为)
希望推送这么慢的也能正常录制,正常播放
Are you using WebRTC for streaming? Is the recorded content normal? Are there any instances of fast-forwarding or slow playback?
TRANS_BY_GPT3
@winlinvip When streaming with WebRTC, it can immediately play and generate a temporary video file. However, it takes 5-6 seconds to start recording with the above configuration. I changed the configuration to the following (pli_for_rtmp 0.5;) and after streaming, it can start recording in about 0.5 seconds. However, it can only save videos with 8 frames per second, and streams with 1 frame every 3 seconds still cannot be saved.
listen 1935;
max_connections 1000;
daemon on;
srs_log_tank file;
## Disable version check
query_latest_version off;
http_server {
enabled on;
listen 8080;
dir ./objs/nginx/html;
}
http_api {
enabled on;
listen 1985;
raw_api {
enabled on;
allow_reload on;
allow_query on;
allow_update on;
}
}
## WebRtc Configuration
rtc_server {
enabled on;
listen 18000;
candidate *;
api_as_candidates off;
}
vhost saveVhost {
tcp_nodelay on;
# Enable Low Latency Mode
min_latency on;
play {
# If minimum latency is required, set it to off;
# If fast client startup is required, set it to on.
gop_cache off;
# Maximum real-time queue length (in seconds).
queue_length 10;
# atc on;
# mix_correct on;
mw_latency 100;
}
publish {
mr off;
}
# Play webrtc
rtc {
enabled on;
rtmp_to_rtc on;
rtc_to_rtmp on;
stun_timeout 5;
stun_strict_check on;
nack on;
twcc on;
pli_for_rtmp 0.5;
}
# Play flv
http_remux {
enabled on;
mount [vhost]/[app]/[stream].flv;
}
dvr {
enabled on;
# The address cannot use relative address, otherwise the callback address will also be a relative address, and the callback interface cannot handle it.
dvr_path /usr/local/stuff/srs413/trunk/objs/nginx/html/dvrfile/[vhost]/[app]/[stream]/[timestamp].flv;
dvr_plan segment;
dvr_duration 3600; # 1 hour per video
dvr_wait_keyframe off;
dvr_apply all;
}
http_hooks {
enabled off;
}
}
`TRANS_BY_GPT3`
1660126459708.zip This is a recorded video that was pushed for several minutes, but after the recording was completed, it cannot be played.
TRANS_BY_GPT3
dvr setting time_jitter zero; The video can be recorded normally, but previously the webRTC streaming could be played immediately, now it takes almost 20 seconds to start playing, and the video also starts recording at this time.
TRANS_BY_GPT3