[FFmpeg-devel] [bug/patch] MPEG-TS muxer: PCR not in sync withPTS/DTS

Stratford, Alan Alan.Stratford
Fri Nov 13 15:44:19 CET 2009

I would like to make an observation that seems relevant to this "PCR not
in sync with PTS/DTS" thread.

I am trying to split an mpegts stream into smaller ts files. I want to
keep the original PTS values in the output files, but this seems to lead
to problems where the PCR gets out of sync with the PTS. I will
illustrate the problem with a simple ffmpeg command. Any TS file with a
video stream could be used as the input file (it will obviously need to
be longer than 10 seconds for the following example, and may need
non-zero start times for the PTS/PCR). The command is:

ffmpeg -copyts -i infile.ts -vcodec copy -an -t 10 -f mpegts outfile.ts

As an example I took a TS file generated by a pvr as my 'infile.ts' and
ran it through the above command. In this case the PCR and PTS values in
infile.ts started at about 76601 seconds and ended at about 77479. In
out.ts the PTS values were as expected, i.e. they ranged from 76601 to
76611 seconds. The PCR values ranged from roughly 0 to 277 seconds,
which seems very wrong for a 10 second clip. out.ts played ok in ffplay,
but would not play in vlc.

I have tried other options on the command line, such as -muxrate to
generate a CBR output, which affect the PCR values but they always start
a roughly 0 and end at a much higher value than the expected 10 seconds.

If the -copyts is omitted from the above command then the PCR and PTS
seem OK, i.e. they both start at roughly 0 seconds and end at roughly 10

Thanks for the efforts to clear up the PTS/PCR sync issues so far.


ffmpeg-devel mailing list
ffmpeg-devel at mplayerhq.hu

Rosemount Aerospace Limited.
Registered Office: Stratford Road, Solihull, West Midlands, B90 4LA.
Registered in England No. 02849033.

More information about the ffmpeg-devel mailing list