grpc传输大量数据python_通过GRPC播放传输的视频

我写了下面的代码在GRPC上传输视频。Im使用客户端流媒体。客户端通过流以帧形式发送视频。每个帧被转换为字节数据类型并被传输。在

但我的视频播放速度比实际速度慢。如何确保视频以实际速度播放?在

图像测试.proto文件syntax = "proto3";

option java_multiple_files = true;

option objc_class_prefix = "HLW";

// The greeting service definition.

service ImageTest {

// Sends a greeting

rpc Analyse (stream MsgRequest) returns (MsgReply) {}

}

// The request message containing the image.

message MsgRequest {

bytes img = 1;

}

// The response message containing the reply

message MsgReply {

int32 reply = 1;

}

图像测试_服务器.py

^{pr2}$

图像测试_客户端.pydef run():

channel = grpc.insecure_channel('localhost:50051')

stub = imageTest_pb2_grpc.ImageTestStub(channel)

response = stub.Analyse( generateRequests() )

def generateRequests():

videogen = skvideo.io.vreader(URL)

for frame in videogen:

frame = cv2.cvtColor( frame, cv2.COLOR_RGB2GRAY )

frame = bytes(frame)

yield imageTest_pb2.MsgRequest(img= frame)

if __name__ == '__main__':

run()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值