ffmpeg.c什么PTS和DTS?这是什么code块ffmpeg.c吗? [英] ffmpeg.c what are pts and dts ? what does this code block do in ffmpeg.c?
问题描述
- 在简单来说有什么PTS和DTS值?
- 为何如此重要,而转码[德code-CN code]视频?
这是什么code位在<一做href=\"http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/ffmpeg_8c-source.html\">ffmpeg.c ,其目的是什么?
01562 ist-&GT; next_pts = ist-&GT; PTS = picture.best_effort_timestamp;
01563如果(ist-&GT; ST-&GT; codeC-&GT;!time_base.num = 0){
01564 INT蜱= ist-&GT; ST-&GT;解析器? ist-&GT; ST-&GT; parser-&GT; repeat_pict + 1:ist-&GT; ST-&GT; codeC-&GT; ticks_per_frame;
01565 ist-&GT; next_pts + =((的int64_t)AV_TIME_BASE *
01566 ist-&GT; ST-&GT; codeC-&GT; time_base.num *蜱)/
01567 ist-&GT; ST-&GT; codeC-&GT; time_base.den;
01568}
这些都是解码时间标记(DTS)和presentation时间戳(PTS)。你可以在这里找到一个解释教程里面
所以我们说我们有一个电影,和帧被显示成:我B B P。现在,我们需要知道在P中的信息之前,我们可以显示B帧。正因为如此,这些帧可以被存储这样的:我P B B.这就是为什么我们有一个解码时间戳和每帧上的presentation时间戳。解码时间戳告诉我们,当我们需要取消code的东西,和presentation时间戳告诉我们,当我们需要显示的东西。因此,在这种情况下,我们的数据流可能是这样的:
PTS:1 4 2 3
DTS:1 2 3 4
流:I P B B
通常,当我们正在播放的流具有B帧在它的PTS和DTS只会有所不同。
块引用>
- In simple terms what are pts and dts values?
- Why are they important while transcoding [decode-encode] videos ?
What does this code bit do in ffmpeg.c , what is its purpose?
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 }
解决方案Those are the decoding time stamp (DTS) and presentation time stamp (PTS). You can find an explanation here 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.
这篇关于ffmpeg.c什么PTS和DTS?这是什么code块ffmpeg.c吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!