gpt4 book ai didi

c - 获取 AVFrame 点值

转载 作者:太空宇宙 更新时间:2023-11-04 03:49:15 26 4
gpt4 key购买 nike

  1. 我有一个来自 FormatContext 的视频的 AVStream。 [avstream]
  2. 读取数据包
  3. 解码来自视频的数据包。
  4. 现在显示以下内容。

    Packet DTS ->  7200.00    [ from packet ]
    Frame PTS -> -9223372036854775808.000000
    stream time_base -> 0.000011
    Offset -> 0.080000 [ pts * time_base ]

代码:

double pts = (double) packet.dts;
printf (" dts of packet %f , Frame pts: %f, timeBase %f Offset: %f ",
pts,
(double)pFrame->pts,
av_q2d (avstream->time_base) ,
pts
*av_q2d(avstream->time_base));
  1. 为什么 Frame pts 是负数?这是预期的行为吗?
  2. 我是否需要考虑数据包 DTS 中的帧点 [即:帧点 = 数据包数据传输系统]

最佳答案

您看到的 PTS 数字是 -9223372036854775808 (0x8000000000000000) 也称为 AV_NOPTS_VALUE。这意味着没有可用的值。

当我看到这个时我找不到解决方案,所以在经过相当长一段时间的努力之后,当我看到这个时我最终手动推进了我的视频时钟。

int64 pts = m_frame->pts;

if (pts == AV_NOPTS_VALUE)
{
pts = m_videoClock +
(1.f / av_q2d(stream->avg_frame_rate)) / av_q2d(stream->time_base);
}

m_videoClock = pts;

我认为 DTS 在这里没有用,因为它代表数据包解码的时间,它不能替代 PTS。

关于c - 获取 AVFrame 点值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22018784/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com