[*] 服务端录制
This commit is contained in:
@@ -228,21 +228,21 @@ taoyao:
|
||||
# SDP:VP8 | H264
|
||||
sdp: |
|
||||
v=0
|
||||
o=- 0 0 IN IP4 127.0.0.1
|
||||
o=- 0 0 IN IP4 %s
|
||||
s=TaoyaoRecord
|
||||
t=0 0
|
||||
m=audio %d RTP/AVP 97
|
||||
c=IN IP4 127.0.0.1
|
||||
a=rtpmap:97 opus/48000/2
|
||||
c=IN IP4 %s
|
||||
a=rtpmap:97 OPUS/48000/2
|
||||
a=fmtp:97 sprop-stereo=1
|
||||
m=video %d RTP/AVP 96
|
||||
c=IN IP4 127.0.0.1
|
||||
c=IN IP4 %s
|
||||
a=rtpmap:96 H264/90000
|
||||
a=fmtp:96 packetization-mode=1
|
||||
# 录像命令
|
||||
record: ffmpeg -y -protocol_whitelist "file,rtp,udp" -i %s %s
|
||||
record: ffmpeg -protocol_whitelist "file,rtp,udp" -y -i %s %s
|
||||
# 截图命令
|
||||
preview: ffmpeg -y -i %s -t %d -f image2 %s
|
||||
preview: ffmpeg -y -i %s -ss %d -vframes 1 -f image2 %s
|
||||
# 时长命令
|
||||
duration: ffprobe -i %s -show_entries format=duration
|
||||
# 存储目录
|
||||
@@ -251,6 +251,8 @@ taoyao:
|
||||
storage-image-path: /data/taoyao/storage/image
|
||||
# 视频存储目录
|
||||
storage-video-path: /data/taoyao/storage/video
|
||||
# 录像地址
|
||||
host: 127.0.0.1
|
||||
# 端口范围
|
||||
min-port: 50000
|
||||
max-port: 59999
|
||||
|
||||
@@ -11,22 +11,27 @@ public class RecorderTest {
|
||||
public void testStart() throws InterruptedException {
|
||||
final FfmpegProperties ffmpegProperties = new FfmpegProperties();
|
||||
ffmpegProperties.setStorageVideoPath("D:\\tmp\\video");
|
||||
ffmpegProperties.setMinPort(50000);
|
||||
ffmpegProperties.setMaxPort(59999);
|
||||
ffmpegProperties.setHost("127.0.0.1");
|
||||
ffmpegProperties.setSdp("""
|
||||
v=0
|
||||
o=- 0 0 IN IP4 127.0.0.1
|
||||
o=- 0 0 IN IP4 %s
|
||||
s=TaoyaoRecord
|
||||
t=0 0
|
||||
m=audio %d RTP/AVP 97
|
||||
c=IN IP4 127.0.0.1
|
||||
a=rtpmap:97 opus/48000/2
|
||||
c=IN IP4 %s
|
||||
a=rtpmap:97 OPUS/48000/2
|
||||
a=fmtp:97 sprop-stereo=1
|
||||
m=video %d RTP/AVP 96
|
||||
c=IN IP4 127.0.0.1
|
||||
c=IN IP4 %s
|
||||
a=rtpmap:96 H264/90000
|
||||
a=fmtp:96 packetization-mode=1
|
||||
""");
|
||||
ffmpegProperties.setRecord("ffmpeg -y -protocol_whitelist \"file,rtp,udp\" -i %s %s");
|
||||
final Recorder recorder = new Recorder(ffmpegProperties);
|
||||
ffmpegProperties.setRecord("ffmpeg -protocol_whitelist \"file,rtp,udp\" -y -i %s %s");
|
||||
ffmpegProperties.setPreview("ffmpeg -y -i %s -ss %d -vframes 1 -f image2 %s");
|
||||
ffmpegProperties.setDuration("ffprobe -i %s -show_entries format=duration");
|
||||
final Recorder recorder = new Recorder("taoyao", ffmpegProperties);
|
||||
recorder.start();
|
||||
Thread.sleep(20 * 1000);
|
||||
recorder.stop();
|
||||
|
||||
Reference in New Issue
Block a user