改为 使用 rtsp 推流
This commit is contained in:
parent
61c24f6b04
commit
c639fd71ef
@ -6,7 +6,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "media.rtmp")
|
||||
public class ZlmRtmpConfig {
|
||||
int port = 1935;
|
||||
@ConfigurationProperties(prefix = "media.rtsp")
|
||||
public class ZlmRtspConfig {
|
||||
int port = 554;
|
||||
}
|
@ -26,7 +26,7 @@ import cn.skcks.docking.gb28181.media.proxy.ZlmMediaService;
|
||||
import cn.skcks.docking.gb28181.mocking.config.sip.DeviceProxyConfig;
|
||||
import cn.skcks.docking.gb28181.mocking.config.sip.FfmpegConfig;
|
||||
import cn.skcks.docking.gb28181.mocking.config.sip.ZlmHookConfig;
|
||||
import cn.skcks.docking.gb28181.mocking.config.sip.ZlmRtmpConfig;
|
||||
import cn.skcks.docking.gb28181.mocking.config.sip.ZlmRtspConfig;
|
||||
import cn.skcks.docking.gb28181.mocking.core.sip.message.processor.message.request.notify.dto.MediaStatusRequestDTO;
|
||||
import cn.skcks.docking.gb28181.mocking.core.sip.message.subscribe.SipSubscribe;
|
||||
import cn.skcks.docking.gb28181.mocking.core.sip.request.SipRequestBuilder;
|
||||
@ -91,7 +91,7 @@ public class DeviceProxyService {
|
||||
private final ZlmMediaService zlmMediaService;
|
||||
private final ZlmMediaConfig zlmMediaConfig;
|
||||
private final ZlmStreamChangeHookService zlmStreamChangeHookService;
|
||||
private final ZlmRtmpConfig zlmRtmpConfig;
|
||||
private final ZlmRtspConfig zlmRtspConfig;
|
||||
private final VideoCacheManager videoCacheManager;
|
||||
|
||||
private final String DEFAULT_ZLM_APP = "live";
|
||||
@ -174,7 +174,7 @@ public class DeviceProxyService {
|
||||
ScheduledFuture<?> schedule = trying(request);
|
||||
Flow.Subscriber<SIPRequest> task = ffmpegTask(request, callbackTask, callId, key, device);
|
||||
try {
|
||||
String zlmRtpUrl = getZlmRtmpUrl(DEFAULT_ZLM_APP, callId);
|
||||
String zlmRtpUrl = getZlmRtspUrl(DEFAULT_ZLM_APP, callId);
|
||||
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(schedule,request, device, key);
|
||||
Executor executor = pushRtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
||||
requestZlmPushStream(schedule, sendOkResponse, request, callId, fromUrl, toAddr, toPort, device, key, time, ssrc);
|
||||
@ -194,7 +194,7 @@ public class DeviceProxyService {
|
||||
ScheduledFuture<?> schedule = trying(request);
|
||||
Flow.Subscriber<SIPRequest> task = ffmpegTask(request, downloadTask, callId, key, device);
|
||||
try {
|
||||
String zlmRtpUrl = getZlmRtmpUrl(DEFAULT_ZLM_APP, callId);
|
||||
String zlmRtpUrl = getZlmRtspUrl(DEFAULT_ZLM_APP, callId);
|
||||
FfmpegExecuteResultHandler executeResultHandler = mediaStatus(schedule, request, device, key);
|
||||
Executor executor = pushDownload2RtpTask(fromUrl, zlmRtpUrl, time + 60, executeResultHandler);
|
||||
requestZlmPushStream(schedule, sendOkResponse, request, callId, fromUrl, toAddr, toPort, device, key, time, ssrc);
|
||||
@ -209,8 +209,8 @@ public class DeviceProxyService {
|
||||
};
|
||||
}
|
||||
|
||||
private String getZlmRtmpUrl(String app, String streamId){
|
||||
return "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/" + app +"/" + streamId;
|
||||
private String getZlmRtspUrl(String app, String streamId){
|
||||
return "rtsp://" + zlmMediaConfig.getIp() + ":" + zlmRtspConfig.getPort() + "/" + app +"/" + streamId;
|
||||
}
|
||||
|
||||
private ScheduledFuture<?> trying(SIPRequest request){
|
||||
@ -355,7 +355,7 @@ public class DeviceProxyService {
|
||||
.withStopStrategy(StopStrategies.stopAfterAttempt(3))
|
||||
.build();
|
||||
|
||||
String toUrl = "rtmp://" + zlmMediaConfig.getIp() + ":" + zlmRtmpConfig.getPort() + "/" + ZLM_FFMPEG_PROXY_APP +"/" + callId;
|
||||
String toUrl = "rtsp://" + zlmMediaConfig.getIp() + ":" + zlmRtspConfig.getPort() + "/" + ZLM_FFMPEG_PROXY_APP +"/" + callId;
|
||||
String key = GenericSubscribe.Helper.getKey(Request.BYE, callId);
|
||||
try {
|
||||
ZlmResponse<AddFFmpegSourceResp> sourceResp = retryer.call(() -> zlmMediaService.addFfmpegSource(AddFFmpegSource.builder()
|
||||
|
@ -60,8 +60,8 @@ gb28181:
|
||||
media:
|
||||
local:
|
||||
hook: http://10.10.10.200:18182/zlm/hook
|
||||
rtmp:
|
||||
port: 1935
|
||||
rtsp:
|
||||
port: 554
|
||||
ip: 10.10.10.200
|
||||
url: 'http://10.10.10.200:5080'
|
||||
# url: 'http://10.10.10.200:12580/anything/'
|
||||
@ -81,7 +81,7 @@ ffmpeg-support:
|
||||
ffprobe: /usr/bin/ffmpeg/ffprobe
|
||||
rtp:
|
||||
input: -re -i
|
||||
output: -vcodec h264 -acodec aac -f flv
|
||||
output: -vcodec h264 -acodec aac -f rtsp
|
||||
debug:
|
||||
download: false
|
||||
input: false
|
||||
|
@ -11,7 +11,7 @@ spring:
|
||||
# host: 192.168.1.241
|
||||
host: 10.10.10.200
|
||||
# [必须修改] 端口号
|
||||
port: 6379
|
||||
port: 16379
|
||||
# [可选] 数据库 DB
|
||||
database: 15
|
||||
# [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接
|
||||
@ -48,7 +48,8 @@ gb28181:
|
||||
# [可选]
|
||||
domain: 4405010000
|
||||
# [可选]
|
||||
id: 44050100002000000002
|
||||
#id: 44050100002000000002
|
||||
id: 44050100002000000009
|
||||
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
|
||||
password: 123456
|
||||
expire: 3600
|
||||
@ -58,17 +59,17 @@ gb28181:
|
||||
ip: 10.10.10.20
|
||||
# ip: 192.168.10.32
|
||||
# ip: 192.168.3.12
|
||||
port: 5063
|
||||
# port: 5061
|
||||
# port: 5060
|
||||
port: 5061
|
||||
password: 123456
|
||||
domain: 4405010000
|
||||
# id: 44050100002000000002
|
||||
id: 44050100002000000003
|
||||
id: 44050100002000000002
|
||||
# id: 44050100002000000003
|
||||
|
||||
media:
|
||||
local:
|
||||
hook: http://10.10.10.20:18182/zlm/hook
|
||||
delay: 100ms
|
||||
delay: 2000ms
|
||||
fixed: 0s
|
||||
ip: 10.10.10.200
|
||||
url: 'http://10.10.10.200:5081'
|
||||
@ -76,20 +77,22 @@ media:
|
||||
id: amrWMKmbKqoBjRQ9
|
||||
# secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
|
||||
secret: 4155cca6-2f9f-11ee-85e6-8de4ce2e7333
|
||||
rtmp:
|
||||
port: 1936
|
||||
rtsp:
|
||||
port: 554
|
||||
proxy:
|
||||
device:
|
||||
# 代理的视频接口地址, 用于获取历史视频
|
||||
# 参数 device_id, begin_time, end_time
|
||||
url: http://10.10.10.20:18186
|
||||
# url: http://10.10.10.20:
|
||||
url: http://10.10.10.200:18183
|
||||
use-download-to-playback: true
|
||||
proxy-video-in-time-range: true
|
||||
proxy-time-range: 5m
|
||||
pre-download-for-record-info:
|
||||
time-range: 5m
|
||||
cache-path: ./record
|
||||
# cache-path: ./record
|
||||
enable: true
|
||||
cache-path: G:/Temp/record
|
||||
ffmpeg-support:
|
||||
task:
|
||||
# 最大同时推流任务数, <= 0 时不做限制
|
||||
@ -97,14 +100,21 @@ ffmpeg-support:
|
||||
ffmpeg: D:\Soft\Captura\ffmpeg\ffmpeg.exe
|
||||
ffprobe: D:\Soft\Captura\ffmpeg\ffprobe.exe
|
||||
rtp:
|
||||
input: -thread_queue_size 128 -re -i http://10.10.10.200:5081/live/test.live.flv
|
||||
# input: -re -i
|
||||
output: -tune zerolatency -vcodec libx264 -acodec aac -preset ultrafast -vf scale=640:-1 -f flv #rtp_mpegts
|
||||
# output: -vcodec h264 -acodec aac -vf scale=640:-1 -f rtp_mpegts # -rtsp_transport tcp
|
||||
download: -i E:\Repository\other\happytime-gb28181-device-x64\666.mp4 -filter:v "setpts=4.0*PTS"
|
||||
#input: -thread_queue_size 128 -re -i http://10.10.10.200:5081/live/test.live.flv
|
||||
#input: -thread_queue_size 128 -re -i rtsp://admin:XXXXXX@10.10.11.171/Streaming/Channels/1/
|
||||
#input: -hwaccel cuda -re -i rtsp://10.10.11.200/camera/171
|
||||
input: -re -i
|
||||
# output: -tune zerolatency -vcodec libx264 -acodec aac -preset ultrafast -vf scale=640:-1 -f rtsp #flv #rtp_mpegts
|
||||
output: -c:v copy -an -preset ultrafast -flvflags no_duration_filesize -bf 0 -max_interleave_delta 0 -f rtsp #flv #rtp_mpegts
|
||||
download: -thread_queue_size 128 -i
|
||||
# output: -vcodec h264 -acodec aac -vf scale=640:-1 -f rtp_mpegts # -rtsp_transport tcp
|
||||
# download: -i E:\Repository\other\happytime-gb28181-device-x64\666.mp4 -filter:v "setpts=4.0*PTS"
|
||||
# download: -i E:\Repository\other\happytime-gb28181-device-x64\666.mp4 -filter:v "setpts=4.0*PTS
|
||||
debug:
|
||||
download: true
|
||||
input: true
|
||||
# download: true
|
||||
# input: true
|
||||
download: false
|
||||
input: false
|
||||
output: false
|
||||
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
|
@ -70,8 +70,8 @@ media:
|
||||
id: amrWMKmbKqoBjRQ9
|
||||
# secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc
|
||||
secret: 4155cca6-2f9f-11ee-85e6-8de4ce2e7333
|
||||
rtmp:
|
||||
port: 1937
|
||||
rtsp:
|
||||
port: 554
|
||||
proxy:
|
||||
device:
|
||||
# 代理的视频接口地址, 用于获取历史视频
|
||||
@ -105,7 +105,7 @@ ffmpeg-support:
|
||||
#output: -filter:v "setpts=4.0*PTS" -tune zerolatency -vcodec libx264 -acodec aac -preset ultrafast -vf scale=640:-1 -f flv
|
||||
# 下载 正常速率
|
||||
#output: -r 30 -tune zerolatency -vcodec libx264 -acodec aac -preset ultrafast -vf scale=640:-1 -f flv
|
||||
output: -c:v copy -an -preset ultrafast -flvflags no_duration_filesize -bf 0 -max_interleave_delta 0 -f flv
|
||||
output: -c:v copy -an -preset ultrafast -flvflags no_duration_filesize -bf 0 -max_interleave_delta 0 -f rtsp
|
||||
#output: -r 30 -vcodec libx264 -acodec aac -filter:v "setpts=1*PTS" -preset ultrafast -flvflags no_duration_filesize -bf 0 -max_interleave_delta 0 -f flv
|
||||
#download: -i E:\Repository\other\happytime-gb28181-device-x64\666.mp4 -filter:v "setpts=4.0*PTS"
|
||||
download: -i
|
||||
|
Loading…
Reference in New Issue
Block a user