RtspServer
RtspServer copied to clipboard
时间戳问题
uint32_t H264Source::GetTimestamp() { /* #if defined(__linux) || defined(linux) struct timeval tv = {0}; gettimeofday(&tv, NULL); uint32_t ts = ((tv.tv_sec*1000)+((tv.tv_usec+500)/1000))*90; // 90: _clockRate/1000; return ts; #else */ auto time_point = chrono::time_point_castchrono::microseconds(chrono::steady_clock::now()); return (uint32_t)((time_point.time_since_epoch().count() + 500) / 1000 * 90 ); //#endif }
老哥你好 现象:
使用一些流行的开源转发中间件,诸如: ZLMediaKit
使用RtspServer.Push => ZLMediaKit 观看ZLMediaKit转发的RTSP,没问题(相当于Rtsp Proxy) 但如果打开ZLMediaKit转协议出来的HTTP-FLV流,就无法打开视频图像
综合我浅查的资料来看,应该就是时间戳造成的问题。 有2点可以帮助理解:
- 通过ffmpeg命令行推送的RTSP流到ZLMediaKit,无论哪种协议转换,都没问题;
- 如果在ZLMediaKit配置:覆盖时间戳,则可以看到视频,有轻度卡顿。
另外,RTP包的时间戳,好像是相对上一帧时间,而非绝对时间。
because of this https://github.com/PHZ76/RtspServer/issues/74