gpt4 book ai didi

c - ffmpeg.c 什么是 pts 和 dts ?这个代码块在 ffmpeg.c 中做了什么?

转载 作者:太空狗 更新时间:2023-10-29 16:19:05 25 4
gpt4 key购买 nike

  • 简单来说,什么是 pts 和 dts 值?
  • 为什么它们在转码 [decode-encode] 视频时很重要?

此代码位在 ffmpeg.c 中的作用是什么? , 它的目的是什么?

01562    ist->next_pts = ist->pts = picture.best_effort_timestamp;
01563 if (ist->st->codec->time_base.num != 0) {
01564 int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
01565 ist->next_pts += ((int64_t)AV_TIME_BASE *
01566 ist->st->codec->time_base.num * ticks) /
01567 ist->st->codec->time_base.den;
01568 }

最佳答案

它们是解码时间戳 (DTS) 和呈现时间戳 (PTS)。您可以在这里找到解释 inside a tutorial .

So let's say we had a movie, and the frames were displayed like: I B B P. Now, we need to know the information in P before we can display either B frame. Because of this, the frames might be stored like this: I P B B. This is why we have a decoding timestamp and a presentation timestamp on each frame. The decoding timestamp tells us when we need to decode something, and the presentation time stamp tells us when we need to display something. So, in this case, our stream might look like this:

   PTS: 1 4 2 3
DTS: 1 2 3 4
Stream: I P B B

Generally the PTS and DTS will only differ when the stream we are playing has B frames in it.

关于c - ffmpeg.c 什么是 pts 和 dts ?这个代码块在 ffmpeg.c 中做了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6044330/

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