【ZLM】ZLM源码阅读二----RTP推流

目录

推流

收流与处理

 播放

 参考 


rtmp rtsp 等推流比较方便,参考

【音视频】利用ffmpeg实现:音视频的提取,rtmp推流等_dualven_in_csdn的博客-CSDN博客

推流

只放视频

ffmpeg.exe -f dshow -i video="XiaoMi USB 2.0 Webcam"  -vcodec libx264   -f rtp_mpegts rtp://10.60.100.196:10000

 音视频都放

ffmpeg.exe -f dshow -i audio="麦克风 (Realtek High Definition Audio)" -rtbufsize 1000M -thread_queue_size 1024 -f dshow   -i video="XiaoMi USB 2.0 Webcam"  -vcodec libx264   -acodec aac -f rtp_mpegts rtp://10.60.100.196:10000

收流与处理

看下面的getMediaList好像只提供rtmp的播放;且推在196上可以听到声音;

如果推194 也不需要secret,但好像audio不知道为啥ignore了 ;且在194上的推流列表看不到;(rtmp推流是可以看到的) 。这些都可以去代码里印证下。

194上的:

2023-05-31 16:49:10.103 I [MediaServer] [33-event poller 5] RtpProcess.cpp:263 operator() | 6752663F(10.60.100.159:60212) 允许RTP推流
2023-05-31 16:49:10.130 I [MediaServer] [33-event poller 5] GB28181Process.cpp:174 onRtpDecode | 6752663F judged to be TS
2023-05-31 16:49:10.130 I [MediaServer] [33-event poller 5] Decoder.cpp:240 onTrack | got track: H264
2023-05-31 16:49:10.130 I [MediaServer] [33-event poller 5] MediaSink.cpp:28 addTrack | Audio disabled, audio track ignored

196上的: 

{
	"code": 0,
	"data": [
		{
			"aliveSecond": 93,
			"app": "rtp",
			"bytesSpeed": 5489,
			"createStamp": 1685431350,
			"isRecordingHLS": true,
			"isRecordingMP4": false,
			"originSock": {
				"identifier": "8CA212E7",
				"local_ip": "10.60.3.118",
				"local_port": 10000,
				"peer_ip": "10.60.100.159",
				"peer_port": 57996
			},
			"originType": 3,
			"originTypeStr": "rtp_push",
			"originUrl": "rtp://__defaultVhost__/rtp/8CA212E7",
			"readerCount": 0,
			"schema": "rtmp",
			"stream": "8CA212E7",
			"totalReaderCount": 0,
			"tracks": [
				{
					"codec_id": 0,
					"codec_id_name": "H264",
					"codec_type": 0,
					"fps": 30,
					"frames": 2384,
					"gop_interval_ms": 7887,
					"gop_size": 250,
					"height": 480,
					"key_frames": 12,
					"ready": true,
					"width": 640
				},
				{
					"channels": 1,
					"codec_id": 2,
					"codec_id_name": "mpeg4-generic",
					"codec_type": 1,
					"frames": 623,
					"ready": true,
					"sample_bit": 16,
					"sample_rate": 8000
				}
			],
			"vhost": "__defaultVhost__"
		},
		{
			"aliveSecond": 2,
			"app": "rtp",
			"bytesSpeed": 50453,
			"createStamp": 1685431440,
			"isRecordingHLS": true,
			"isRecordingMP4": false,
			"originSock": {
				"identifier": "73CF8E4F",
				"local_ip": "10.60.3.118",
				"local_port": 10000,
				"peer_ip": "10.60.100.159",
				"peer_port": 59689
			},
			"originType": 3,
			"originTypeStr": "rtp_push",
			"originUrl": "rtp://__defaultVhost__/rtp/73CF8E4F",
			"readerCount": 0,
			"schema": "rtmp",
			"stream": "73CF8E4F",
			"totalReaderCount": 0,
			"tracks": [
				{
					"codec_id": 0,
					"codec_id_name": "H264",
					"codec_type": 0,
					"fps": 30,
					"frames": 74,
					"gop_interval_ms": 21,
					"gop_size": 1,
					"height": 480,
					"key_frames": 2,
					"ready": true,
					"width": 640
				},
				{
					"channels": 1,
					"codec_id": 2,
					"codec_id_name": "mpeg4-generic",
					"codec_type": 1,
					"frames": 20,
					"ready": true,
					"sample_bit": 16,
					"sample_rate": 8000
				}
			],
			"vhost": "__defaultVhost__"
		}
	]
}

 播放

ffplay rtp://10.60.100.196:10000/rtp/8CA212E7

也可以听到声音 

 参考 

ZLMediaKit推流测试 · ZLMediaKit/ZLMediaKit Wiki (github.com)

猜你喜欢

转载自blog.csdn.net/dualvencsdn/article/details/130949687
今日推荐