什么是ffmpeg中的视频时间刻度,时基或时间戳? [英] What is video timescale, timebase, or timestamp in ffmpeg?

查看:1460
本文介绍了什么是ffmpeg中的视频时间刻度,时基或时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络上似乎没有任何解释。人们谈论他们很多。我只是想知道他们是什么,为什么他们是重要的。使用-video_track_timescale,如何确定一个数字?是随机的吗?应该是0?

解决方案

现代容器管理视频(和音频)帧使用时间戳的时间分量,而不是帧率。因此,不是将视频录制为25 fps,因此意味着每个帧应相互间隔0.04秒,它们会为每个帧存储时间戳,例如

 框架pts_time 
0 0.00
1 0.04
2 0.08
3 0.12
...
为了精确地分辨这些时间值,使用时基,即表示时钟的一个刻度的时间单位,因为它是。因此, 1/75 的时基代表1/75秒。然后,根据这个时基计算 P resentation T ime S 。时间刻度只是时基的倒数。 FFmpeg显示流量读数中的 tbn 值的时间尺度。

 时基= 1/75; Timescale = 75 
框架pts_time
0 0 0 x 1/75 = 0.00
1 3 3 x 1/75 = 0.04
2 6 6 x 1/75 = 0.08
3 9 9 x 1/75 = 0.12
...

此方法调节时间允许可变帧率视频。


There does not seem to be any explanation online as to what these are. People talk about them a lot. I just want to know what they are and why they are significant. Using -video_track_timescale, how would I determine a number for it? Is it random? Should it be 0?

解决方案

Modern containers govern the time component of presentation of video (and audio) frames using timestamps, rather than framerate. So, instead of recording a video as 25 fps, and thus implying that each frame should be drawn 0.04 seconds apart, they store a timestamp for each frame e.g.

 Frame      pts_time
   0          0.00
   1          0.04
   2          0.08
   3          0.12
   ...

For the sake of precise resolution of these time values, a timebase is used i.e. a unit of time which represents one tick of a clock, as it were. So, a timebase of 1/75 represents 1/75th of a second. The Presentation TimeStamps are then denominated in terms of this timebase. Timescale is simply the reciprocal of the timebase. FFmpeg shows the timescale as the tbn value in the readout of a stream.

Timebase = 1/75; Timescale = 75
 Frame        pts           pts_time
   0          0          0 x 1/75 = 0.00
   1          3          3 x 1/75 = 0.04 
   2          6          6 x 1/75 = 0.08
   3          9          9 x 1/75 = 0.12
   ...

This method of regulating time allows variable frame-rate video.

这篇关于什么是ffmpeg中的视频时间刻度,时基或时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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