|
发表于 2020-5-6 18:41:36
|
显示全部楼层
谢谢回答,注释掉可以import。但是跑起来后一直卡在rtsp.read_rgb()这里使用的是海康摄像头,rtsp流确认过是正常的,请教下问题出在哪?代码如下:
- #!/usr/bin/env python3.6
- import os
- import toybrick as toy
- import time
- import threading
- if __name__ == '__main__':
- #url = "rtsp://cxqz:hb123456@192.168.1.64:554/ch1/main/av_stream"
- url = "rtsp://192.168.1.64:554/ch1/main/av_stream"
- usr = "cxqz"
- pwd = "hb123456"
- rtsp = toy.input.createRtspClient(url, usr, pwd)
- rtsp.connect()
- last = time.time()
- if rtsp.is_opened():
- print("hutx test")
- frame = rtsp.read_rgb(1280, 720)
- print("frame")
- now = time.time()
- print("> got frame. use = %.4f s" % (now - last, ))
- last = now
- rtsp.disconnect()
输出信息:
- [toybrick@toybrick hutx]$ python3 test_rtsp.py
- [05/06 06:30:45.214] D/: listening rtp port 57601
- [05/06 06:30:45.215] D/: listening rtcp port 57602
- [05/06 06:30:45.214] D/: mMppCtx null or no init...
- [05/06 06:30:45.215] D/: curlto rtsp://192.168.1.64:554/ch1/main/av_stream , cli 57601:57611, tcp: 0
- [05/06 06:30:45.231] D/: # Found [0] media: video
- [05/06 06:30:45.231] D/: # Found [0] control: rtsp://192.168.1.64:554/ch1/main/av_stream/trackID=1
- [05/06 06:30:45.231] D/: # Found [0] rtpmap: id:96 format:H264 bitrate:90000
- [05/06 06:30:45.231] D/: # Found [1] media: audio
- [05/06 06:30:45.231] D/: # Found [1] control: rtsp://192.168.1.64:554/ch1/main/av_stream/trackID=2
- [05/06 06:30:45.231] D/: # Found [1] rtpmap: id:8 format:PCMA bitrate:8000
- [05/06 06:30:45.231] D/: # Total found 2 channel(s).
- [05/06 06:30:45.231] D/: TRACK [0] : rtsp://192.168.1.64:554/ch1/main/av_stream/trackID=1 , format=1
- [05/06 06:30:45.231] D/: setup 57601 , 57602, uri: rtsp://192.168.1.64:554/ch1/main/av_stream/trackID=1
- [05/06 06:30:45.235] D/: TRACK [1] : rtsp://192.168.1.64:554/ch1/main/av_stream/trackID=2 , format=4
- hutx test
- [05/06 06:30:45.328] D/: drm render open ...
- [05/06 06:30:45.458] D/: Video SSRC Changed! 0 -> 1157631790
- mpi: mpp version: Without VCS info
- mpp_rt: NOT found ion allocator
- mpp_rt: found drm allocator
- [05/06 06:30:45.466] D/: aaaaaaaaaaaaaaa
- [05/06 06:30:45.466] D/: 11111111
- [05/06 06:30:45.466] D/: bbbbbbbbbbbbbb
- [05/06 06:30:45.466] D/: aaaaaaaaaaaaaaa
- [05/06 06:30:45.466] D/: bbbbbbbbbbbbbb
- [05/06 06:30:45.467] D/: aaaaaaaaaaaaaaa
- [05/06 06:30:45.467] D/: bbbbbbbbbbbbbb
- [05/06 06:30:45.647] D/: aaaaaaaaaaaaaaa
- [05/06 06:30:45.647] D/: bbbbbbbbbbbbbb
- [05/06 06:30:45.767] D/: aaaaaaaaaaaaaaa
|
|