|
|
@@ -22,25 +22,37 @@ public class FFrtmpServer implements ApplicationRunner { |
|
|
|
@Override |
|
|
|
public void run(ApplicationArguments args) { |
|
|
|
try { |
|
|
|
CommandManager manager = new CommandManagerImpl(); |
|
|
|
/*CommandManager manager = new CommandManagerImpl(); |
|
|
|
// -rtsp_transport tcp |
|
|
|
//测试多个任何同时执行和停止情况 |
|
|
|
//false表示使用配置文件中的ffmpeg路径,true表示本条命令已经包含ffmpeg所在的完整路径 |
|
|
|
//manager.start("tomcat", "ffmpeg -i http://192.168.10.101:18000/flv/live/34020000001110000002_34020000001320000071_0200000071.flv -vcodec copy -acodec copy -f flv -y rtmp://192.168.10.101:19350/rlive/stream_9?sign=f8a15b6n",false); |
|
|
|
//manager.start("tomcat", "ffmpeg -i rtsp://192.168.144.25:554/stream=0 -vcodec copy -acodec copy -f flv -y rtmp://221.226.114.142:19350/rlive/stream_9?sign=f8a15b6n",false); |
|
|
|
//manager.start("tomcat1", "ffmpeg -i rtsp://192.168.144.25:554/stream=0 -vcodec copy -acodec copy -f flv -y rtmp://221.226.114.142:19350/rlive/stream_11?sign=rHtBg3sz",false); |
|
|
|
manager.start("test1", CommandBuidlerFactory.createBuidler() |
|
|
|
.add("ffmpeg").add("-i",cmdParam.getPlayUrl()) |
|
|
|
.add("-rtsp_transport","tcp") |
|
|
|
.add("-vcodec","copy") |
|
|
|
.add("-acodec","copy") |
|
|
|
.add("-f","flv") |
|
|
|
.add("-b:v", "2M") |
|
|
|
.add("-maxrate", "2M") |
|
|
|
.add("-bufsize", "1M") |
|
|
|
.add("-y").add(cmdParam.getPushUrl())); |
|
|
|
Thread.sleep(10000); |
|
|
|
manager.start("test2", CommandBuidlerFactory.createBuidler() |
|
|
|
if (cmdParam.getType()==1) { |
|
|
|
manager.start("test0", CommandBuidlerFactory.createBuidler() |
|
|
|
.add("ffmpeg").add("-i", cmdParam.getPlayUrl()) |
|
|
|
.add("-rtsp_transport","tcp") |
|
|
|
.add("-vcodec","copy") |
|
|
|
.add("-acodec","copy") |
|
|
|
.add("-f","flv") |
|
|
|
.add("-b:v", "2M") |
|
|
|
.add("-maxrate", "2M") |
|
|
|
.add("-bufsize", "1M") |
|
|
|
.add("-y").add(cmdParam.getPushUrl())); |
|
|
|
}else if (cmdParam.getType()==3) { |
|
|
|
manager.start("test1", CommandBuidlerFactory.createBuidler() |
|
|
|
.add("ffmpeg").add("-i", cmdParam.getPlayUrl()) |
|
|
|
.add("-rtsp_transport","tcp") |
|
|
|
.add("-vcodec","copy") |
|
|
|
.add("-acodec","copy") |
|
|
|
.add("-f","flv") |
|
|
|
.add("-b:v", "2M") |
|
|
|
.add("-maxrate", "2M") |
|
|
|
.add("-bufsize", "1M") |
|
|
|
.add("-y").add(cmdParam.getPushUrl())); |
|
|
|
Thread.sleep(5000); |
|
|
|
manager.start("test2", CommandBuidlerFactory.createBuidler() |
|
|
|
.add("ffmpeg").add("-i",cmdParam.getPlayUrl()) |
|
|
|
.add("-rtsp_transport","tcp") |
|
|
|
.add("-vcodec","copy") |
|
|
@@ -50,9 +62,23 @@ public class FFrtmpServer implements ApplicationRunner { |
|
|
|
.add("-maxrate", "2M") |
|
|
|
.add("-bufsize", "1M") |
|
|
|
.add("-y").add(cmdParam.getPushUrl2())); |
|
|
|
Thread.sleep(300000); |
|
|
|
}else if (cmdParam.getType()==4){ |
|
|
|
//单进程 多路 |
|
|
|
manager.start("test4", CommandBuidlerFactory.createBuidler() |
|
|
|
.add("ffmpeg").add("-i", cmdParam.getPlayUrl()) |
|
|
|
.add("-rtsp_transport", "tcp") |
|
|
|
.add("-vcodec", "copy") |
|
|
|
.add("-acodec", "copy") |
|
|
|
.add("-b:v", "2M") |
|
|
|
.add("-maxrate", "2M") |
|
|
|
.add("-bufsize", "1M") |
|
|
|
//多路推流测试 |
|
|
|
.add("-map", "0") |
|
|
|
.add("-f").add(cmdParam.getPushUrlMap())); |
|
|
|
} |
|
|
|
Thread.sleep(cmdParam.getTime()); |
|
|
|
// 停止全部任务 |
|
|
|
manager.stopAll(); |
|
|
|
manager.stopAll();*/ |
|
|
|
}catch (Exception e){ |
|
|
|
log.error("",e); |
|
|
|
} |