(转自)视频流中的DTS/PTS到底是什么;
hi,这可能是一个弱智问题,但是当我使用bbMEG1.24beta17编码时,一直以来总是遇到这个下溢的问题。我从日志文件中得到的唯一启示就是我应该更改mux率。。。但是帮助文档却说将mux率设置为0可以强制其值由编码器来计算。有谁知道我应该设置什么值么?能有人准确的描述一下什么是PTS/DTS么?我一直使用一款SigmaDesigns NS2000卡来播放,却还没有看到我的视频效果。。。
###
Input information
Video:
width: 720, height: 480
first frame: 1, number of frames: 300000
Audio:
sample rate: 48.0 kHz
channels: stereo
bits per sample: 16
Output MPEG information
Video: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.m2v, deleted if multiplexed
MPEG-2, 720x480 @ 29.97 fps, variable bitrate, quant value = 1
Audio: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.mp2, deleted if multiplexed
Layer 2, 64 kbps, 48.0 kHz, stereo
Multiplexing: video and one audio stream
program stream type: MPEG-2 with pulldown auto-detection
video file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.m2v
audio 1 file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.mp2
program file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut
Encoding Video:
Video Encoding finished at frame # 1228.
Min bitrate of any one frame = 2773 bits
Max bitrate of any one frame = 339049 bits
Min bitrate over any one second = 1486741 bps
Avg bitrate over any one second = 2706791 bps
Max bitrate over any one second = 3040605 bps
Total time: 1658 seconds (00:27:38), 0.74 frames/sec, 1.350 sec/frame.
Encoding Audio:
Avg slots/frame = 192.000; b/smp = 1.33; br = 64.000 kbps.
Multiplexing video and audio:
Scanning video stream for a sequence header and pulldown type ...
no pulldown detected ...
Scanning video stream for pictures ...
Found 1242 picture headers.
Video stream information
Stream length : 15621086
Total time (seconds) : 41
Sequence start : 83
Sequence end : 1
No. Pictures : 1242
No. Groups : 83
No. I Frames : 82 avg. size 21925 bytes
No. P Frames : 332 avg. size 16821 bytes
No. B Frames : 828 avg. size 9958 bytes
No. D Frames : 0 avg. size 0 bytes
Horizontal size : 720
Vertical size : 480
Aspect ratio : 0.6735
Picture rate : 29.970 frames/sec
Bit rate : 375000 bytes/sec (3000000 bits/sec)
Computed avg rate : 377500 bytes/sec (3020000 bits/sec)
Computed max rate : 1798000 bytes/sec (14384000 bits/sec)
Vbv buffer size : 194560 bytes
CSPF : 0
Scanning audio stream for access units information
Found 1710 audio frame headers.
MPEG audio stream information
Stream length : 328320
Syncwords : 1710
Frames : 1710 size 192 bytes
Frames : 0 size 193 bytes
Layer : 2
CRC checksums : no
Bit rate : 8000 bytes/sec (64 kbit/sec)
Frequency : 48.0 kHz
Mode : 0 stereo
Mode extension : 0
Copyright bit : 0 no copyright
Original/Copy : 0 copy
Emphasis : 0 none
Multiplexing information
Video stream data rate : 1798000 bytes/sec (14384000 bits/sec)
Audio stream 1 data rate : 8000 bytes/sec (64000 bits/sec)
Overhead data rate : 32350 bytes/sec (258800 bits/sec)
Total data rate : 1838350 bytes/sec (14706800 bits/sec)
Multiplexing file c:/winnt/profiles/jstarkey/desktop/videoout
video PTS (41287.73ms) underflow at pack 7288 by 35.57ms
video PTS (41321.10ms) underflow at pack 7351 by 72.43ms
video DTS (41354.47ms) underflow at pack 7416 by 111.53ms
video PTS (41387.83ms) underflow at pack 7506 by 178.50ms
video PTS (41421.20ms) underflow at pack 7572 by 218.71ms
video DTS (41454.57ms) underflow at pack 7635 by 255.58ms
video PTS (41487.93ms) underflow at pack 7725 by 322.55ms
video PTS (41521.30ms) underflow at pack 7783 by 353.84ms
video DTS (41554.67ms) underflow at pack 7843 by 387.36ms
9 video underflows (SCR >= PTS or DTS)
NOTE: The resulting file may not play back correctly.
Try increasing the mux rate.
Finished multiplexing c:/winnt/profiles/jstarkey/desktop/videoout
###
A:From:BEYELER
To:JAMUELS
DTS(解码时间戳)和PTS(显示时间戳)分别是解码器进行解码和显示帧时相对于SCR(系统参考)的时间戳。SCR可以理解为解码器应该开始从磁盘读取数据时的时间。
mpeg文件中的每一个包都有一个SCR时间戳并且这个时间戳就是读取这个数据包时的系统时间。通常情况下,解码器会在它开始读取mpeg流时启动系统时钟(系统时钟的初始值是第一个数据包的SCR值,通常为0但也可以不从0开始)。
DTS时间戳决定了解码器在SCR时间等于DTS时间时进行解码,PTS时间戳也是类似的。通常,DTS/PTS时间戳指示的是晚于音视频包中的SCR的一个时间。例如,如果一个视频数据包的SCR是100ms(意味着此包是播放100ms以后从磁盘中读取的),那么DTS/PTS值就差不多是200/280ms,表明当SCR到200ms时这个视频数据应该被解码并在80ms以后被显示出来(视频数据在一个buffer中一直保存到开始解码)
下溢通常发生在设置的视频数据流相关mux率太高。如果mux率是1000000bits/sec(意味着解码器要以1000000bits/sec的速率读取文件),可是视频速率是2000000bits/sec(意味着需要以2000000bits/sec的速率显示视频数据),从磁盘中读取视频数据时速度不够快以至于1秒钟内不能够读取足够的视频数据
。这种情况下DTS/PTS时间戳就会指示视频在从硬盘中读出来之前进行解码或显示(DTS/PTS时间戳就要比包含它们的数据包中的SCR时间要早了)。
如今依靠解码器,着基本已经不是什么问题了(尽管MPEG文件因为应该没有下溢而并不完全符合MPEG标准)。一些解码器(很多著名的基于PC的播放器)尽可能快的读取文件以便显示视频,可以的话直接忽略SCR。
注意在你提供的列表中,平均的视频流速率为~3Mbps(3000000bits/sec)但是它的峰值达到了14Mbps(相当大,DVD限制在9.8Mbps内)。这意味着mux率需要调整足够大以处理14Mbps的部分, bbMPEG计算出来的mux率有时候太低而导致下溢。
你计划让视频流速率这么高么?这已经超过了DVD的说明了,而且很可能在大多数独立播放其中都不能播放。如果你不是这么计划,我会从1增加mquant的值并且在视频设置中将最大码流设置为9Mbps以保持一个小一点的码流。
如果你确实想让视频码率那么高,你需要增大mux率。从提供的列表可以得出bbMPEG使用14706800bits/sec或者1838350bytes/sec的mux率(总数据速率为:1838350bytes/sec(14706800bits/sec)行)。你在强制mux率字段设置的值应该是以bytes/sec为单位并被50整除。所以我会从36767(1838350/50)开始,一直增加直到不会再出现下溢错误为止;
From: JAMUELS Mar-2 6:16 pm
To: ALL (1 of 3)
329.1
Hi,
This is probably a dumb question, but I’ve been experiencing underflow errors on some
material that I’ve encoded with bbMEG 1.24 beta 17. The only thing I can deduce from the
log file is that I should change the mux rate . . . But the help file says that setting the mux rate
to "0" will force it to be computed by the encoder. Any ideas as to what value I should try?
Would someone mind describing what exactly PTS/DTS are and how underflows can impact
the final program(or point me to a relevant source of info)? I’ve been playing back with a
Sigma Designs NS2000 card and haven’t seen my video affected per se . .
BTW, I’ve enclosed my log file for reference.
TIA and Regards,
JPS
###
Input information
Video:
width: 720, height: 480
first frame: 1, number of frames: 300000
Audio:
sample rate: 48.0 kHz
channels: stereo
bits per sample: 16
Output MPEG information
Video: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.m2v, deleted if multiplexed
MPEG-2, 720x480 @ 29.97 fps, variable bitrate, quant value = 1
Audio: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.mp2, deleted if multiplexed
Layer 2, 64 kbps, 48.0 kHz, stereo
Multiplexing: video and one audio stream
program stream type: MPEG-2 with pulldown auto-detection
video file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.m2v
audio 1 file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut.mp2
program file: C:/WINNT/Profiles/jstarkey/Desktop/videoOut
Encoding Video:
Video Encoding finished at frame # 1228.
Min bitrate of any one frame = 2773 bits
Max bitrate of any one frame = 339049 bits
Min bitrate over any one second = 1486741 bps
Avg bitrate over any one second = 2706791 bps
Max bitrate over any one second = 3040605 bps
Total time: 1658 seconds (00:27:38), 0.74 frames/sec, 1.350 sec/frame.
Encoding Audio:
Avg slots/frame = 192.000; b/smp = 1.33; br = 64.000 kbps.
Multiplexing video and audio:
Scanning video stream for a sequence header and pulldown type ...
no pulldown detected ...
Scanning video stream for pictures ...
Found 1242 picture headers.
Video stream information
Stream length : 15621086
Total time (seconds) : 41
Sequence start : 83
Sequence end : 1
No. Pictures : 1242
No. Groups : 83
No. I Frames : 82 avg. size 21925 bytes
No. P Frames : 332 avg. size 16821 bytes
No. B Frames : 828 avg. size 9958 bytes
No. D Frames : 0 avg. size 0 bytes
Horizontal size : 720
Vertical size : 480
Aspect ratio : 0.6735
Picture rate : 29.970 frames/sec
Bit rate : 375000 bytes/sec (3000000 bits/sec)
Computed avg rate : 377500 bytes/sec (3020000 bits/sec)
Computed max rate : 1798000 bytes/sec (14384000 bits/sec)
Vbv buffer size : 194560 bytes
CSPF : 0
Scanning audio stream for access units information
Found 1710 audio frame headers.
MPEG audio stream information
Stream length : 328320
Syncwords : 1710
Frames : 1710 size 192 bytes
Frames : 0 size 193 bytes
Layer : 2
CRC checksums : no
Bit rate : 8000 bytes/sec (64 kbit/sec)
Frequency : 48.0 kHz
Mode : 0 stereo
Mode extension : 0
Copyright bit : 0 no copyright
Original/Copy : 0 copy
Emphasis : 0 none
Multiplexing information
Video stream data rate : 1798000 bytes/sec (14384000 bits/sec)
Audio stream 1 data rate : 8000 bytes/sec (64000 bits/sec)
Overhead data rate : 32350 bytes/sec (258800 bits/sec)
Total data rate : 1838350 bytes/sec (14706800 bits/sec)
Multiplexing file c:/winnt/profiles/jstarkey/desktop/videoout
video PTS (41287.73ms) underflow at pack 7288 by 35.57ms
video PTS (41321.10ms) underflow at pack 7351 by 72.43ms
video DTS (41354.47ms) underflow at pack 7416 by 111.53ms
video PTS (41387.83ms) underflow at pack 7506 by 178.50ms
video PTS (41421.20ms) underflow at pack 7572 by 218.71ms
video DTS (41454.57ms) underflow at pack 7635 by 255.58ms
video PTS (41487.93ms) underflow at pack 7725 by 322.55ms
video PTS (41521.30ms) underflow at pack 7783 by 353.84ms
video DTS (41554.67ms) underflow at pack 7843 by 387.36ms
9 video underflows (SCR >= PTS or DTS)
NOTE: The resulting file may not play back correctly.
Try increasing the mux rate.
Finished multiplexing c:/winnt/profiles/jstarkey/desktop/videoout
Options Reply
From: BEYELER Mar-5 2:35 pm
To: JAMUELS (2 of 3)
329.2 in reply to 329.1
The DTS (Decoding Time Stamp) and PTS (Presentation Time Stamp) timestamps are when
the decoder is supposed to decode and display the frame relative to the SCR (System Clock
Reference) timestamp. The SCR can be thought of as the time the decoder is supposed to read
the data from the disk.
Every packet of data in the mpeg file has an SCR timestamp and this timestamp is the value
the system clock should be at when the packet is read. Usually, a decoder will start the system
clock when it starts reading an mpeg stream (the initial value of the system clock is the SCR
from the first packet of data, usually zero but it does not have to start at zero).
The DTS timestamp tells the decoder to decode the frame when the SCR time reaches the
DTS time, likewise for the PTS timestamp. Usually, the DTS/PTS timestamps indicate a time
later than the SCR of the packet the video/audio appear in. For example, if the SCR of a
packet of video data is 100ms (meaning it is read from the disk 100ms after the start of
playback), the DTS/PTS values would be something like 200/280ms, meaning when the SCR
reaches 200ms this video data is supposed to be decoded and then 80ms later it is to be
displayed (the video data is held in a buffer until decoding time).
Underflows usually occur when the video data rate is too high with respect to the muxing rate.
If the muxing rate is 1000000 bits/sec (meaning the decoder will read 1000000 bits/sec from
the file), but the video bitrate is 2000000 bits/sec (meaning 2000000 bits/sec are needed to
display a seconds worth of video data), the video data is not being read off the disk fast
enough to read all the video bits needed for one second. In this case the DTS/PTS timestamps
will indicate the video was to be decoded/displayed before it is read from the disk (the
DTS/PTS timestamps are earlier in time than the SCR timestamps of the packet they are
contained in).
Now depending on the decoder, this can be a problem or not (although the MPEG file is not
MPEG compliant as there should be no underflows!). Some decoders (most notably PC based
players) read the file as fast as needed to display the video, ignoring the SCR as needed.
Note that in the listing you provided, the average video bitrate is ~3Mbps (3000000 bits/sec)
but that it peaks as high as 14Mbps (rather large, DVD is limited to 9.8Mbps). This means the
mux rate needs to be large enough to handle the 14Mbps part and bbMPEG’s calculated mux
rate is sometimes too low leading to underflows.
Are you intending the video bitrate to be so high? This is beyond DVD specifications and
probably not playable on most standalone players. If not, I would either increase the mquant
value from 1 or enter a maximum bitrate of 9Mbps on the Video Settings page to keep the
bitrate down a bit.
If you do want the video bitrate to be that high, you will need to increase the mux rate. From
the listing provided, bbMPEG determined the mux rate to be 14706800 bits/sec or 1838350
bytes/sec (the Total data rate : 1838350 bytes/sec (14706800 bits/sec) line). The value you
would enter in the Force Mux Rate field would be the bytes/sec value divided by 50. So I
would start with 36767 (1838350 / 50) and increase the value from there until you get rid of
the underflow messages.
(转自)视频流中的DTS/PTS到底是什么;的更多相关文章
- 视频中的DTS与PTS的理解
原文地址:http://blog.itpub.net/30004768/viewspace-1338882/ DTS(解码时间戳)和PTS(显示时间戳)分别是解码器进行解码和显示帧时相对于SCR(系 ...
- AV时间戳dts,pts。从ffmpeg解码过程看过来。
解码过程中,dts由媒体流读入的包推动(解码包中的dts标记),dts在前进.pts是在dts前进到某处(截点)而进行动作的标记. 物理时间自然流逝,dts可以被控制同步与物理时间同一脚步节奏,也可以 ...
- Spring Boot 中的静态资源到底要放在哪里?
当我们使用 SpringMVC 框架时,静态资源会被拦截,需要添加额外配置,之前老有小伙伴在微信上问松哥Spring Boot 中的静态资源加载问题:"松哥,我的HTML页面好像没有样式?& ...
- CNN中,1X1卷积核到底有什么作用呢?
CNN中,1X1卷积核到底有什么作用呢? https://www.jianshu.com/p/ba51f8c6e348 Question: 从NIN 到Googlenet mrsa net 都是用了这 ...
- 调用opencv相关函数,从视频流中提取出图片序列&&&&jpg图片序列,转化成avi格式视频
/************************ @HJ 2017/3/30 参考http://blog.sina.com.cn/s/blog_4b0020f301010qcz.html修改的代码 ...
- CSS中背景图片的background-position中的left top到底是相对于谁的?
在学习的时候遇到了如下问题: CSS中背景图片的background-position中的left top到底是相对于谁的,content-box?padding-box?border-box? ba ...
- Java中的命名规范到底是怎样的
内容摘要:命名规范二,java中的方法名,对象名和字段名的第一个单词的首写字母应该小写,而后面的每个单词的首字母都应该小写 要想将java基础学的十分的牢固就必须将java中的命名规范掌握好了.俗话说 ...
- JS中this的值到底为何?
之前很久的时间,因为研究不深,对于this的值一直模模糊糊,不是很清楚,最近有空做了一些研究,终于彻底弄明白了this到底为何物. 首先, 先抛出一个定论:”在Javascript中,this关键字永 ...
- ffmpeg 从视频流中抓取图片
从视频中不断抓取图片的基本流程:打开视频流地址->获取视频流packt->解码成图片帧->输出图片 一.初始化Ffmpeg void ffmpegInit(){ av_registe ...
随机推荐
- 解决Linux平台下VMware出现"No 3d support is available from the host"或"Hardware graphics acceleration is not available" 错误
错误日志: No 3d support is available from the host Hardware graphics acceleration is not available 解决方法: ...
- 【Unity优化】怎样实现Unity编辑器中的协程
Unity编辑器中何时须要协程 当我们定制Unity编辑器的时候,往往须要启动额外的协程或者线程进行处理.比方当运行一些界面更新的时候,须要大量计算,假设用户在不断修正一个參数,比方从1变化到2.这种 ...
- 算法笔记_019:背包问题(Java)
目录 1 问题描述 2 解决方案 2.1 蛮力法 2.2 减治法 2.2.1 递归求解 2.2.2 非递归求解(运用异或运算) 2.3 动态规划法 1 问题描述 给定n个重量为w1,w2,w3,... ...
- Jquery重新学习之六[操作XML数据]
上一章整理有关Jquery操作JSON格式数据,本章则是整理Jquery与XML的交互,因为XML简单易用及运用在很跨平台上的优点,所以项目运用Jquery操作XML还是比较常见:下面的代码来自Jqu ...
- Java静态变量的初始化(static块的本质)
Java静态变量的初始化(static块的本质) 标签: javaclassstring编译器jdk工作 2010-02-06 07:23 33336人阅读 评论(16) 收藏 举报 分类: Jav ...
- linux内核——PAE(物理地址扩展)
引入PAE机制后,分页模式是怎样的呢? 首先,要搞明白几件事,2.6.11以上版本的linux内核中,存在4中页表(页全局目录,页上级目录,页中级目录,页表),这些页表结构是已经存在于硬盘中的,当进程 ...
- PHP 通过LDAP协议,操作Windows Active Directory
原文地址:http://hi.baidu.com/lllangxx/item/3ccb7cdfa13b56eb3dc2cb39 一.学习如何管理Active Directory Active Dire ...
- 加速nginx: 开启gzip
nginx 是一个高性能的 Web 服务器,之前也写过一些关于 nginx 的文章.为了提高博客的响应速度,可以从设置 nginx 的 gzip 和缓存这2方面入手.为字体开启 gzip 和缓存能大大 ...
- javascript 打印错误信息 catch err
使用 console.log(err); 是无法打印出来的.默认只能打印出错误信息.如图 http.interceptors.response.use(response => { return ...
- win10 配置 python3 + opencv3.2 + VideoCapture
最近需要在 win10 上进行图片处理,使用深度学习框架 tensorflow ,所以安装了python3.5 + opencv3.2 + tensorflow + VideoCapture + PI ...