H264流的演示时间不正确[Live555 OpenRtspClient] [英] Wrong Presentation time at H264 streams [Live555 OpenRtspClient]

查看:248
本文介绍了H264流的演示时间不正确[Live555 OpenRtspClient]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将OpenRtspClient修改为

I modify the OpenRtspClient so that

  • 现在,我没有将帧写入文件中,而是将它们收集在具有传入演示文稿时间的队列中

  • Now instead of writing frames to file I collect them in a queue with incoming presenttaion times

然后将h264帧提供给MP4多路复用器[Geraint Davies MP4多路复用器过滤器]

Then give the h264 frames to MP4 muxer [ Geraint Davies MP4 mux filter]

所以我可以将h264流保存到MP4容器中...

So I can able to save h264 stream into MP4 container...

但是问题是,一些记录的数据[不是全部] 持续时间的值有误:

But the problem is that, some of the recorded data [NOT all of them] has wrong values for time duration:

假设10分钟的记录似乎是12小时的流... VLC播放剩余时间播放最后一帧的10分钟.

Suppose that a 10 minute record seems that it was 12 h stream... VLC play the 10 minute that play last frame for the remaing time.

似乎我在Muxer中设置了错误的采样时间... 然后我调试一下,发现在时间戳上有正向和负向的戏剧性跳跃……

It seems that i set sample times wrong into the Muxer... Then i debug and see that there is positive and negative dramatic jumps at time stamps...

这是我设置时间戳的方法:

Here is how i set time stamps:

  • 第一次我从H264VideoFileSink :: afterGettingFrame1函数获取了presentationTime
  • 然后计算firstPresentaionTime [在开头]
  • 然后收集其他时间戳记

而且我看到frameTimeStamp值显示出急剧的跳升到负值或正值... [我将这些值保留为int64]

And I see that frameTimeStamp values show dramatic jumps to negative or positive values...[ i keeep those values as int64 ]

#define TIMEVAL_TO_REFERENCE_TIME(x) 
      ((__int64)(x.tv_sec * 1000000) + x.tv_usec) * 10

void  H264VideoFileSink::
 afterGettingFrame1(unsigned frameSize, struct timeval presentationTime) 
{

    // At the beginning [ just for once calculate firstPresentaionTime ]

    firstPresentaionTime = TIMEVAL_TO_REFERENCE_TIME(presentationTime);

    // for the other frames collect frames timestamps

    frameTimeStamp = TIMEVAL_TO_REFERENCE_TIME(presentationTime) - 
firstPresentationTime

    }

我的原因是什么?

  • 或者将这个"presentationTime"用于MP4混合器是个好主意吗?
  • 在库中计算"presentationTime"的位置是什么?
  • H264VideoFileSink :: afterGettingFrame1方法"presentationTime"值是否可能错误?
  • 有人在mp4录制器中录制h264流并想分享他/她的经验吗?

推荐答案

部分回答您的问题:

  • 在库中"presentationTime"是在哪里计算的?
  • H264VideoFileSink :: afterGettingFrame1方法的"presentationTime"值是否可能是错误的?
  • Where the "presentationTime" is calculated at library?
  • Is it possible that H264VideoFileSink::afterGettingFrame1 method "presentationTime" values may be wrong?

  • 演示时间基于样本的RTP时间戳.
  • 不太可能,我们使用live555的时间很长,没有任何时间戳问题.如果时间戳不正确,我会怀疑RTP源(即RTSP服务器或摄像机)的时间戳不正确.使用wireshark嗅探RTP数据包以查看RTP时间戳,然后从那里转换回NTP时间,以查看连续帧之间的差异,这可能有帮助,也可能没有帮助.
  • 这篇关于H264流的演示时间不正确[Live555 OpenRtspClient]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆