为什么有些人在输入和输出中分离实时流媒体协议?

时间:2018-01-29 06:08:02

标签: android streaming protocols

例如,有些人实现import numpy as np import cv2 import glob criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) objp = np.zeros((6*7,3), np.float32) objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2) objpoints = [] imgpoints = [] images = glob.glob('/usr/local/share/OpenCV/samples/cpp/chess*.jpg') img = cv2.imread("2.jpg") gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret = False ret, corners = cv2.findChessboardCorners(gray, (7, 6)) print (ret) if ret == True: objpoints.append(objp) cv2.cornerSubPix(gray, corners, (11,11), (-1,-1), criteria) imgpoints.append(corners) # Draw and display the corners cv2.drawChessboardCorners(img, (7,6), corners, ret) cv2.imshow('img',img) cv2.imwrite('Corners_detected.jpg', img, None) cv2.waitKey(0) cv2.destroyAllWindows() ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1],None,None) img = cv2.imread('2.jpg') h, w = img.shape[:2] newcameramtx, roi=cv2.getOptimalNewCameraMatrix(mtx,dist,(w,h),1,(w,h)) # undistort dst = cv2.undistort(img, mtx, dist, None, newcameramtx) cv2.imwrite('calibration_result.png',dst) 协议输入到服务器,然后实现RTMP协议输出。

在我看来,无论如何,在服务器上,编码HLS表单的媒体文件必须转换为RTMP格式。那他们为什么要这样做?

在输入中使用HLS效率不高吗?

1 个答案:

答案 0 :(得分:0)

RTMP协议比HLS更适合实时视频+音频传输。 HLS是基于块的协议,这意味着它具有延迟和显着的容器开销。 RTMP(就像RTSP,MPEGTS或SRT一样)针对实时传输进行了优化,因此最好用于实时输入。