[vlc-devel] [PATCH 2/3] demux: avformat: fix negative PTS/DTS

Zhao Zhili quinkblack at foxmail.com
Fri Sep 1 04:12:50 CEST 2017


Sorry, wrong reply to.


On 2017年09月01日 01:06, Francois Cartegnie wrote:
> Le 31/08/2017 à 15:32, Zhao Zhili a écrit :
>>
>> 2. Otherwise, which most likely means the negative PTS and DTS is produced
>> by shift, then shift start_time to produced positive timestamps.
> If that's MP4, that's either a media issue or an avformat one.
> There should be enough information to shift up all values.
>
Here is a test case:

    806 #ifdef AVFORMAT_DEBUG
    807     msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64
    808             ", original dts=%" PRId64 " original pts=%" PRId64
    809             ", start time=%" PRId64 ", original start time=%" 
PRId64,
    810              pkt.stream_index, p_frame->i_dts, p_frame->i_pts,
    811              pkt.dts, pkt.pts,
    812              p_sys->ic->start_time, i_start_time);

vlc$ ./vlc -vvv --demux=avformat 15.ts 2>&1 |grep "avformat demux debug: tk"
[00007f0238c05e80] avformat demux debug: tk[0] dts=-79999 pts=1, 
original dts=8100000 original pts=8107200, start time=90080000, original 
start time=90080000
[00007f0238c05e80] avformat demux debug: tk[0] dts=-39999 pts=120001, 
original dts=8103600 original pts=8118000, start time=90080000, original 
start time=90080000
[00007f0238c05e80] avformat demux debug: tk[0] dts=1 pts=80001, original 
dts=8107200 original pts=8114400, start time=90080000, original start 
time=90080000
[00007f0238c05e80] avformat demux debug: tk[0] dts=40001 pts=40001, 
original dts=8110800 original pts=8110800, start time=90080000, original 
start time=90080000
[00007f0238c05e80] avformat demux debug: tk[0] dts=80001 pts=280001, 
original dts=8114400 original pts=8132400, start time=90080000, original 
start time=90080000

So it's not a media issue or avformat one, but how we deal with the 
start time.


>> 3. PTS/DTS wrap can lead to negative timestamps too, which is harder to
>> handle.
>> Don't distinguish this case from case 2.
> TS Wrap ? I don't think it can happen, and it is handled by the library
> afair.
>





More information about the vlc-devel mailing list