[FFmpeg-user] Invalid MPEG-TS PCR rate when increasing the framerate

Aergistal aergistall at gmail.com
Tue Nov 1 11:27:06 EET 2016


Hello,

The mpegts muxer produces invalid PCR intervals while encoding if the
framerate is increased for example from 24 to 25 fps the naive way.

A PCR interval of 120 ms is introduced every second and it's probably
caused by the added frame. The PCR delta is greater than the 100ms
specified in section 2.7.2 of ISO/IEC 13818-1.

Is there any way to force the correct PCR interval without speeding-up the
input?

Thanks.


Tested using the latest git version:

$ ffmpeg -i BigBuckBunny_320x180.mp4 -c:v libx264 -r 25 -an -t 3 -y
invalid_pcr_rate.ts
ffmpeg version N-82166-g894e7ef Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 6.2.0 (Ubuntu 6.2.0-5ubuntu12) 20161005
  configuration: --prefix=/home/user/src/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/user/src/ffmpeg_build/include
--extra-ldflags=-L/home/user/src/ffmpeg_build/lib --bindir=/home/user/bin
--enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libx265 --enable-x11grab
--enable-libopencore-amrnb --enable-version3 --enable-nonfree --enable-debug
  libavutil      55. 35.100 / 55. 35.100
  libavcodec     57. 65.100 / 57. 65.100
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 66.100 /  6. 66.100
  libswscale      4.  3.100 /  4.  3.100
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'BigBuckBunny_320x180.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 1970-01-01T00:00:00.000000Z
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    date            : 2008
    encoder         : Lavf52.14.0
  Duration: 00:09:56.46, start: 0.000000, bitrate: 867 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 702 kb/s, 24 fps, 24 tbr,
24 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 159 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : SoundHandler
[libx264 @ 0x55e2f4ff50a0] using SAR=1/1
[libx264 @ 0x55e2f4ff50a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0x55e2f4ff50a0] profile High, level 1.2
Output #0, mpegts, to 'invalid_pcr_rate.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    date            : 2008
    title           : Big Buck Bunny
    artist          : Blender Foundation
    composer        : Blender Foundation
    encoder         : Lavf57.57.100
    Stream #0:0(und): Video: h264 (libx264), yuv420p, 320x180 [SAR 1:1 DAR
16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
    Metadata:
      creation_time   : 1970-01-01T00:00:00.000000Z
      handler_name    : VideoHandler
      encoder         : Lavc57.65.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   72 fps=0.0 q=-1.0 Lsize=      44kB time=00:00:02.88 bitrate=
125.3kbits/s speed=15.2x
video:32kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 36.859985%
[libx264 @ 0x55e2f4ff50a0] frame I:1     Avg QP:10.00  size:   782
[libx264 @ 0x55e2f4ff50a0] frame P:24    Avg QP:18.36  size:   853
[libx264 @ 0x55e2f4ff50a0] frame B:47    Avg QP:18.40  size:   249
[libx264 @ 0x55e2f4ff50a0] consecutive B-frames:  9.7%  5.6% 12.5% 72.2%
[libx264 @ 0x55e2f4ff50a0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x55e2f4ff50a0] mb P  I16..4: 22.2% 19.9%  2.4%  P16..4: 22.1%
 4.7%  1.6%  0.0%  0.0%    skip:27.0%
[libx264 @ 0x55e2f4ff50a0] mb B  I16..4:  7.1%  6.8%  0.1%  B16..8: 13.4%
 0.4%  0.1%  direct: 7.0%  skip:65.1%  L0:43.9% L1:46.7% BI: 9.4%
[libx264 @ 0x55e2f4ff50a0] 8x8 transform intra:43.6% inter:74.0%
[libx264 @ 0x55e2f4ff50a0] coded y,uvDC,uvAC intra: 9.4% 38.9% 5.9% inter:
4.9% 15.1% 0.6%
[libx264 @ 0x55e2f4ff50a0] i16 v,h,dc,p: 51% 23% 19%  7%
[libx264 @ 0x55e2f4ff50a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 15% 66%  0%
 0%  0%  0%  0%  0%
[libx264 @ 0x55e2f4ff50a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 63%  8% 17%  2%
 2%  2%  1%  2%  2%
[libx264 @ 0x55e2f4ff50a0] i8c dc,h,v,p: 64% 20% 15%  1%
[libx264 @ 0x55e2f4ff50a0] Weighted P-Frames: Y:70.8% UV:41.7%
[libx264 @ 0x55e2f4ff50a0] ref P L0: 73.8% 11.9% 11.1%  3.2%
[libx264 @ 0x55e2f4ff50a0] ref B L0: 90.1%  8.2%  1.7%
[libx264 @ 0x55e2f4ff50a0] ref B L1: 94.5%  5.5%
[libx264 @ 0x55e2f4ff50a0] kb/s:87.91


$ dvbsnoop -s ts -tsraw -nohexdumpbuffer -pd 3 -if invalid_pcr_rate.ts |
egrep 'discontinuity_indicator|program_clock_reference' | egrep
'program_clock_reference' -B1

...
        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 31860000 (0x01e62520)  [=
PCR-Timestamp: 0:00:01.180000]
        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 35100000 (0x02179560)  [=
PCR-Timestamp: 0:00:01.300000]    <-- delta = 120 ms

...
        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 58860000 (0x038221e0)  [=
PCR-Timestamp: 0:00:02.180000]

        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 62100000 (0x03b39220)  [=
PCR-Timestamp: 0:00:02.300000]   <-- delta = 120 ms

...
        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 85860000 (0x051e1ea0)  [=
PCR-Timestamp: 0:00:03.180000]

        discontinuity_indicator: 0 (0x00)
        program_clock_reference:
             ==> program_clock_reference: 89100000 (0x054f8ee0)  [=
PCR-Timestamp: 0:00:03.300000]   <-- delta = 120 ms
-------------- next part --------------
A non-text attachment was scrubbed...
Name: invalid_pcr_rate.ts
Type: text/vnd.trolltech.linguist
Size: 45120 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20161101/e05db805/attachment.bin>


More information about the ffmpeg-user mailing list