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

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

问题描述

网上似乎没有任何关于这些是什么的解释.人们经常谈论它们.我只想知道它们是什么以及它们为什么重要.使用 -video_track_timescale,我将如何确定它的数字?是随机的吗?应该是0吗?

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?

推荐答案

现代容器使用时间戳而不是帧速率来管理视频(和音频)帧呈现的时间分量.因此,它们不是将视频录制为 25 fps,从而暗示每帧应该相隔 0.04 秒绘制,而是为每帧存储一个时间戳,例如

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
   ...

为了精确解析这些时间值,使用了时基,即代表时钟滴答声的时间单位.因此,1/75 的时基表示 1/75 秒.Presentation TimeS tamp 然后根据这个时基来命名.时间刻度只是时基的倒数.FFmpeg 将时间刻度显示为流读取中的 tbn 值.

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天全站免登陆