视频流中的DTS/PTS到底是什么 转载

翻译了一下:
Q:
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.

posted @ 2014-02-18 01:18  Cai00  阅读(1020)  评论(0编辑  收藏  举报