Incorrect start PTS on buffers from tsdemux using hlsdemux2?


I want to extract the PTS from TS files from an HLS. When doing so, I noticed there is an initial start offset of the PTS of 62s - which is incorrect.

This can easily be reproduced using playbin3 and gst-launch with a sample hls, however if using legacy playbin (hlsdemux) it gets the pts from the first frame.

The difference from what I can see is that when using hlsdemux2 ignore-pcr property is set to true by default on tsdemux. I tried setting this to false after pad-added signal from hlsdemux2 but this does not seem to help.

Is there a bug somewhere or how can I extract the actual PTS from the TS? (Note that I am not well adversed with the intricates of how mpegts works)

To repro:

GST_DEBUG=*tsdemux*:5 GST_DEBUG_FILE=playbin.log gst-launch-1.0 playbin uri=

less playbin.log
tsdemux tsdemux.c:2567:check_pending_buffers:[00m New initial pcr_offset 0:00:00.006575852
tsdemux tsdemux.c:2681:gst_ts_demux_parse_pes_header:<tsdemux0>[00m stream PTS 0:00:00.006575852 DTS 0:00:00.006575852
tsdemux tsdemux.c:2685:gst_ts_demux_parse_pes_header:[00m Moving data forward by 19 bytes (packet_size:0, have:176)
tsdemux tsdemux.c:3435:gst_ts_demux_push_pending_data:<tsdemux0:video_0_0101>[00m stream:0x1118041b0, pid:0x0101 stream_type:27 state:2
tsdemux tsdemux.c:2847:calculate_and_push_newsegment:<tsdemux0>[00m Creating new newsegment for stream 0x1118041b0
tsdemux tsdemux.c:2873:calculate_and_push_newsegment:<tsdemux0>[00m lowest_pts 6575852 => clocktime 0:00:00.006575852
GST_DEBUG=*tsdemux*:5 GST_DEBUG_FILE=playbin3.log gst-launch-1.0 playbin3 uri=
less playbin3.log
tsdemux tsdemux.c:2681:gst_ts_demux_parse_pes_header:<tsdemux1>[00m stream PTS 0:01:02.000000000 DTS 99:99:99.999999999
tsdemux tsdemux.c:2685:gst_ts_demux_parse_pes_header:[00m Moving data forward by 14 bytes (packet_size:25, have:25)
tsdemux tsdemux.c:3435:gst_ts_demux_push_pending_data:<tsdemux1:audio_0_0102>[00m stream:0x15bfc15f0, pid:0x0102 stream_type:15 state:2
tsdemux tsdemux.c:2847:calculate_and_push_newsegment:<tsdemux1>[00m Creating new newsegment for stream 0x15bfc15f0
tsdemux tsdemux.c:2873:calculate_and_push_newsegment:<tsdemux1>[00m lowest_pts 62000000000 => clocktime 0:01:02.000000000
1 Like