如何寻找RTP流中的特定时间?
我正在流式传输预先录制的 H264 视频,其结构如下:
[I] [x] [x] [x] [I] [x] [x] [x] [I]...
在 IDR 之间(在我的结构中),我有 32 个(此处仅显示 3 个)其他帧(所有其他不是 IDR 的内容,如 SEI、SPS、PPS .. .X-es)
现在,假设我的帧的时序是这样的:
TIME: 1 2 3 4 5 6 7 8 9
FRAME: [I] [x] [x] [x] [I] [x] [x] [x] [I]...
现在我想查找时间 4。如果我查找该帧并发送它,图片会变得混乱,因为解码器需要 IDR为了正确解码它,所以我求助于找到适当的 IDR(在本例中是时间 1 的 IDR)并将其作为时间 4 的帧发送。所以现在图片已正确解码,一切都很好......但是。 ..如果我的GOV是32,并且我需要发送索引为31的非IDR帧,并且如果它和相应的IDR之间的时间跨度是3秒,那么我实际上比我想要的时间早了3秒。现在,这并不精确,因为我无法寻求政府时间跨度的一半。另外,我无法设置较小的 GOV,所以我想要其他想法...
我的另一个想法是发送最后一个已知的 IDR,然后发送在我想要的帧之前的所有其他非 IDR 帧,只有我会为所有它们的RTP-TIME与相应的IDR相同。在这种情况下,图片可以完美解码,但现在在上述情况下,非 IDR 帧之后的 3 秒所需时间在解码器/播放器中速度加快(没有瞬时搜索)...
有什么想法吗?或者我只能寻找 IDR-s 而不能寻找中间的帧?
I am streaming a prerecorded H264 video that has the following structure:
[I] [x] [x] [x] [I] [x] [x] [x] [I]...
In between the IDR (I-s in my structure) I have 32 (only 3 presented here) other frames (all other stuff that is not IDR like SEI, SPS, PPS... X-es)
Now, let assume that the timing of my frames is such:
TIME: 1 2 3 4 5 6 7 8 9
FRAME: [I] [x] [x] [x] [I] [x] [x] [x] [I]...
Now i want to seek to the time 4. If I seek to that frame, and send it, the picture gets messed up because the decoder needs a IDR to decode it properly, so I resorted to finding the appropriate IDR (in this case one with the time 1) and sending it as the frame with the time 4. So now the picture is decoded properly, all is well... but... If my GOV is 32, and I need to send the non IDR frame that has the index 31, and if the time span between it and the corresponding IDR is 3 seconds, I actually get 3 seconds earlier then the time I want. Now, this is not precise, because I cannot seek to the half of the GOV time span. Also, I cant set smaller GOV, so I want other ideas...
My other idea was to send the last known IDR, and then send all other non IDR frames that come before the one I want, only I would set for all of them RTP-TIME to be the same as the corresponding IDR. In this case the picture gets decoded perfectly, but now in the above case, 3 seconds that follow non IDR frame with the wanted time get fast paced in the decoder/player (there is no instantaneous seek)...
Any ideas? Or I can only seek to IDR-s and not the frames in between?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论