gpac / gpac

GPAC Ultramedia OSS for Video Streaming & Next-Gen Multimedia Transcoding, Packaging & Delivery
https://gpac.io
GNU Lesser General Public License v2.1
2.77k stars 532 forks source link

PCR interval errors #284

Closed angusbell closed 8 years ago

angusbell commented 9 years ago

We generated transport streams using MP42TS and when we analysed them, we found PCR interval errors. This is where the interval between successive PCRs is greater than 40ms. This is a problem for us as we need to be DVB-compliant; the relevant requirement is test no 2.3a "PCR_repetition_error" in ETSI TR 101 290 v1.2.1.

The tool has an option -pcr-ms which allows you to define the max interval - but even when set to 5 ms, the generated transport stream still has intervals of more than 40ms between PCRs. In the end we found a solution that worked: if we also specify the -single-au option, then the PCR interval is fixed.

Is this what you would expect, or is it a bug?

jeanlf commented 9 years ago

the -pcr-ms allows adjusting the pcr interval, however due to a limitation in the code PCR insertion is only performed at start of the frame. When packing two frames together in a single PES no PCR insertion is done for the second frame.

We will try to add more frequent PCR insertion but that's not on the high priority

jeanlf commented 8 years ago

This should now be fixed on git, using -force-pcr-only flag, could you give it a try ?

angusbell commented 8 years ago

I tried the -force-pcr-only flag and found two problems:

  1. There are lots of continuity counter errors on pid 111 carrying the video and PCR).
  2. The PTS values in the video are about 2147 seconds out of sync with (i.e. behind) the PCR: so for one sample, the PCR value is 00:36:33.309 (in hh:mm:ss.ms) whereas the PTS in the video is 00:00:46.118, a difference of approx 36 mins.
jeanlf commented 8 years ago

hmm that's strange, do you have a test MP4 source (and command line used) to reproduce the issue ? I don't have this bug (checking through a DVB analyser)

angusbell commented 8 years ago

hi jeanlf, I can make the source available to you if you email me at AngusBell@eurofins.com. this would not be for redistribution and would be for debugging purposes only.

angusbell commented 8 years ago

I realised there was a problem with the bitrate that I was specifying on the command line. When I fixed this, it solved the disparity between PTS and PCR.

However, I can still reproduce the continuity count errors. I think it is because I am specifying options "-force-pcr-only" and "-pcr-ms 30" when the video is 25fps and therefore only repeats every 40ms. I presume the multiplexer is adding PCR-only packets on the video pid, which is causing the continuity counter to get out of sync on that pid.

Do you still need an example stream?

jeanlf commented 8 years ago

are you sure about your conformance checker? PCR-only packets use TS packets with only adaptation fields (no payload), for which continuity counters shall not be incremented

angusbell commented 8 years ago

we use DVB Analyser by DVBControl. yes i see what you mean about non-incrementing conditions. it was just my guess that that was the problem. we would normally expect DVB Analyser to be correct; it sounds like you might also use it from one your comments above?

jeanlf commented 8 years ago

yes that's the one I use, version 1.1.667, and I don't have any error thrown. What exact command line do you use?

angusbell commented 8 years ago

MP42TS -src audio.mp4:ID=1:name=DTVL1:provider=DigitalTVLabs -src video.mp4:ID=1:name=DTVL1:provider=DigitalTVLabs -temi -pcr-init 0 -pcr-ms 40 -pcr-offset 25000 -rate 4000 -single-au -sdt-rate 1000 -dst-file out.ts