SRS录像,发现统计直播时长和录像时长不一致。录像6hour,差了50s。
调查发现,on_publish事件和on_unpublish事件之间,差距就有4s。这4s是合理的,并不是录像视频丢失。
录像时长实际上是正确的,只是两个ts切片之间有视频计算上的丢失。平均两个ts之间就有15ms的时间被
gap。这个问题其实很好解决,上一个ts的end_time作为下一个ts的start_time就行了。
[16446][59hd9wz8] hls#1:start_dts=0,dts=8949,duration=8949000
[16446][59hd9wz8] hls#1:start_dts=8966,dts=8966,duration=0
On average, 15ms is lost for two ts. 1h lost 600*15=9s, 6 hours lost 54s.
[2021-03-31 07:58:27.215][Trace][19130][8571p0e1] publisher-stat: add publisher:127.0.0.1-live/ap01-1000
[2021-03-31 07:58:27.716][Trace][19130][8571p0e1] hls#1:start_dts=0,dts=0,duration=0
Start slicing, 0.5s later than the on_publish event. 3.5s after the end of slicing, the on_unpublish event is issued. The total difference is 4s.
[2021-03-31 07:58:45.257][Trace][19130][8571p0e1] hls#1:start_dts=8949000,dts=17912000,duration=8963000
[2021-03-31 07:58:48.711][Trace][19130][8571p0e1] publisher-stat: del publisher:127.0.0.1-live/ap01-1000
fixed and verified 3 times. difference is only 4s. that's normal.
[2021-03-31 08:39:44.387][Trace][20553][y86e90f6] publisher-stat-history: add {"uri":"live/ap01-1000","type":"rtmp","publisher_ip":"127.0.0.1","online":0,"start_ts":1617204747,"end_ts":1617205184,"duration":437}
hls-player shows video length is: 7:13
srs录像丢失调查,50s video lost when recording 6hrs.
最新推荐文章于 2024-05-09 13:00:54 发布